Skip to content

Centralize XXE hardening for StAX XML parsers#12256

Open
gnodet wants to merge 1 commit into
masterfrom
iris-galliform
Open

Centralize XXE hardening for StAX XML parsers#12256
gnodet wants to merge 1 commit into
masterfrom
iris-galliform

Conversation

@gnodet

@gnodet gnodet commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Alternative to #12251 — centralizes the XXE hardening into a single shared XmlService.newXMLInputFactory() method instead of duplicating a newInputFactory() helper in each class.

The maven-xinclude-extension is unaffected — it creates its own WstxInputFactory with entities explicitly enabled and a restricted LocalXmlResolver.

Test plan

  • mvn verify passes on all affected modules
  • ExtensionDescriptorBuilderTest.testExternalEntityIsNotResolved confirms XXE is blocked

Claude Code on behalf of Guillaume Nodet

Add XmlService.newXMLInputFactory() as a single shared method that
creates a hardened XMLInputFactory with SUPPORT_DTD and
IS_SUPPORTING_EXTERNAL_ENTITIES disabled. Replace all direct
XMLInputFactory.newFactory() calls across the codebase with this
centralized method. Also harden the Velocity templates (reader-stax.vm
and reader.vm) that generate StAX readers for settings, toolchains,
metadata, and plugin descriptors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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