Skip to content

Fix JUnit XML attribute escaping (use quoteattr)#7

Merged
levine-cycode merged 1 commit into
mainfrom
fix/junit-xml-attribute-escaping
Apr 23, 2026
Merged

Fix JUnit XML attribute escaping (use quoteattr)#7
levine-cycode merged 1 commit into
mainfrom
fix/junit-xml-attribute-escaping

Conversation

@appsechq-brian
Copy link
Copy Markdown
Member

Summary

  • Findings containing double quotes in their message broke the Tests tab (`'Secure' is an unexpected token`)
  • `xml.sax.saxutils.escape()` only handles `&`, `<`, `>` — not `"`
  • Switch to `quoteattr()`, which escapes `"` and returns the value wrapped in quotes

Test plan

  • Python syntax check passes
  • Validated in a pipeline run with 69 SAST findings: Tests tab now populates with no warnings

Findings whose message text contained a double quote produced malformed
XML attributes that Azure Pipelines' PublishTestResults@2 rejected with
"'Secure' is an unexpected token. Expecting whitespace" and the Tests
tab failed to populate.

xml.sax.saxutils.escape() only handles &, <, >. quoteattr() additionally
escapes " and returns the value wrapped in quotes — the canonical way to
build XML attribute values.

Verified end-to-end in the AppSecHQ/vectorvictor publish-results pipeline
against a run with 69 findings; Tests tab now populates cleanly.
@levine-cycode levine-cycode merged commit e1e977a into main Apr 23, 2026
6 of 7 checks passed
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.

2 participants