Repository navigation
Add defense-in-depth XML secure processing to SAXSource and StAXSource paths - #2915
Merged
Muskan Gupta (muskan124947) merged 6 commits intoMar 24, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds defense-in-depth XML secure-processing configuration when returning SAXSource and StAXSource from SQLServerSQLXML, aligning these code paths more closely with the existing hardening in getDOMSource().
Changes:
- Configure
SAXParserFactorywith secure-processing and DOCTYPE-disallow features forSAXSource. - Configure
XMLInputFactoryto disable external entities and DTD support forStAXSource.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2915 +/- ##
============================================
- Coverage 60.61% 60.59% -0.03%
+ Complexity 4911 4910 -1
============================================
Files 151 151
Lines 35000 35016 +16
Branches 5854 5854
============================================
+ Hits 21216 21218 +2
- Misses 10939 10952 +13
- Partials 2845 2846 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Mahendra Chavan (machavan)
approved these changes
Mar 23, 2026
Divang Sharma (divang)
approved these changes
Mar 23, 2026
Ananya Garg (Ananya2)
approved these changes
Mar 23, 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.
The getDOMSource() method in SQLServerSQLXML.java already sets
FEATURE_SECURE_PROCESSING and uses a custom EntityResolver. This change
applies equivalent protections to getSAXSource() and getStAXSource() for
consistency:
SQL Server's xml data type rejects DTDs at the storage layer, so these
are defense-in-depth safeguards to ensure all three parser paths are
uniformly hardened.