Skip to content

fix(deps): update @xmldom/xmldom to ^0.9.10 for spec-compliant DOM#116

Open
esetnik wants to merge 1 commit intoauth0:masterfrom
esetnik:fix/xmldom-0.9-compat
Open

fix(deps): update @xmldom/xmldom to ^0.9.10 for spec-compliant DOM#116
esetnik wants to merge 1 commit intoauth0:masterfrom
esetnik:fix/xmldom-0.9-compat

Conversation

@esetnik
Copy link
Copy Markdown

@esetnik esetnik commented May 8, 2026

Summary

Bumps @xmldom/xmldom from ^0.7.4 to ^0.9.10 and adapts the call sites to its spec-compliant API. Tests still pass (105 / 5 pending — same as baseline).

Closes #115. (Also addresses the goal of #101 — bumping out of the 0.7.x CVE floor — but goes the whole way to current latest rather than stopping at 0.8 LTS.)

Why now

  • @xmldom/xmldom@<0.8.12 has a known XML-injection vulnerability (GHSA-wh4c-j3r5-mjhp, CVE-2026-34601). Snyk and Dependabot flag this for every consumer of saml@4.0.0. Most downstream projects work around it with package-manager overrides.
  • npm's latest dist-tag for @xmldom/xmldom is now 0.9.10. When downstream overrides are open-ended (>=0.8.12 etc.), a fresh resolution promotes through to 0.9.x and breaks saml at runtime — see #115.
  • The pre-existing Snyk PR [Snyk] Upgrade @xmldom/xmldom from 0.7.13 to 0.8.10 #101 (0.7.130.8.10) has been open and unmerged for ~2 years. This PR supersedes it and goes one major further so we don't have to revisit when 0.10 ships.

What changed

@xmldom/xmldom@0.9.0 made two intentional, spec-aligning changes that touch this library:

1. DOMParser.parseFromString() requires a mimeType

Old behavior: parseFromString(xml) parsed as XML by default.
New behavior: throws TypeError: ... mimeType "undefined" is not valid when called without a mimeType.

Fixed in 26 call sites by passing 'text/xml':

  • lib/saml11.js:221 (1 site, production)
  • lib/utils.js:72 (1 site, production)
  • test/saml11.tests.js (4 sites)
  • test/saml20.tests.js (6 sites)
  • test/utils.js (14 sites)

2. Element.getAttribute() returns null for missing attributes

Old behavior: returned '' (non-spec).
New behavior: returns null, matching the DOM Living Standard.

The only test that depended on the old behavior — saml 2.0 #create / should not set NameFormat in attributes when includeAttributeNameFormat is false (test/saml20.tests.js:316) — has been updated to expect null. (The corresponding #createUnsignedAssertion run shares the same it block, so both pass with the single change.)

No production code depended on the old behavior.

Test plan

```
$ npm install
$ npm test
...
105 passing (261ms)
5 pending
```

Same counts as on master before the bump.

Notes for reviewers

  • I am not a regular contributor to this repo — opened this PR after a downstream project (ProdigyEMS/prodigy) hit the 0.9.x compat break via Renovate's lockFileMaintenance. Happy to iterate if there's a preferred shape (e.g. capping at ^0.8.0 LTS instead of jumping to ^0.9.10, or splitting the dep bump from the test fix).
  • Did not touch xml-crypto (^2.1.3) or xml-encryption (^4.0.0) — both have newer majors but those are separate concerns.
  • No CHANGELOG.md exists; if the project uses semantic-release (semantic-release is in devDeps), the conventional-commit subject should drive the changelog automatically.

[Written by Claude]

@xmldom/xmldom 0.9.0 introduced two intentional spec-compliance changes
that affect this library:

1. DOMParser.parseFromString() now requires a mimeType argument and
   throws when undefined (lib/utils.js:72, lib/saml11.js:221).
2. Element.getAttribute() now returns null (not '') for missing
   attributes, matching the DOM Living Standard.

Changes:

- Bump dependency range from ^0.7.4 to ^0.9.10. The previous range
  had a known XML-injection CVE (GHSA-wh4c-j3r5-mjhp /
  CVE-2026-34601); downstream consumers have had to apply
  package-manager overrides to dodge it (and have hit the 0.9.x break
  when the override floor went open-ended).
- Pass 'text/xml' to all parseFromString() call sites in lib/ and
  test/ (26 sites).
- Update assertions in the saml20 'includeAttributeNameFormat: false'
  test to expect null instead of '' for the now-missing NameFormat
  attribute.

All 105 tests still pass; 5 pending unchanged.

Refs auth0#115
@esetnik esetnik requested a review from a team as a code owner May 8, 2026 20:47
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.

Incompatibility with @xmldom/xmldom 0.9.x: DOMParser.parseFromString throws on undefined mimeType

1 participant