-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-18469: centralise XML parser creation in XMLUtils #4940
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like this
- the hdfs/yarn/mr changes need their own isolated changes and JIRAs for their branches
- we should add an enforcer rule to block all new use of DocumentBuilderFactory.newInstance();
@steveloughran I can rework this to just have the hadoop-common changes and can do other PRs to uptake this in yarn, hdfs, etc. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
core code looks good, some minor details related to javadocs, constants etc.
tests: see comments.
your IDE's import settings don't match what we like. i've tried to explain what's expected on new files. But: leave old files alone; it makes backporting a nightmare otherwise
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/XMLUtils.java
Show resolved
Hide resolved
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/XMLUtils.java
Show resolved
Hide resolved
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/cli/CLITestHelper.java
Show resolved
Hide resolved
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfServlet.java
Outdated
Show resolved
Hide resolved
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestXMLUtils.java
Outdated
Show resolved
Hide resolved
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestXMLUtils.java
Outdated
Show resolved
Hide resolved
hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/ParsedConfigFile.java
Show resolved
Hide resolved
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestXMLUtils.java
Outdated
Show resolved
Hide resolved
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/XMLUtils.java
Outdated
Show resolved
Hide resolved
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java
Show resolved
Hide resolved
undo hdfs and yarn changes remove mapreduce changes add tests secure transformer factory indent issue some review items
e62c468
to
b05445f
Compare
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
should those tests be removed, or simply modified to expect the different failure? what does happen now when something invalid is tried? an exception raised or simply the result ignored. (FWIW, this is why I prefer |
@steveloughran the transformer tests that I added and then removed - they do not fail. The transformer in the PR as is does not seem to stop DTD entities altogether (it does for DOM and SAX parsing). The transformers are not as widely used in the hadoop code base as DOM parsing and often the input is already parsed (via DOM or SAX parsing) before it is transformed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, happy with the explanation.
I'm +1 for the change. there is one suggestion, use AbstractHadoopTestBase, but its not a blocker for this patch. if you don't want to do that, say so and i will merge as is.
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestXMLUtils.java
Outdated
Show resolved
Hide resolved
🎊 +1 overall
This message was automatically generated. |
@steveloughran I fixed the formatting issue and the build passed |
merged to trunk; will see the build in 3.3. changed the title of the commit as (a) the centralisation hasn't taken place (b) didn't want to have to choose between us and non us spellings of centralise |
Add to XMLUtils a set of methods to create secure XML Parsers/transformers, locking down DTD, schema, XXE exposure. Use these wherever XML parsers are created. Contributed by PJ Fanning Change-Id: I15057a369c2f44b0a03e8660f934f38e34d2979e
Add to XMLUtils a set of methods to create secure XML Parsers/transformers, locking down DTD, schema, XXE exposure. Use these wherever XML parsers are created. Contributed by PJ Fanning
Add to XMLUtils a set of methods to create secure XML Parsers/transformers, locking down DTD, schema, XXE exposure. Use these wherever XML parsers are created. Contributed by PJ Fanning
Add to XMLUtils a set of methods to create secure XML Parsers/transformers, locking down DTD, schema, XXE exposure. Use these wherever XML parsers are created. Contributed by PJ Fanning
Due diligence followup to HADOOP-18469. Add secure XML parser factories to XMLUtils (#4940) Contributed by P J Fanning
Due diligence followup to HADOOP-18469. Add secure XML parser factories to XMLUtils (#4940) Contributed by P J Fanning
Due diligence followup to HADOOP-18469. Add secure XML parser factories to XMLUtils (#4940) Contributed by P J Fanning
Due diligence followup to HADOOP-18469. Add secure XML parser factories to XMLUtils (apache#4940) Contributed by P J Fanning
… + followups This change is a squash of below three patches from upstream: 1. HADOOP-18469. Add secure XML parser factories to XMLUtils (apache#4940) Add to XMLUtils a set of methods to create secure XML Parsers/transformers, locking down DTD, schema, XXE exposure. Use these wherever XML parsers are created. Contributed by PJ Fanning (cherry-picked from 8336b91) 2. HADOOP-18575. Make XML transformer factory more lenient (apache#5224) Due diligence followup to HADOOP-18469. Add secure XML parser factories to XMLUtils (apache#4940) Contributed by P J Fanning (cherry-picked from 6a07b5d) 3. HADOOP-18575: followup: try to avoid repeatedly hitting exceptions when transformer factories do not support attributes (apache#5253) Part of HADOOP-18469 and the hardening of XML/XSL parsers. Followup to the main HADOOP-18575 patch, to improve performance when working with xml/xsl engines which don't support the relevant attributes. Include this change when backporting. Contributed by PJ Fanning. (cherry-picked from d81d983) Change-Id: Ic519987c1f07d286fb3811b961a406bd280f039a
Description of PR
How was this patch tested?
For code changes:
LICENSE
,LICENSE-binary
,NOTICE-binary
files?