Skip to content

Groovy 12103 part2#2626

Merged
paulk-asert merged 2 commits into
apache:masterfrom
paulk-asert:GROOVY-12103-part2
Jun 25, 2026
Merged

Groovy 12103 part2#2626
paulk-asert merged 2 commits into
apache:masterfrom
paulk-asert:GROOVY-12103-part2

Conversation

@paulk-asert

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens XML output safety in the groovy-xml subproject by rejecting comment / processing-instruction payloads that could prematurely terminate their respective constructs (e.g., -- in comments and ?> in processing instructions), and adds regression tests to validate the new behavior.

Changes:

  • Add injection-focused tests for MarkupBuilder, StreamingMarkupBuilder, and StreamingDOMBuilder comment/PI handling.
  • Add validation to MarkupBuilderHelper.comment(String) to reject comment terminators (--).
  • Add reusable validation closures in AbstractStreamingBuilder and apply them in StreamingMarkupBuilder / StreamingDOMBuilder for comments and processing instructions.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
subprojects/groovy-xml/src/test/groovy/groovy/xml/MarkupBuilderInjectionTest.groovy Adds regression tests for comment/PI injection prevention across builders.
subprojects/groovy-xml/src/main/java/groovy/xml/MarkupBuilderHelper.java Rejects XML comment text containing -- to prevent malformed output/injection.
subprojects/groovy-xml/src/main/groovy/groovy/xml/streamingmarkupsupport/AbstractStreamingBuilder.groovy Adds PI/comment validation helpers and PI map rendering guardrails.
subprojects/groovy-xml/src/main/groovy/groovy/xml/StreamingMarkupBuilder.groovy Applies new validation to streaming comment/PI emission.
subprojects/groovy-xml/src/main/groovy/groovy/xml/StreamingDOMBuilder.groovy Applies new validation to DOM comment/PI creation.

@paulk-asert paulk-asert merged commit 1d5213e into apache:master Jun 25, 2026
22 checks passed
@paulk-asert paulk-asert deleted the GROOVY-12103-part2 branch June 25, 2026 02:52
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.

3 participants