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

External Entities restricted in XML factory. #180

Merged
merged 1 commit into from
Dec 7, 2021
Merged

Conversation

bparmar-splunk
Copy link
Contributor

@bparmar-splunk bparmar-splunk commented Dec 1, 2021

Update:

  • By default, document builder factory xml parsers allows expansion of external entities. So to prevent attackers to forge malicious content using external entities, these features are added.

Copy link
Contributor

@fantavlik fantavlik left a comment

Choose a reason for hiding this comment

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

Can you provide more context in the PR, instead of describing what was changed it would be useful to know why a change is needed and what the affect will be before and after. This is all useful in the PR itself - assume no one has access to our internal JIRA.

factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
factory.setExpandEntityReferences(false);
factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
factory.setNamespaceAware(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Also let's use https if possible here once I understand the intent of the change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using https in feature URLs are not available when tests are executed. So all http URLs are correct.

Copy link
Contributor

@fantavlik fantavlik left a comment

Choose a reason for hiding this comment

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

Again, thanks for the explanations 🚀

@bparmar-splunk bparmar-splunk merged commit b10bc8d into develop Dec 7, 2021
@bparmar-splunk bparmar-splunk deleted the DVPL-7631 branch December 15, 2021 07:08
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