Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set transformer factory attributes to improve protection against XXE #3837

Merged
merged 1 commit into from
Mar 23, 2023

Conversation

pjfanning
Copy link
Member

@pjfanning pjfanning commented Mar 21, 2023

https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html recommends these attributes.

Wrapped the setAttribute because some old implementations of the JAXP interfaces are liable to throw exceptions when you set attributes that they don't recognise.

Relates to #3387 - which has a new comment today

@cowtowncoder
Copy link
Member

@pjfanning Quick question: was there no "isSupported()" method for checking support for config properties? (I think some APIs have those, others not, probably not here).
Also: is there a link to something mentioning that these are needed in addition to secure-processing flag? Just to add to comment or whatever.

I'm ok with the PR itself, just wondering. Will have another look today, merge when I have more time.

@pjfanning
Copy link
Member Author

I've ended up with putting this sort of change on numerous libs. The docs about what to do are contradictory. That owasp page is regarded as the best source and the scanning tools seem to use it as their guide. I do not know of any other way to set those attributes than adding a catch. If you don't someone running in an old Application Server will hit an exception and log an issue.

@cowtowncoder cowtowncoder merged commit dc717e9 into FasterXML:2.15 Mar 23, 2023
@cowtowncoder cowtowncoder changed the title set transformer factory attributes to improve protection against XXE Set transformer factory attributes to improve protection against XXE Mar 23, 2023
cowtowncoder added a commit that referenced this pull request Mar 23, 2023
@cowtowncoder cowtowncoder added this to the 2.14.3 milestone Mar 23, 2023
@cowtowncoder
Copy link
Member

Merged to 2.14 branch as well just in case.

@pjfanning pjfanning deleted the transformer-attributes branch April 5, 2023 10:31
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.

2 participants