Skip to content

Fix js-yaml merge-key DoS (GHSA-h67p-54hq-rp68)#2

Merged
johncarmack1984 merged 1 commit into
mainfrom
fix/js-yaml-merge-key-dos
Jun 17, 2026
Merged

Fix js-yaml merge-key DoS (GHSA-h67p-54hq-rp68)#2
johncarmack1984 merged 1 commit into
mainfrom
fix/js-yaml-merge-key-dos

Conversation

@johncarmack1984

Copy link
Copy Markdown
Owner

What

Closes the open Dependabot alert (#1): js-yaml quadratic-complexity DoS in merge-key handling via repeated aliases — GHSA-h67p-54hq-rp68, medium, vulnerable <= 4.1.1, patched 4.2.0.

Root cause

The vulnerable js-yaml@3.14.2 was pulled in transitively by the changesets release toolchain:

read-yaml-file@1.1.0 → @manypkg/get-packages@1.1.3 → @changesets/*

read-yaml-file@1.1.0 pins js-yaml@^3 and calls yaml.safeLoad(), an API removed in js-yaml 4.x — so a plain js-yaml: ^4.2.0 override would break it at runtime. There is no patched 3.x release; the fix only exists in 4.2.0.

Fix

Add a pnpm overrides block:

  • read-yaml-file: ^2.1.0 — the 2.x line depends on js-yaml@^4.0.0 and uses the renamed load() API. Its public surface (default callable export + .sync) is identical to 1.x, so @manypkg/get-packages keeps working unchanged.
  • js-yaml: ^4.2.0 — pins the patched release explicitly.

read-yaml-file@1.1.0 was the only consumer of js-yaml 3.x, so 3.14.2 is removed from the tree entirely — only js-yaml@4.2.0 resolves now.

This is a dev-only dependency (changesets, used at release time). It is never part of the published package, which ships dist/ only.

Verification

  • pnpm why js-yaml → only 4.2.0 remains; js-yaml@3.14.2 gone.
  • pnpm run check (biome + tsc + vitest) → all pass (14/14 tests).
  • pnpm run build → bundle unchanged (library never depended on js-yaml).
  • pnpm changeset status → reads the package graph through the new read-yaml-file@2.1.0 path successfully.

…-rp68)

The changesets dev toolchain pulled js-yaml 3.14.2 transitively through
read-yaml-file@1.1.0 (the only consumer of the 3.x line), which is in the
advisory's vulnerable range (<= 4.1.1).

Add pnpm overrides: read-yaml-file ^2.1.0 (uses js-yaml ^4.x and the
load() API, API-compatible with @manypkg/get-packages) plus js-yaml ^4.2.0
to pin the patched release. Only js-yaml 4.2.0 now resolves; build, check,
and changeset status all pass. Dev-only dependency — never shipped in dist/.
@johncarmack1984 johncarmack1984 merged commit 1a31d26 into main Jun 17, 2026
4 checks passed
@johncarmack1984 johncarmack1984 deleted the fix/js-yaml-merge-key-dos branch June 17, 2026 22:04
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.

1 participant