#21733: security(exec): platform-aware allowlist matching and restricted safe-bin trust
docs
size: S
Cluster:
Windows Path and Exec Fixes
## Summary
- Allowlist glob matching follows host filesystem case semantics: case-insensitive
on Windows and macOS (where the default filesystem is case-insensitive),
case-sensitive on Linux (ext4/btrfs/etc. are case-sensitive). Previously it was
always case-insensitive on all platforms, which meant a differently-cased path
could bypass an allowlist entry on Linux.
- Safe-bin trusted directories now default to hardcoded system paths only
(/bin, /usr/bin, /usr/local/bin, /opt/homebrew/bin, /opt/local/bin, /snap/bin,
/run/current-system/sw/bin). PATH entries are no longer implicitly trusted.
Callers can opt in with `includePathEnv: true` if needed. This prevents a
manipulated PATH from getting arbitrary binaries auto-approved as safe bins.
## Test plan
- [x] Existing allowlist matching tests pass (72 tests)
- [x] New test: mismatched-case pattern rejected on Linux, accepted on Windows/macOS
- [x] Existing safe-bin trust tests updated for new default (5 tests)
- [x] New test: PATH entries excluded by default, included only with opt-in
- [ ] Verify on Linux that a differently-cased allowlist pattern correctly fails to match
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR implements two critical security improvements to exec approval logic:
**Platform-aware allowlist matching**: Allowlist glob patterns now follow filesystem case semantics - case-insensitive on Windows/macOS (matching their default case-insensitive filesystems) and case-sensitive on Linux (matching ext4/btrfs behavior). This prevents attackers from bypassing allowlist entries on Linux by using differently-cased paths.
**Restricted safe-bin trust**: Safe-bin trusted directories now default to hardcoded system paths only (`/bin`, `/usr/bin`, `/usr/local/bin`, `/opt/homebrew/bin`, `/opt/local/bin`, `/snap/bin`, `/run/current-system/sw/bin`). PATH entries are excluded by default to prevent PATH manipulation attacks. Callers can opt in with `includePathEnv: true` when needed.
Both changes close real security vulnerabilities:
- The case-sensitivity issue allowed bypass on Linux systems
- The PATH trust issue allowed attackers to manipulate PATH to get arbitrary binaries approved as safe bins
Test coverage includes platform-conditional tests for case sensitivity and explicit tests for the new PATH exclusion behavior.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with high confidence - it strengthens security without breaking functionality
- This PR fixes legitimate security vulnerabilities with careful implementation. The changes are well-tested (73+ tests pass), backward-compatible (existing functionality preserved via opt-in flag), and focused on hardening security. The case-sensitivity fix prevents allowlist bypass on Linux, and the PATH restriction prevents manipulation attacks. All test updates properly reflect the new secure-by-default behavior.
- No files require special attention
<sub>Last reviewed commit: 5799945</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#10708: fix: handle Windows PATH case-sensitivity in exec environment
by Yida-Dev · 2026-02-06
79.9%
#22910: fix(browser): resolve symlinks in upload path validation
by erdinccurebal · 2026-02-21
78.4%
#18924: fix(security): tighten permissions on cron/, browser/, settings/ dirs…
by rexlunae · 2026-02-17
78.4%
#15615: fix(security): restrict PATH override to exact match in node-host s...
by AI-Reviewer-QS · 2026-02-13
78.2%
#19931: Config: merge PATH env vars and bootstrap Windows bins
by Kemalau · 2026-02-18
77.8%
#8633: fix: support wildcard patterns (* and **) in exec allowlist
by dbottme · 2026-02-04
77.6%
#10714: fix: handle Windows PATH case-sensitivity in node register invoke
by Yida-Dev · 2026-02-06
77.2%
#11048: fix: address repository issues (env, author, CI comments, security ...
by cavula · 2026-02-07
77.2%
#7507: test(ci): make tests cross-platform (Windows) + add basic sanitizat...
by ThinkIbrokeIt · 2026-02-02
76.8%
#23574: security: P0 critical remediation — plugin sandbox, password hashin...
by lumeleopard001 · 2026-02-22
76.5%