Skip to content

fix(guard): stop false shell refusals, allow .env templates (2.157.2) - #223

Merged
drknowhow merged 3 commits into
mainfrom
fix/shell-scan-false-denials
Oct 16, 2026
Merged

drknowhow merged 3 commits into
mainfrom
fix/shell-scan-false-denials

Conversation

@drknowhow

@drknowhow drknowhow commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

The Bash hook treated the path-spelling checks (<ads>, <unc>, <empty-component>, <8.3-alias>) as final, and c3_shell refused any token matching a deny glob whether or not a file existed, so origin/main:$f, taskkill //F, // comments, ... and \.env in a grep regex were hard refusals. A spelling hit is now re-judged as the file it could reach, c3_shell refuses only existing denied files (cwd plus cd targets, unquoted globs expanded), and both scans judge quoted strings whole, which closes a gap where a quoted path with spaces to a protected file passed the hook. Replaying 1,200 logged refusals from the last 80 days: 1,074 still refused on main, 134 on this branch, and the 134 are real reads of .env and key files plus one docker //tmp path. Second commit: .env templates ending in .example, .sample, .template or .dist are no longer covered by the **/.env* builtin (21 refusals in the same window); a template holding a real value becomes readable unless a user rule denies it. Known limit: |, ; and & inside quotes still split tokens. Locally: full suite 4919 passed / 8 skipped on Windows, ruff clean; the new or changed tests fail on main.

https://claude.ai/code/session_01XyQBQ8ZNaNYDuhwQEnLsG2

…(2.157.2)

The Bash hook treated path-spelling checks as final, and c3_shell refused
any token matching a deny glob, so revspecs, //F switches, // comments and
regex text were hard refusals. Spelling hits are now judged as the file they
could reach, c3_shell refuses only existing denied files, and both scans
judge quoted paths whole, which also catches quoted paths with spaces.
Risk: quoted |;& still split tokens. Replay of 1,200 logged refusals: 1,074
refused on main, 134 here; full suite 4916 passed, ruff clean.

Claude-Session: https://claude.ai/code/session_01XyQBQ8ZNaNYDuhwQEnLsG2
@groyep

groyep Bot commented Oct 16, 2026

Copy link
Copy Markdown

Gro could not finish this review.

The builtin denied reading and editing .env.example and similar committed
templates, which list variable names only. A leaf ending in .example,
.sample, .template or .dist is no longer covered, in every builtin mode.
Risk: a template that does hold a real value becomes readable; a user deny
rule still covers it. Suite 4919 passed, ruff clean.

Claude-Session: https://claude.ai/code/session_01XyQBQ8ZNaNYDuhwQEnLsG2
@drknowhow drknowhow changed the title fix(guard): shell scans refuse only commands naming a protected file (2.157.2) fix(guard): stop false shell refusals, allow .env templates (2.157.2) Oct 16, 2026
@drknowhow
drknowhow merged commit 931cb4d into main Oct 16, 2026
12 checks passed
@drknowhow
drknowhow deleted the fix/shell-scan-false-denials branch October 16, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant