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

Disable XML External Entities #2603

Merged
merged 1 commit into from
Feb 5, 2024
Merged

Conversation

Pr0methean
Copy link
Contributor

@Pr0methean Pr0methean commented Feb 5, 2024

If an untrusted XML file is passed to one of the Xml class's public methods (unlikely but certainly possible), XML External Entity injection attacks are possible. This PR fixes that by disabling all known features that would cause the DocumentBuilderFactory or TransformerFactory to load external entities and doctypes. It also uses ThreadLocal::withInitial to fix failing cases of UnusedCodeTest; note that this doesn't work for InheritableThreadLocal because that class has no equivalent method.

References

Submitter checklist

  • Recommended: Join WireMock Slack to get any help in #help-contributing or a project-specific channel like #wiremock-java
  • The PR request is well described and justified, including the body and the references
  • The PR title represents the desired changelog entry
  • The repository's code style is followed (see the contributing guide)
  • Test coverage that demonstrates that the change works as expected
  • For new features, there's necessary documentation in this pull request or in a subsequent PR to wiremock.org

@Pr0methean Pr0methean requested a review from a team as a code owner February 5, 2024 20:14
@tomakehurst tomakehurst merged commit e966d3d into wiremock:master Feb 5, 2024
7 checks passed
@tomakehurst
Copy link
Member

Thanks!

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.

None yet

2 participants