Skip to content

fix(deps): remediate reachable archive-parsing advisories - #785

Closed
DeryFerd wants to merge 1 commit into
morluto:mainfrom
DeryFerd:fix/reachable-dependency-advisories
Closed

DeryFerd wants to merge 1 commit into
morluto:mainfrom
DeryFerd:fix/reachable-dependency-advisories

Conversation

@DeryFerd

@DeryFerd DeryFerd commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Two high-severity advisories in the dependency tree are reachable from the untrusted content REA analyzes, so a crafted target can drive the vulnerable code path. @xmldom/[email protected], pulled in through plist, parses XML plist bytes from an analyzed app bundle in the keyed-archive reader. [email protected], pulled in through @electron/asar → minimatch, is reached while analyzing an ASAR archive. This change refreshes both to their patched releases and leaves everything else untouched. Both are in-range patch updates, so no direct dependency declaration moves, no API changes, and no source file is edited.

Problem and expected behavior

The smallest trigger is analyzing an attacker-supplied target whose format exercises one of the two paths. An XML plist inside an analyzed bundle reaches plist's parse() at src/artifacts/KeyedArchiveReader.ts, which delegates to @xmldom/xmldom; an ASAR archive reaches @electron/asar, which delegates glob matching to minimatch and brace expansion to brace-expansion. In both cases the dependency is a transitive one, so the vulnerable version arrives without any direct declaration in package.json, and npm audit reports it at high severity.

The violated invariant is that REA's dependency surface should not contain known-vulnerable code on paths that untrusted target content can reach. The expected behavior is that the same inputs are still processed with the same results, but through patched dependency releases. This change produces exactly that: the two advisories are remediated and observable behavior is unchanged.

Change and scope

The change is confined to package-lock.json and moves two transitive packages to their patched releases: @xmldom/xmldom 0.9.10 → 0.9.12, and brace-expansion 5.0.7 → 5.0.12. Both targets sit inside the range each parent already declares (plist declares ^0.9.10, minimatch declares ^5.0.5), so this is a lockfile-only refresh and no parent or direct dependency changes its declared range. The diff is seven lines.

I deliberately did not include the third advisory in the tree. [email protected] is a direct dependency, but it parses the operator's own client-configuration file rather than untrusted target content, so it is outside the reachable-from-untrusted-input boundary this PR targets. Its fix also moves outside the declared range and changes behavior: 1.9.0 accepts a leading UTF-8 BOM where 1.7.0 rejects it, and an existing test intentionally locks the rejection, so bumping it is a separate decision with its own review. I also did not add a dependency-audit step to CI. A per-PR hard-fail audit gate would red-flag unrelated pull requests whenever a new advisory is published without any code change, which would disrupt the repository's normal contribution flow; that is a policy decision for the maintainer, not something to attach to this fix.

Intentionally not included: no source edits, no test edits, no direct dependency range changes, no CI changes, and no attempt to address the remaining advisory.

Contract and boundary impact

  • Semantic owner and earliest changed stage: dependency resolution (package-lock.json); no REA source stage changes.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none. The patched releases keep their public APIs, and [email protected] narrows its supported Node range to 20 || >=22, which REA already exceeds (its supported runtime is ^22.19 || ^24.11 || >=26).
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Process execution, authorization, cleanup, or containment impact: none.
  • Generated metadata (docs/product-catalog.json), package, or installation impact: none. The generated package metadata tracks the MCP SDK versions, not these packages, so npm run metadata:check stays green and no regeneration is required.

Evidence and regression coverage

  • Tests added or updated: none. This is a lockfile-only change with no source edit, so there is no new behavior to test; the existing suites that exercise the affected dependencies are the regression coverage and were run against the bumped lockfile.
  • Base reproduction or other evidence: npm audit on the affected base revision reports three high-severity advisories, two of which are @xmldom/xmldom and brace-expansion; after the change, npm audit reports only the smol-toml advisory that is intentionally out of scope.
  • User-visible CLI/MCP output (if applicable): not applicable.
  • Remaining proof gaps: I did not execute a real exploit against either advisory, so the claim is that the vulnerable code is reachable and the fix removes it, not that a specific exploit was demonstrated end to end. The remaining smol-toml advisory is left open by design and is noted above.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm ci — passed, lockfile installs consistently.
  • npm audit — three high advisories before, one after (only the intentionally excluded smol-toml).
  • npm ls @xmldom/xmldom brace-expansion — confirms the resolved versions are 0.9.12 and 5.0.12.
  • npx tsc --noEmit — passed, exit 0.
  • npm run build:cached — passed, one task successful.
  • npm run deps:check — passed.
  • npm run metadata:check — passed.
  • npx vitest run src/artifacts/KeyedArchiveReader.test.ts tests/boundary/filesystem/asarInventoryContainment.test.ts tests/boundary/filesystem/asarInventoryFreshness.test.ts tests/boundary/providers/native/keyedArchiveEncoding.test.ts tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts — 24 passed, 3 skipped (5 files), covering the keyed-archive and ASAR readers that use the bumped packages.

npm run docs:check currently fails on docs/verification/managed-conformance-manifest.json in this checkout. That failure reproduces on the unmodified base revision and is unrelated to this change, so it is not a regression from this PR.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: no real-provider claim. The affected readers are the artifact/keyed-archive and ASAR paths, exercised by the deterministic tests listed above.
  • Package or release metadata impact: none. No dependency range in package.json changes, so no release note or metadata regeneration is triggered.
  • Security, privacy, process, or containment review: this PR improves the dependency posture on two untrusted-input paths and changes no runtime control, authorization, or containment behavior. It removes known-vulnerable transitive code from paths reachable by analyzed targets.

Review checklist

  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above. There is no linked issue: the advisories are reported by the package manager, and this is a scoped remediation rather than a tracked feature or bug.
  • Tests cover changed observable behavior and meaningful failure paths. No behavior changed; the existing readers' suites cover the affected packages and were run.
  • Owning docs, contracts, and generated metadata are updated where needed. No generated artifact depends on these two packages, confirmed by a green metadata:check.
  • User-visible CLI/MCP changes include representative output. Not applicable.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

Two high-severity advisories are reachable from untrusted target content:

- @xmldom/xmldom 0.9.10 (via plist) parses XML plist bytes from analyzed
  app bundles in the keyed-archive reader. Refreshed to 0.9.12.
- brace-expansion 5.0.7 (via @electron/asar -> minimatch) is reached while
  analyzing untrusted ASAR archives. Refreshed to 5.0.12.

Both are in-range patch updates (plist declares ^0.9.10, minimatch declares
^5.0.5), so no source or API change is required and no direct dependency
declaration moves. Lockfile-only change.

The remaining smol-toml advisory is not included: it parses operator-owned
client configuration rather than untrusted target content, and its fix moves
outside the declared range and changes leading-BOM handling.
@morluto

morluto commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Superseded by #815, which integrated this change and has now merged (3af3811). Thanks @DeryFerd for remediating the reachable advisories — much appreciated!

@morluto morluto closed this Oct 7, 2026
@morluto morluto added the bug Something isn't working label Oct 14, 2026
@morluto morluto added the area: build Build, CI, packaging, and publishing label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build Build, CI, packaging, and publishing bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants