C++: Fixes some typos and increases the XXE query precision. #9142
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.
Fixes some typos and increases the XXE query precision to
@high
.The latter is justified by results on 207 LGTM projects: https://lgtm.com/query/5698038244523748150/
libxml2
and fail to follow the advice in https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.htmlSAX2XMLReader
(XMLReaderFactory::createXMLReader
) interface and fails to setfgXercesDisableDefaultEntityResolution
.SAX2XMLReader
andcreateLSParser
. In all cases results are failing to setfgXercesDisableDefaultEntityResolution
, though note that forcreateLSParser
the need to do this is inferred rather than directly stated by the OWASP doc.There's also an all-LGTM run linked from the internal issue. 26 projects with results, I've checked at least one result from each project and found no surprises.
pwsafe/pwsafe
setspSAX2Parser->setFeature(XMLUni::fgXercesLoadExternalDTD, false);
, which is interesting, at a glance I'm a little surprised the OWASP guidelines don't require doing this. I've added this to my list of extensions to potentially look into.It is of course possible there are other safety mechanisms that the OWASP doc doesn't describe and we are unaware of - I do not claim to be an expert in either library. Aside from that limitation I have confidence in this query.