Thanks to visit codestin.com
Credit goes to github.com

Skip to content

NIFI-5779 Added Validate DTD property to TransformXml to allow for skipping DTD validation.#10950

Open
dan-s1 wants to merge 3 commits intoapache:mainfrom
dan-s1:NIFI-5779
Open

NIFI-5779 Added Validate DTD property to TransformXml to allow for skipping DTD validation.#10950
dan-s1 wants to merge 3 commits intoapache:mainfrom
dan-s1:NIFI-5779

Conversation

@dan-s1
Copy link
Contributor

@dan-s1 dan-s1 commented Mar 2, 2026

Summary

NIFI-5779
I discovered the solution to be able to skip DTD validation by implementing a custom org.xml.sax.EntityResolver on the following Saxon thread and the actual key value to use when calling setAttribute on an instance of javax.xml.transform.TransformerFactory on the following Saxon page. The VALIDATE_DTD property added to TransformXML was copied as is from EvaluateXQuery.

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000
  • Pull request contains commits signed with a registered key indicating Verified status

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

Copy link
Contributor

@exceptionfactory exceptionfactory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for proposing this change @dan-s1. However, given the age of the associated Jira issue, and the potential for introducing security vulnerabilities with a different configuration, I don't think this new property should be introduced.

@dan-s1
Copy link
Contributor Author

dan-s1 commented Mar 2, 2026

@exceptionfactory Aren't the vulnerabilities associated more with what value one picks for the SECURE_PROCESSING property?

@exceptionfactory
Copy link
Contributor

@exceptionfactory Aren't the vulnerabilities associated more with what value one picks for the SECURE_PROCESSING property?

There are different classes of vulnerabilities. Secure Processing covers them in general, but allowing DTD resolution is a more narrow type of potential issue. Although it is possible to scope down the issues, it is still a potential attack vector. Given that fact, introducing a new property without an overriding use cases is less than optimal from a maintenance perspective.

@dan-s1
Copy link
Contributor Author

dan-s1 commented Mar 2, 2026

So perhaps instead of introducing the VALIDATE_DTD property, could we assume to always not to resolve DTD's thereby avoiding the FileNotFoundException as reported in the ticket? In other words we should always call the following

factory.setAttribute("http://saxon.sf.net/feature/entityResolverClass", IgnoreDoctypeEntityResolver.class.getCanonicalName());

@exceptionfactory
Copy link
Contributor

The Secure Processing property came years after this ticket was created, and blocks DTD resolution, so the issue could be closed, noting that DTD resolution is not supported with Secure Processing enabled.

@dan-s1
Copy link
Contributor Author

dan-s1 commented Mar 2, 2026

@exceptionfactory I do not understand, even though I had Secure Processing set to true in the TransformXML processor, the exception reported in the ticket still occurs as I noted on the ticket last week and demonstrated in the unit test I added. Doesn't that indicate DTD resolution still occurs?

@exceptionfactory
Copy link
Contributor

Thanks for clarifying @dan-s1, most of the Secure Processing handling focuses on the XSLT Source. Let me take a closer look at the options and follow up.

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