Skip to content

feat(java): detect MarkupText.addMarkup with a non-literal start tag (CWE-79) - #190

Open
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/jenkins-markuptext-addmarkup-nonliteral
Open

ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/jenkins-markuptext-addmarkup-nonliteral

Conversation

@ai-anant

Copy link
Copy Markdown

Adds a Jenkins-oriented Java rule for stored XSS via changelog markup:

codevigilant.java.jenkins.xss.markuptext-addmarkup-nonliteral

Fires when hudson.MarkupText.addMarkup(start, end, left, right) is called
with a non-literal start-tag argument. addMarkup inserts the start and end
strings as raw HTML around changelog text. When the start tag is built from
ticket URLs, issue identifiers, or other config/untrusted strings without
escaping, a quote or angle-bracket in that value breaks out of the
attribute/element.

The rule does not fire when the start tag is a string literal (static markup).

Validated with semgrep --validate; tested against a positive repro
(non-literal start tag — fires) and a sanitized negative (literal "<b>" /
"</b>" — no findings).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant