Skip to content

Harden JAXB XML unmarshalling against XXE explicitly#1311

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

Harden JAXB XML unmarshalling against XXE explicitly#1311
derTobsch wants to merge 1 commit into
mainfrom
harden-jaxb-xxe

Conversation

@derTobsch

Copy link
Copy Markdown
Contributor

Parse holiday XML through an XMLInputFactory with SUPPORT_DTD and IS_SUPPORTING_EXTERNAL_ENTITIES disabled instead of unmarshalling the raw InputStream directly. Previously the absence of DTD/external-entity processing relied entirely on the defaults of whichever StAX/JAXB provider was on the classpath, which would silently disappear if a consumer swapped or downgraded that provider.

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

Parse holiday XML through an XMLInputFactory with SUPPORT_DTD and
IS_SUPPORTING_EXTERNAL_ENTITIES disabled instead of unmarshalling the
raw InputStream directly. Previously the absence of DTD/external-entity
processing relied entirely on the defaults of whichever StAX/JAXB
provider was on the classpath, which would silently disappear if a
consumer swapped or downgraded that provider.

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