Skip to content

fix(deps): lift read-yaml-file to 2.x to clear js-yaml CVE-2026-53550 (#3221) - #3889

Merged
cixzhang merged 1 commit into
meta:mainfrom
AKnassa:fix/3221-js-yaml-cve
Jul 25, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
AKnassa:fix/3221-js-yaml-cve

Conversation

@AKnassa

@AKnassa AKnassa commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Closes #3221.

The problem

@changesets/cli → @manypkg/get-packages → read-yaml-file still resolves js-yaml 3.15.0, below the 4.2.0 that patches CVE-2026-53550.

The override added in #3607 fixed a different js-yaml advisory and deliberately held this chain on the 3.x line (read-yaml-file>js-yaml: ^3.15.0). That was the right call at the time: read-yaml-file 1.x calls safeLoad, which js-yaml 4.x renamed to load, so overriding js-yaml alone throws TypeError: yaml.safeLoad is not a function. The pin is exactly what this issue needs removed.

The fix: lift the package, don't patch it

read-yaml-file 2.x calls load and depends on js-yaml ^4 — so the pin becomes unnecessary rather than needing a workaround.

This deliberately avoids the pnpm patch route the issue proposed. That would introduce patchedDependencies + a patches/ dir the repo doesn't use, affecting every install and the release pipeline — a toolchain policy call. Overriding is the mechanism this repo already uses, and #3607's own rationale ("keep each consumer on an API-compatible major line") reads as a preference against patching.

Two details worth flagging for review:

  • read-yaml-file 2.x is a drop-in. Its only consumer is @manypkg/get-packages, and 2.x keeps the same CJS surface — default export, .default, and .sync.
  • The js-yaml floor is ^4.2.0, not >=4.2.0. The looser range resolves to js-yaml 5.x, outside the ^4 range read-yaml-file 2.x declares. I hit this while testing.

Dependency delta

No package.json changes, no new direct dependency. Four packages leave, three arrive — the tree gets one smaller:

package
removed [email protected] (the vulnerable one), [email protected], [email protected], [email protected]
added [email protected] (patched), [email protected], [email protected]

The chain is dev-side (release tooling) — nothing here ships in @astryxdesign/core's runtime dependencies.

Test plan

  • No js-yaml < 4.2.0 anywhere in the tree. node_modules/js-yaml is now 4.3.0 (was 3.15.0); @changesets/parse's nested copy stays 5.2.0. Both above the patch floor.
  • read-yaml-file works at runtime — .sync() parses pnpm-workspace.yaml correctly, with js-yaml 4.3.0 underneath. typeof default === 'function', typeof .sync === 'function'.
  • changesets works end-to-end — changeset status exits 0 and correctly lists the packages to be bumped; changeset version --snapshot completes. This is the code path that actually consumes read-yaml-file, so it's the check that matters.
  • pnpm exec vitest run — 336 files, 6298 tests, all passing.
  • pnpm check:repo — all five gates pass.

No changeset: this changes no published package's code, matching #3607, which shipped none for the same class of change.

…meta#3221)

`@changesets/cli` -> `@manypkg/get-packages` -> `read-yaml-file` was still
resolving js-yaml 3.15.0, below the 4.2.0 that patches CVE-2026-53550. The
override added in meta#3607 fixed a different js-yaml advisory and deliberately
held this chain on the 3.x line, because read-yaml-file 1.x calls `safeLoad`,
which 4.x renamed to `load` — so overriding js-yaml alone throws
`TypeError: yaml.safeLoad is not a function`.

Lift the package rather than patch it. read-yaml-file 2.x calls `load` and
depends on js-yaml ^4, so the pin is no longer needed. Its only consumer is
@manypkg/get-packages, and 2.x keeps the same CJS surface (default export,
`.default`, and `.sync`), so nothing at the call site changes. This also avoids
introducing `pnpm patch` machinery — which the issue proposed, but which the
repo does not use and which would touch every install and the release pipeline.

The js-yaml floor is `^4.2.0`, not `>=4.2.0`: the looser range resolves to
js-yaml 5.x, outside the `^4` range read-yaml-file 2.x declares.

Net effect on the tree: js-yaml 3.15.0, read-yaml-file 1.1.0, argparse 1.0.10
and sprintf-js 1.0.3 leave; js-yaml 4.3.0, read-yaml-file 2.1.0 and
strip-bom 4.0.0 arrive. No package.json changes, no new direct dependency, and
the chain is dev-side (release tooling) — nothing ships in core's runtime deps.

Claude-Session: https://claude.ai/code/session_01VYm8FsvUjk3xwDmonZRYeE
@vercel

vercel Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 12, 2026 10:44pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 12, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Jul 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.6KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | View full report

@AKnassa
AKnassa marked this pull request as ready for review July 13, 2026 01:18

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Legitimate security fix. @changesets/cli → @manypkg/get-packages → [email protected] pins [email protected], which is below the 4.2.0 that patches CVE-2026-53550 (algorithmic-complexity DoS in merge-key << processing). Overriding js-yaml alone breaks read-yaml-file 1.x (4.x renamed safeLoad→load), so lifting read-yaml-file to 2.x — which calls load and depends on js-yaml ^4 — is the correct remediation. Dev-toolchain/lockfile only, CI green. LGTM.

@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Jul 25, 2026
@cixzhang
cixzhang merged commit 4789437 into meta:main Jul 25, 2026
23 checks passed
@github-actions
github-actions Bot deleted the fix/3221-js-yaml-cve branch July 25, 2026 08:03
cixzhang pushed a commit that referenced this pull request Jul 28, 2026
next pulls sharp as an optional dependency for image optimization and
resolves 0.34.5, which inherits four libvips advisories: CVE-2026-33327,
CVE-2026-33328, CVE-2026-35590 and CVE-2026-35591.

They are patched in sharp 0.35.0, a semver-major bump on the 0.x line, so
next's own `^0.34` range can never reach it — hence an override rather than a
lockfile refresh. Both next entries in the tree (15.5.20 and
16.3.0-preview.5) resolve through it, and the platform packages move with
it: `@img/sharp-libvips-*` goes 1.2.4 to 1.3.2, which is where the actual
fix lives.

sharp is already in `allowBuilds`, so the native postinstall is unchanged.
0.35.3 published 2026-07-01, well clear of the repo's 7-day
`minimumReleaseAge`.

The override is temporary by construction — the comment says to drop it once
next depends on 0.35 itself.

Verified beyond the lockfile, since the concern with this bump is the native
binary and next's image pipeline rather than the resolution:
  - sharp 0.35.3 loads and reports libvips 8.18.3
  - it round-trips a real encode (create -> .png() -> Buffer)
  - `pnpm build` (core, lab, charts, vega, 7 themes) succeeds
  - `pnpm -F @astryxdesign/docsite build` succeeds — a full next build with
    prerendering, which is where image optimization would surface
  - `pnpm test`: 384 files, 7871 tests, all pass

No changeset: this touches no published package's source, matching #3889 and
#4398, which were both lockfile + pnpm-workspace.yaml only.

Fixes #4400

This branch was successfully deployed

1 active deployment
Preview — fc9c4e21 Deployed Jul 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deps: js-yaml 3.x -> 4.x major bump needed (CVE-2026-53550)

2 participants