Skip to content

MLE-29978: Disable DTD processing when parsing server XML responses (CWE-827) - #1994

Draft
hmadala001 wants to merge 2 commits into
developfrom
fix/xxe-dtd-hardening
Draft

hmadala001 wants to merge 2 commits into
developfrom
fix/xxe-dtd-hardening

Conversation

@hmadala001

Copy link
Copy Markdown

No description provided.

Copilot AI balanced review requested due to automatic review settings November 23, 2026 03:34
@hmadala001 hmadala001 changed the title Disable DTD processing when parsing server XML responses (CWE-827) MLE-299781: Disable DTD processing when parsing server XML responses (CWE-827) Nov 23, 2026
@hmadala001 hmadala001 changed the title MLE-299781: Disable DTD processing when parsing server XML responses (CWE-827) MLE-29978: Disable DTD processing when parsing server XML responses (CWE-827) Nov 23, 2026
@hmadala001
hmadala001 marked this pull request as draft November 23, 2026 03:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Error-response parsing reuses a caller-configurable thread-local XML factory, so disabling namespace awareness can cause subsequent responses to lose their message, message code, and status text.

1 open issue
What changed in this PR

This PR hardens XML server-response parsing in the core Java client to address CWE-827 by reusing the existing secure XML factories.

Changes:

  • Route four JAXB response handles through stream readers with DTD and external-entity processing disabled.
  • Wrap stream-parser failures in MarkLogicIOException.
  • Use the hardened document-builder factory for XML error responses.
File Description
marklogic-client-api/​src/​main/​java/​com/​marklogic/​client/​io/​ValuesListHandle.java Harden values-list XML parsing.
marklogic-client-api/​src/​main/​java/​com/​marklogic/​client/​io/​ValuesHandle.java Harden values XML parsing.
marklogic-client-api/​src/​main/​java/​com/​marklogic/​client/​io/​TuplesHandle.java Harden tuple XML parsing.
marklogic-client-api/​src/​main/​java/​com/​marklogic/​client/​io/​QueryOptionsListHandle.java Harden query-options-list XML parsing.
marklogic-client-api/​src/​main/​java/​com/​marklogic/​client/​impl/​FailedRequest.java Use secure factory defaults for XML error responses.

Review effort: Balanced

DocumentBuilder builder;
try {
builder = factory.newDocumentBuilder();
builder = XmlFactories.getDocumentBuilderFactory().newDocumentBuilder();
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