Skip to content

Raise fast-xml-parser entity expansion limit for large JUnit reports - #3

Merged
fdmarc merged 2 commits into
mainfrom
claude/zeus-error-ci791i
Aug 8, 2026
Merged

Raise fast-xml-parser entity expansion limit for large JUnit reports#3
fdmarc merged 2 commits into
mainfrom
claude/zeus-error-ci791i

Conversation

@fdmarc

@fdmarc fdmarc commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • fast-xml-parser v4.5+ ships a security limit that caps total XML entity expansions (e.g. &, <) per document at 1000. JUnit reports with long failure messages/stack traces can legitimately exceed that, which was causing Failed to parse ...xml: Entity expansion limit exceeded: 1001 > 1000 in this action.
  • Configured processEntities.maxTotalExpansions: 100000 on the XMLParser instance in src/main.ts so legitimate reports parse successfully, while still keeping the entity-expansion protection enabled (just with a higher, safe ceiling).
  • Rebuilt dist/index.js via pnpm build since this is a compiled action.

Test plan

  • Added a regression test (src/main.test.ts) that parses a JUnit XML fixture containing 1200 & entities and asserts it parses successfully (previously this would throw).
  • pnpm check (format check, typecheck, full test suite, build) passes locally.

Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • JUnit XML reports containing more than 1,000 XML entities can now be parsed successfully.
    • Increased the supported entity expansion limit to 100,000, preventing valid large reports from failing during parsing.
  • Tests

    • Added regression coverage for large JUnit XML reports, including verification of failed test case results.

fast-xml-parser's default entity-expansion protection caps total XML
entity expansions at 1000, which some real JUnit reports with long
failure messages exceed, causing "Entity expansion limit exceeded"
parse failures. Configure processEntities.maxTotalExpansions to a much
higher bound.
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0bbe5144-d2d6-4186-9fd5-1d09bc33734e

📥 Commits

Reviewing files that changed from the base of the PR and between 187d3cf and 8157eb6.

📒 Files selected for processing (1)
  • pnpm-workspace.yaml

Walkthrough

The XML parser now permits up to 100,000 entity expansions. A regression test confirms that a JUnit report with 1,200 entities parses successfully and produces one failed test case. Workspace build permissions were added for @biomejs/biome and esbuild.

Changes

Entity Expansion Parsing

Layer / File(s) Summary
Parser limit and regression coverage
src/main.ts, src/main.test.ts, pnpm-workspace.yaml
fast-xml-parser now allows up to 100,000 entity expansions. The regression test validates a 1,200-entity JUnit report and one failed test case. The workspace permits build scripts for @biomejs/biome and esbuild.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a rabbit with ears held high,
XML entities now parse as they fly.
Twelve hundred pass the test,
One failed case marks the rest.
The parser limit grows nearby!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: increasing the fast-xml-parser entity expansion limit for large JUnit reports.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/zeus-error-ci791i

Comment @coderabbitai help to get the list of available commands.

Without this, pnpm install skips their postinstall scripts (needed to
fetch the native binaries) and prints an ERR_PNPM_IGNORED_BUILDS warning.
@fdmarc
fdmarc marked this pull request as ready for review August 8, 2026 12:04
@fdmarc
fdmarc merged commit 26a5b7a into main Aug 8, 2026
7 of 8 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main.test.ts (1)

51-63: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Add an upper-bound regression case.

This test proves that input above the old default is accepted. It does not prove that maxTotalExpansions: 100_000 still rejects larger input. Add a case with more than 100,000 & references and assert that parseJunitXml rejects it.

Suggested boundary test
+test("parseJunitXml: enforces the entity expansion limit", () => {
+	const entities = "&".repeat(100_001);
+	const xml = `<testsuite><testcase><failure>${entities}</failure></testcase></testsuite>`;
+	assert.throws(() => parseJunitXml(xml));
+});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main.test.ts` around lines 51 - 63, Add a regression test alongside the
existing parseJunitXml entity test using more than 100,000 “&amp;” references,
and assert that parseJunitXml rejects the input. Keep the current successful
1,200-entity case unchanged and target the parser’s maxTotalExpansions boundary.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main.ts`:
- Around line 51-55: Upgrade the fast-xml-parser dependency to version 5.5.6 or
later in package.json, regenerate pnpm-lock.yaml, and rebuild dist/index.js so
the configured maxTotalExpansions limit also applies to numeric character
references and standard XML entities.

---

Nitpick comments:
In `@src/main.test.ts`:
- Around line 51-63: Add a regression test alongside the existing parseJunitXml
entity test using more than 100,000 “&amp;” references, and assert that
parseJunitXml rejects the input. Keep the current successful 1,200-entity case
unchanged and target the parser’s maxTotalExpansions boundary.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f1d021b2-5484-4082-bc88-b800a0869b9a

📥 Commits

Reviewing files that changed from the base of the PR and between b4be0c7 and 187d3cf.

⛔ Files ignored due to path filters (1)
  • dist/index.js is excluded by !**/dist/**
📒 Files selected for processing (2)
  • src/main.test.ts
  • src/main.ts

Comment thread src/main.ts
Comment on lines +51 to +55
// JUnit reports with long failure messages can legitimately contain more
// than fast-xml-parser's default 1000-entity expansion cap.
processEntities: {
maxTotalExpansions: 100_000,
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

rg -n --glob 'package.json' --glob 'package-lock.json' \
  --glob 'npm-shrinkwrap.json' --glob 'yarn.lock' \
  --glob 'pnpm-lock.yaml' 'fast-xml-parser' . || true

npm ls fast-xml-parser --all || true

Repository: flipdishbytes/github-actions-junit-summary

Length of output: 757


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- package.json ---'
sed -n '1,80p' package.json

printf '%s\n' '--- lockfile references ---'
sed -n '1,35p' pnpm-lock.yaml
sed -n '435,460p' pnpm-lock.yaml
sed -n '815,840p' pnpm-lock.yaml

printf '%s\n' '--- source context ---'
sed -n '35,70p' src/main.ts

printf '%s\n' '--- repository references ---'
rg -n 'fast-xml-parser|maxTotalExpansions|processEntities' --glob '!pnpm-lock.yaml' .

Repository: flipdishbytes/github-actions-junit-summary

Length of output: 9587


🌐 Web query:

fast-xml-parser 4.5.6 maxTotalExpansions processEntities GHSA-8gc5-j5rx-235r patched version

💡 Result:

The security vulnerability GHSA-8gc5-j5rx-235r, tracked as CVE-2026-33036, involves a bypass of entity expansion limits (such as maxTotalExpansions and maxExpandedLength) in the fast-xml-parser library [1][2]. This vulnerability allows numeric character references (e.g., &#NNN;, &#xHH;) and standard XML entities to evade security limits that were intended to prevent Denial of Service (DoS) attacks [1][3]. The affected versions are >= 4.0.0-beta.3 and <= 5.5.5 [4][1]. The vulnerability has been addressed and patched in version 5.5.6 [1][5]. Users are advised to update their fast-xml-parser package to version 5.5.6 or later to mitigate this issue [5].

Citations:


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- bundled option normalisation ---'
sed -n '26015,26048p' dist/index.js

printf '%s\n' '--- bundled expansion-limit checks ---'
sed -n '26882,26942p' dist/index.js

printf '%s\n' '--- official advisory ---'
curl -fsSL \
  https://api.github.com/repos/NaturalIntelligence/fast-xml-parser/security-advisories/GHSA-8gc5-j5rx-235r \
  | jq '{ghsa_id, cve_id, summary, severity, vulnerable_versions, patched_versions}'

printf '%s\n' '--- v5.5.6 package metadata ---'
curl -fsSL https://registry.npmjs.org/fast-xml-parser/5.5.6 \
  | jq '{version, engines, dist: {tarball, shasum}}'

Repository: flipdishbytes/github-actions-junit-summary

Length of output: 4249


🌐 Web query:

site:github.com/NaturalIntelligence/fast-xml-parser/security/advisories/GHSA-8gc5-j5rx-235r fast-xml-parser 5.5.6

💡 Result:

Fast-xml-parser version 5.5.6 is a patched release designed to address vulnerabilities related to XML entity expansion, specifically CVE-2026-26278 [1]. While a prior fix introduced entity expansion limits (such as maxTotalExpansions and maxEntityCount) for DOCTYPE-defined entities, it was discovered that numeric character references and standard XML entities bypassed these security controls [1]. Version 5.5.6 was issued to address this incomplete fix by extending the enforcement of entity expansion limits to these additional code paths [1]. Users are advised to ensure they are using this version or later to mitigate potential denial-of-service risks associated with XML entity expansion [1].

Citations:


🏁 Script executed:

#!/usr/bin/env bash
set -u

printf '%s\n' '--- npm registry 5.5.6 metadata ---'
curl -fsSL https://registry.npmjs.org/fast-xml-parser/5.5.6 \
  | jq '{version, engines, dist: {tarball, shasum}}' || true

printf '%s\n' '--- advisory page metadata ---'
curl -LfsS -A 'Mozilla/5.0' \
  https://github.com/NaturalIntelligence/fast-xml-parser/security/advisories/GHSA-8gc5-j5rx-235r \
  | rg -o 'CVE-[0-9]{4}-[0-9]+|5\.5\.[0-9]+|severity[^<]{0,80}|vulnerable[^<]{0,120}|patched[^<]{0,120}' \
  | head -40 || true

printf '%s\n' '--- v5.5.6 source references ---'
for path in src/xmlparser/OptionsBuilder.js src/xmlparser/OrderedObjParser.js; do
  printf '%s\n' "--- ${path} ---"
  curl -LfsS https://raw.githubusercontent.com/NaturalIntelligence/fast-xml-parser/v5.5.6/${path} \
    | rg -n 'maxTotalExpansions|maxExpandedLength|maxEntityCount|processEntities|charRef|numeric|entity' \
    | head -80 || true
done

Repository: flipdishbytes/github-actions-junit-summary

Length of output: 3946


🌐 Web query:

"GHSA-8gc5-j5rx-235r" "5.5.6" severity fast-xml-parser

💡 Result:

The security advisory GHSA-8gc5-j5rx-235r, also identified as CVE-2026-33036, is a high-severity vulnerability (CVSS score 7.5) affecting the fast-xml-parser library [1][2][3]. The vulnerability involves a bypass of XML entity expansion limits. While a previous fix (for CVE-2026-26278) introduced limits to prevent Denial of Service (DoS) attacks via XML entity expansion, these protections only applied to DOCTYPE-defined entities [4][5][3]. The vulnerability exists because numeric character references (such as &#NNN; and &#xHH;) and standard XML entities are processed via a separate code path in the replaceEntitiesValue function that lacks these expansion limits [4][5]. An attacker can exploit this by providing specially crafted XML containing a large volume of these entity references, causing excessive memory allocation and CPU consumption, which can lead to a process crash even if developers have configured strict security limits [5][3]. The issue was addressed and fixed in fast-xml-parser version 5.5.6 [5][3]. Users of affected versions (4.0.0-beta.3 through 5.5.5) are advised to upgrade to 5.5.6 to mitigate the risk [6][5][3].

Citations:


Upgrade fast-xml-parser to 5.5.6 or later.

Version 4.5.6 enforces maxTotalExpansions for declared entities, but numeric character references and standard XML entities can bypass this limit. Update package.json and pnpm-lock.yaml, then rebuild dist/index.js.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main.ts` around lines 51 - 55, Upgrade the fast-xml-parser dependency to
version 5.5.6 or later in package.json, regenerate pnpm-lock.yaml, and rebuild
dist/index.js so the configured maxTotalExpansions limit also applies to numeric
character references and standard XML entities.

Source: MCP tools

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