Skip to content

fix(deps): drop fast-glob and gray-matter to clear the production audit - #41

Merged
steve-calvert-glean merged 1 commit into
mainfrom
fix/drop-vulnerable-deps
Oct 20, 2026
Merged

steve-calvert-glean merged 1 commit into
mainfrom
fix/drop-vulnerable-deps

Conversation

@steve-calvert-glean

Copy link
Copy Markdown
Contributor

Problem

npm audit --omit=dev fails, so CI on main has been red since Oct 13. Neither advisory has a non-breaking upgrade:

  • braces (high, GHSA-vfj7-8cjw-p6xm) comes in through fast-glob and micromatch. No patched version exists.
  • sprintf-js (moderate, GHSA-hp3w-g68c-fv3c) comes in through gray-matter, js-yaml 3 and argparse 1. The only fix npm offers is downgrading gray-matter to 2.0.1.

This blocks a clean 0.12.0 release.

Change

Each package had one use, so this PR replaces both:

  • walkFiles (src/fs.ts) now uses fs.readdir instead of fast-glob. Behavior is unchanged: dotfiles are included, symlinks are followed, broken links are skipped, and a missing directory yields no files. It also stops at a symlink that points back to a directory it is already walking.
  • parseMatter (src/targets/validation-shared.ts) now splits frontmatter itself, using gray-matter's delimiter rules, and parses it with js-yaml 4. Only YAML is accepted, so no JavaScript engine is left to disable. Frontmatter that isn't a mapping, such as a bare string, is now an error. Before, it passed validation silently.

New dependency: js-yaml ^4 (its only dependency is argparse 2). Removed: fast-glob and gray-matter.

Verification

  • npm run check passes (265 tests) on Node 24 and on the 22.12.0 floor.
  • npm run audit reports found 0 vulnerabilities.
  • tests/fs-and-frontmatter.test.ts covers the walker (dotfiles, file and directory symlinks, a loop, a broken link, a missing directory) and the frontmatter edge cases (BOM, CRLF, ---yaml, a missing closing line, comment-only blocks, and rejected js/json languages).
  • Building gleanwork/agent-plugins with main and with this branch gives byte-identical output for every target (191 files).

npm audit --omit=dev fails on main, so CI is red on every commit:

- braces (high, GHSA-vfj7-8cjw-p6xm) through fast-glob and micromatch,
  with no patched version;
- sprintf-js (moderate, GHSA-hp3w-g68c-fv3c) through gray-matter,
  js-yaml 3 and argparse 1, fixable only by a gray-matter downgrade.

Each package had one use, so both are replaced:

- walkFiles uses fs.readdir instead of fast-glob. It keeps the old
  behavior: dotfiles included, symlinks followed, broken links skipped,
  a missing directory yields no files. It also stops at a symlink back
  to a directory it is already walking.
- parseMatter splits frontmatter itself, with gray-matter's delimiter
  rules, and parses it with js-yaml 4, which is safe by default. Only
  YAML is accepted, so there is no JavaScript engine left to disable.
  Frontmatter that isn't a mapping is now an error.

Building gleanwork/agent-plugins gives byte-identical output for every
target (191 files) before and after.
@steve-calvert-glean steve-calvert-glean added the bug Something isn't working label Oct 20, 2026
@steve-calvert-glean
steve-calvert-glean marked this pull request as ready for review October 20, 2026 15:03
@steve-calvert-glean
steve-calvert-glean merged commit 9ca5066 into main Oct 20, 2026
4 checks passed
@steve-calvert-glean
steve-calvert-glean deleted the fix/drop-vulnerable-deps branch October 20, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant