Repository navigation
fix(deps): drop fast-glob and gray-matter to clear the production audit - #41
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
npm audit --omit=devfails, so CI onmainhas been red since Oct 13. Neither advisory has a non-breaking upgrade:braces(high, GHSA-vfj7-8cjw-p6xm) comes in throughfast-globandmicromatch. No patched version exists.sprintf-js(moderate, GHSA-hp3w-g68c-fv3c) comes in throughgray-matter,js-yaml3 andargparse1. The only fix npm offers is downgradinggray-matterto 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 usesfs.readdirinstead offast-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 withjs-yaml4. 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 isargparse2). Removed:fast-globandgray-matter.Verification
npm run checkpasses (265 tests) on Node 24 and on the 22.12.0 floor.npm run auditreportsfound 0 vulnerabilities.tests/fs-and-frontmatter.test.tscovers 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 rejectedjs/jsonlanguages).gleanwork/agent-pluginswithmainand with this branch gives byte-identical output for every target (191 files).