Skip to content

Harden Jackson XML unmarshalling against XXE explicitly#1312

Open
derTobsch wants to merge 1 commit into
mainfrom
harden-jackson-xxe
Open

Harden Jackson XML unmarshalling against XXE explicitly#1312
derTobsch wants to merge 1 commit into
mainfrom
harden-jackson-xxe

Conversation

@derTobsch

Copy link
Copy Markdown
Contributor

Build the XmlMapper on an XmlFactory backed by an XMLInputFactory with SUPPORT_DTD and IS_SUPPORTING_EXTERNAL_ENTITIES disabled. Jackson's XML defaults already reject DTDs/external entities, but configuring it explicitly keeps the protection from depending on the defaults of whichever StAX provider happens to be on the classpath.

Add a regression test asserting that XML containing a DOCTYPE declaration is rejected.

Build the XmlMapper on an XmlFactory backed by an XMLInputFactory with
SUPPORT_DTD and IS_SUPPORTING_EXTERNAL_ENTITIES disabled. Jackson's XML
defaults already reject DTDs/external entities, but configuring it
explicitly keeps the protection from depending on the defaults of
whichever StAX provider happens to be on the classpath.

Add a regression test asserting that XML containing a DOCTYPE
declaration is rejected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

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