Skip to content

security: drop phantom glob dependency from the production closure, release as 0.1.2 - #157

Merged
LanNguyenSi merged 3 commits into
masterfrom
security/remove-phantom-glob-dependency
Jul 27, 2026
Merged

security: drop phantom glob dependency from the production closure, release as 0.1.2#157
LanNguyenSi merged 3 commits into
masterfrom
security/remove-phantom-glob-dependency

Conversation

@LanNguyenSi

Copy link
Copy Markdown
Owner

domain-router and readme-first-resolver both declared glob ^10.3.0 under
dependencies but never imported it. Because both are published, that pulled
glob, minimatch and brace-expansion@2.1.2 into every consumer's
production closure, exposing them to
GHSA-mh99-v99m-4gvg (HIGH,
range <=5.0.7) on npm audit --omit=dev.

Closes task ca2aceff.

What changed

  • glob removed from both packages.
  • A second phantom, js-yaml, removed from readme-first-resolver only.
    domain-router genuinely uses it and is untouched.
  • Both packages bumped to 0.1.2, because 0.1.1 is already tagged and
    published and npm forbids republishing a version. Without the bump this fix
    would have reached no consumer at all.

What this does NOT do

The local npm audit count stays at 20 high. Those advisories come from the
dev-side babel-plugin-istanbultest-exclude chain, which is untouched
here and tracked separately. What changes is the production closure, i.e.
what a downstream consumer sees with --omit=dev. Anyone expecting this PR to
green the Audit check will be surprised; that is expected, not a failure.

Verification

Independently reproduced by the reviewer, not carried over from the
implementer:

  • Production closure recomputed from the dependency graph, discarding all dev
    flags: 186 packages on master → 153 here, with glob, minimatch and
    brace-expansion absent and zero flag disagreements in either direction.
    js-yaml correctly remains in the closure for domain-router and
    debug-playbook-engine.
  • npm audit --omit=dev: 3 high on master → 0 high here. Plain npm audit:
    20 high on both, identical advisory set.
  • Lockfile inventory diff: 0 entries added, 0 removed, only the two workspace
    version fields changed. No version/resolved/integrity drift.
  • npm install --package-lock-only is a byte-identical no-op.
  • Non-usage verified against dynamic load paths too, not just an import grep:
    no variable- or template-argument require/import(), no createRequire,
    module._load, eval or new Function, across src and dist.
  • Build green; all four jest packages green (12 suites / 155 tests).

Not re-run: the 66 vitest files, because no vitest package's manifest changed
on this branch and other agents were using the machine.

Open action after merge

The goal is met on publish, not on merge. Until domain-router-v0.1.2 and
readme-first-resolver-v0.1.2 are pushed and publish-libs.yml completes,
consumers still resolve the vulnerable closure. Verified that 0.1.2 is free on
the registry for both packages and no such tag exists yet.

Follow-ups filed

  • a5cd84a0 — a check-deps guard so the phantom-dependency class cannot
    recur. Two phantoms in one manifest is a pattern, not an accident.
  • eefeb6a9 — 304 of 603 lockfile entries carry neither resolved nor
    integrity, so npm ci cannot verify half the tree. Pre-existing.

domain-router and readme-first-resolver both declared glob ^10.3.0 under
dependencies, but neither package imports it, statically or dynamically.
Because both are published with private:false, that pulled glob, minimatch
and brace-expansion into the production closure with dev=false, exposing
consumers running `npm audit --omit=dev` to GHSA-mh99-v99m-4gvg via
brace-expansion 2.1.2.

Removing the declaration takes all three out of the production closure.
Verified: zero lockfile entries for glob, minimatch or brace-expansion
carry dev=false afterwards.

This does not change the local `npm audit` count. Those packages remain in
the report through the dev-side path babel-plugin-istanbul -> test-exclude,
untouched here. What changes is what a downstream consumer sees with
--omit=dev.

Refs: ca2aceff-069c-4568-b0e9-6676cb2f0d0a
…ntom dep

Review found that removing the dependency does not reach a single consumer.
Both packages sit at 0.1.1, that version is already tagged and published,
publishing is tag-driven and hard-fails on a version/tag mismatch, and npm
forbids republishing an existing version. The registry therefore still serves
0.1.1 declaring glob ^10.3.0, so the vulnerable closure stayed exactly as
reachable as before.

Bumps both packages to 0.1.2 with a CHANGELOG entry citing the advisory.

The same review also found an identical phantom one line above the removed
one: readme-first-resolver declared js-yaml without ever importing it. Its
full import set is fs, path, commander, chalk and its own lib, with os and
child_process in tests only. Removed there, together with the @types
counterpart. domain-router genuinely uses js-yaml and is untouched.

Refs: ca2aceff-069c-4568-b0e9-6676cb2f0d0a
…e from security

Both entries said the package is "published with private: false", but neither
manifest has a private field at all. The statement was semantically right and
grep-hostile: someone checking the manifest finds nothing. Now points at what
is actually there, an absent private and publishConfig.access public.

readme-first-resolver filed both removals under Security, but only glob
carried an advisory. js-yaml has none here and was removed as hygiene, so
inflating the Security section overstates the exposure. Split into its own
Removed entry that says so.

Refs: ca2aceff-069c-4568-b0e9-6676cb2f0d0a
@LanNguyenSi LanNguyenSi added review:tests-pass merge-approval prereq review:checklist-complete merge-approval prereq review:comments-resolved merge-approval prereq review:scope-matches-task merge-approval prereq review:evidence-logged merge-approval prereq labels Jul 27, 2026
@LanNguyenSi
LanNguyenSi merged commit ed7eff8 into master Jul 27, 2026
4 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:checklist-complete merge-approval prereq review:comments-resolved merge-approval prereq review:evidence-logged merge-approval prereq review:scope-matches-task merge-approval prereq review:tests-pass merge-approval prereq

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant