You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hop.apache.org by "mattcasters (via GitHub)" <gi...@apache.org> on 2025/10/09 11:32:19 UTC

[I] [Task]: Harden the pipeline and workflow XML parser (hop)

mattcasters opened a new issue, #5804:
URL: https://github.com/apache/hop/issues/5804

   ### What needs to happen?
   
   For security reasons we should harden the Hop metadata XML parser here:
    https://github.com/apache/hop/blob/ce9fb7cab1d6b4269cb23796b826760a1a75c7cc/core/src/main/java/org/apache/hop/core/xml/XmlParserFactoryProducer.java#L45
   
   To be more precise, we should disable DTD processing in this parser factory.
   
   
   ### Issue Priority
   
   Priority: 1
   
   ### Issue Component
   
   Component: API


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Task]: Harden the pipeline and workflow XML parser (hop)

Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters commented on issue #5804:
URL: https://github.com/apache/hop/issues/5804#issuecomment-3385495769

   Measures: https://semgrep.dev/docs/cheat-sheets/java-xxe#2b-security-measures


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Task]: Harden the pipeline and workflow XML parser (hop)

Posted by "hansva (via GitHub)" <gi...@apache.org>.
hansva closed issue #5804: [Task]: Harden the pipeline and workflow XML parser
URL: https://github.com/apache/hop/issues/5804


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Task]: Harden the pipeline and workflow XML parser (hop)

Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters commented on issue #5804:
URL: https://github.com/apache/hop/issues/5804#issuecomment-3396362881

   The 3 failing tests are in `XmlHandlerUnitTest`:
   
   *  `loadingXmlFromStreamThrowsExceptionWhenParsingXmlWithBigAmountOfExternalEntities()` 
   * `createdDocumentBuilderThrowsExceptionWhenParsingXmlWithABigAmountOfExternalEntities()`
   * `loadingXmlFromURLThrowsExceptionWhenParsingXmlWithBigAmountOfExternalEntities()`
   
   These were supposed to throw an error if some particularly bad XML was loaded.  Now, with everything disabled they just load a document and don't even attempt to do anything with the XML content.  In some way, I guess that's even better.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Task]: Harden the pipeline and workflow XML parser (hop)

Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters commented on issue #5804:
URL: https://github.com/apache/hop/issues/5804#issuecomment-3396317155

   I tried to disable everything, but now there are failing tests and broken plugins.
   I'll try to figure out which features are needed and will re-enable those only when needed explicitly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Task]: Harden the pipeline and workflow XML parser (hop)

Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters commented on issue #5804:
URL: https://github.com/apache/hop/issues/5804#issuecomment-3478226847

   PR: https://github.com/apache/hop/pull/5937


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Task]: Harden the pipeline and workflow XML parser (hop)

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on issue #5804:
URL: https://github.com/apache/hop/issues/5804#issuecomment-3385653944

   @mattcasters these settings are more important
   
   ```
   import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.ParserConfigurationException; // catching unsupported features
   import javax.xml.XMLConstants;
   
   ...
   
   DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
   
   String[] featuresToDisable = {
       // Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-general-entities
       // Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-general-entities
       // JDK7+ - http://xml.org/sax/features/external-general-entities
       //This feature has to be used together with the following one, otherwise it will not protect you from XXE for sure
       "http://xml.org/sax/features/external-general-entities",
   
       // Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-parameter-entities
       // Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-parameter-entities
       // JDK7+ - http://xml.org/sax/features/external-parameter-entities
       //This feature has to be used together with the previous one, otherwise it will not protect you from XXE for sure
       "http://xml.org/sax/features/external-parameter-entities",
   
       // Disable external DTDs as well
       "http://apache.org/xml/features/nonvalidating/load-external-dtd"
   }
   
   for (String feature : featuresToDisable) {
       try {    
           dbf.setFeature(FEATURE, false); 
       } catch (ParserConfigurationException e) {
           // This should catch a failed setFeature feature
           logger.info("ParserConfigurationException was thrown. The feature '" + feature
           + "' is probably not supported by your XML processor.");
           ...
       }
   }
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org