GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — disable external entities in ParsingValidator instance parsing by jmestwa-coder · Pull Request #332 · xmlunit/xmlunit

Conversation

@jmestwa-coder

@jmestwa-coder jmestwa-coder commented Jun 5, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

ParsingValidator.validateInstance parses the instance document with a validating SAX parser that resolves external entities, so a DOCTYPE in the instance can read local files or hit URLs through SYSTEM entities. The schema/DTD to validate against is resolved separately via the Handler, the instance never needs its own external entities.

Per the discussion this keeps the 2.6.0 default unchanged and adds an opt-in instead of changing behavior for everyone:

  • new setDisableExternalEntities(boolean) on ParsingValidator, default false so existing behavior is unchanged
  • when enabled, turns off external-general-entities and external-parameter-entities on the factory before the parser is created; DTD and schema validation are unaffected
  • stronger security note in the class javadoc plus a package-level warning in package-info.java covering both validators
  • test flips the flag on

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jmestwa-coder
disable external entities in ParsingValidator instance parsing
f88db76
@jmestwa-coder

jmestwa-coder commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

any update?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bodewig

bodewig commented Jun 20, 2026

Copy link
Copy Markdown
Member

see the comments in #331 - this is the same case in that I explicitly decided to leave the defaults insecure back then.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jmestwa-coder

jmestwa-coder commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

makes sense, I hadn't clocked that this was a documented decision back in 2.6, so I won't push to change the default. happy to close this one, or rework it into an opt-in setting / configurer like you described on #331 if that's useful. whichever you prefer.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bodewig

bodewig commented Jun 20, 2026

Copy link
Copy Markdown
Member

I hadn't clocked that this was a documented decision back in 2.6,

Don't worry, it has been hidden well enough.

I believe an opt-in and a more explicit warning in the javadocs may be fine. Together with #331 maybe the warnung should be at the package level.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jmestwa-coder
make external entity blocking opt-in via setDisableExternalEntities
d6c1e76
keep the 2.6.0 default of resolving external entities, add an opt-in
setter and document the XXE risk at the package and class level
@jmestwa-coder

jmestwa-coder commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

reworked this the same way as #331: default stays as-is, added an opt-in setDisableExternalEntities(boolean) that only flips off the external-general/parameter-entity features when set. put the security warning at the package level in package-info.java so it covers both validators, with a short pointer on each class. test flips the flag on now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bodewig

bodewig commented Jun 20, 2026

Copy link
Copy Markdown
Member

many thanks

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bodewig
bodewig merged commit 9e4f6cd into xmlunit:main Jun 20, 2026
bodewig added a commit that referenced this pull request Jun 20, 2026
@bodewig
Merge pull request #334 from xmlunit/add-release-notes
f0a6fe6
add release notes for #331 #332 #333 by @jmestwa-coder
pull Bot pushed a commit to boost-mw-poc/xmlunit_xmlunit that referenced this pull request Jun 20, 2026
@bodewig
add release notes for xmlunit#331 xmlunit#332 xmlunit#333 by @jmestwa…
4765a05
…-coder
@bodewig bodewig added this to the 2.13.0 milestone Jul 31, 2026
@uchiha-bug-hunter uchiha-bug-hunter mentioned this pull request Oct 14, 2026
make XMLUnit.setEnableXXEProtection cover the legacy validators #346
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

2.13.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@jmestwa-coder @bodewig
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.