Skip to content

fix(files): prune dependency dirs in expandFileGlobs before fast-glob traversal - #410

Draft
dcramer wants to merge 4 commits into
mainfrom
fix/prune-vendor-dirs-in-glob-expansion
Draft

fix(files): prune dependency dirs in expandFileGlobs before fast-glob traversal#410
dcramer wants to merge 4 commits into
mainfrom
fix/prune-vendor-dirs-in-glob-expansion

fix(files): add MAX_GLOB_FILE_RESULTS guardrail and WardenGlobExpansi…

8c4d39e
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden completed Jun 16, 2026

2 issues

Low

getEffectivePrunePatterns drops wrong prune entry via unbounded substring match on directory name - `packages/warden/src/cli/files.test.ts:13`

In getEffectivePrunePatterns, the negation check neg.includes(${dirName}/) || neg.includes(/${dirName}) is an unbounded substring test, so a user negation whose directory name merely starts with a prune name removes the wrong prune entry. For example !src/output/** drops **/out/** (since /output contains /out), and !builder/** drops **/build/**, so that build/output tree is no longer pruned at traversal time and can be fully enumerated—reintroducing the memory pressure / WardenGlobExpansionError the prune list exists to prevent.

Also found at:

  • packages/warden/src/cli/files.test.ts:140-143
  • packages/warden/src/cli/files.ts:268
  • packages/warden/src/cli/files.ts:403
Glob expansion guard uses >= instead of >, rejecting exactly-at-limit projects against its own 'more than' contract - `packages/warden/src/cli/files.ts:29`

The guard files.length >= MAX_GLOB_FILE_RESULTS throws WardenGlobExpansionError when a project matches exactly 10,000 files, but the class docstring says it is thrown only when expansion returns "more than MAX_GLOB_FILE_RESULTS candidates" and the error message states "limit is 10,000". A legitimate project with exactly 10,000 source files is rejected with the self-contradictory message; use > to match the stated semantics.

2 skills analyzed
Skill Findings Duration Cost
security-review 0 5.5s $0.07
code-review 2 13m 39s $3.51

⏱ 13m 45s · 1.6M in / 114.5k out · $3.58