Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@pwddd
Copy link
Owner

@pwddd pwddd commented May 30, 2025

Potential fix for https://github.com/pwddd/java-sec-code/security/code-scanning/99

To fix the issue, we need to disable external entity expansion and XInclude processing in the DocumentBuilderFactory configuration. This ensures that the XML parser does not process external entities or include external resources, mitigating the risk of XXE attacks.

Steps to fix:

  1. Disable external entity expansion by setting the following features:
    • "http://apache.org/xml/features/disallow-doctype-decl" to true.
    • "http://xml.org/sax/features/external-general-entities" to false.
    • "http://xml.org/sax/features/external-parameter-entities" to false.
  2. Disable XInclude processing by setting setXIncludeAware(false) in the DocumentBuilderFactory.
  3. Ensure that the DocumentBuilderFactory is properly configured before creating the DocumentBuilder.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…entity in user-controlled data

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.