Skip to content

Use commons-secure-xml for the XPath and DOM factories in core - #2257

Merged
jnioche merged 1 commit into
mainfrom
secure-xml-factories
Oct 23, 2026
Merged

jnioche merged 1 commit into
mainfrom
secure-xml-factories

Conversation

@rzo1

@rzo1 rzo1 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Hardening, no known issue behind it. Core now creates its JAXP factories through Apache Commons Secure XML (1.1.0, no runtime dependencies):

  • jsoup.XPathFilter and parse.filter.XPathFilter use SecureXPathFactory.newDefaultInstance(). This pins the JDK's XPath implementation instead of whatever is registered on the classpath, and turns on secure processing (no extension functions, JDK processing limits). The expressions still run against the in-memory DOM, so results are unchanged.
  • RegexURLNormalizer reads its rules file with SecureDocumentBuilderFactory.newDefaultInstance(), so external DTDs and entities are no longer fetched. Before, a rules file declaring an external DTD made the normalizer load no rules if the DTD could not be fetched. RegexURLNormalizerTest covers this; it fails on main.

Left out on purpose:

@rzo1 rzo1 added this to the 4.0.0 milestone Oct 23, 2026
@rzo1 rzo1 self-assigned this Oct 23, 2026
@rzo1
rzo1 requested review from dpol1 and jnioche October 23, 2026 11:16
@jnioche
jnioche merged commit d6893c3 into main Oct 23, 2026
2 checks passed
@jnioche
jnioche deleted the secure-xml-factories branch October 24, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants