[backport camel-4.14.x] CAMEL-24299: disable DTD support in XmlStreamDetector for consistency with other XML parsers - #25322
Merged
Conversation
… with other XML parsers (apache#25279) XmlStreamDetector created its StAX XMLInputFactory with IS_SUPPORTING_EXTERNAL_ENTITIES=false but left SUPPORT_DTD at its default. For consistency with XmlConverter / StaxConverter (which disable DTDs) and as defence-in-depth against DTD-based attacks (e.g. entity-expansion DoS), set XMLInputFactory.SUPPORT_DTD=false. External entities were already blocked; the detector only pre-scans XML to determine the root element, so rejecting DTD-bearing input is safe. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
davsclaus
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #25279
Cherry-pick of #25279 onto
camel-4.14.x(clean, no conflicts).Original PR: #25279 — CAMEL-24299: disable DTD support in XmlStreamDetector for consistency with other XML parsers
Original author: @oscerd
Target branch:
camel-4.14.xWhat
XmlStreamDetectorcreated its StAXXMLInputFactorywithIS_SUPPORTING_EXTERNAL_ENTITIES=falsebut leftSUPPORT_DTDat its default. This addsfactory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE), for consistency withXmlConverter/StaxConverter, as defence-in-depth against DTD-based attacks (e.g. entity-expansion DoS). Non-breaking: Camel route XML does not use DTDs.Sanity build: full-reactor
mvn clean install -DskipTestsgreen oncamel-4.14.x;XmlStreamDetectorTest(7 tests incl. the DTD-rejection case) passes.