Skip to content

bash permissions: deny rules catch capitalised program names on macOS - #1695

Open
aft-alfonso[bot] wants to merge 7 commits into
mainfrom
fix/bash-case-fold-macos
Open

aft-alfonso[bot] wants to merge 7 commits into
mainfrom
fix/bash-case-fold-macos

Conversation

@aft-alfonso

@aft-alfonso aft-alfonso Bot commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

macOS (and Windows) find programs whatever the letter case, so Git push --force runs git, but OpenCode matches rule patterns case-sensitively, so a deny rule git push* didn't apply.

  • The scanner hands the host the line with the program's basename in lower case first, then the original spelling, on macOS and Windows. A deny written for either spelling still applies. Linux is unchanged.
  • xargs and the synthetic-load guard's launchers are recognised under any letter case on those platforms.
  • The bridge's refusal attribution matches case-insensitively on darwin too, so the message names the rule the host applied.

An allow rule that names only one spelling can now ask once for a mixed-case command.

Found by an internal security review of the bash permission scanner. Red-first tests in Rust and TypeScript (platform injected). Linux bash-permission tests and the Windows lib check pass.


Summary by cubic

Fixes the bash permission scanner so deny rules catch mixed-case program names on macOS and Windows, where filesystems are case-insensitive but rule matching was case-sensitive.

  • The host gets the executable's basename in lowercase before the original spelling on macOS and Windows; Linux is unchanged.
  • xargs and synthetic-load guard launchers are recognized under any ASCII letter case, and launcher options are read under the folded name so Caffeinate -i yes no longer slips past.
  • Non-ASCII program names are unreadable on macOS and Windows since their spellings can run a different program; readable commands on the same line keep their own asks, so deny rules still apply to them.
  • File commands get outside-the-project asks under any ASCII letter case.
  • Bridge refusal attribution mirrors the host again: case-insensitive only on Windows, since the scanner already sends a lowercase variant on macOS.
  • Allow rules that name only one spelling can now ask once for a mixed-case command.

Found by an internal security review of the bash permission scanner; covered by red-first Rust and TypeScript tests with platform injection. The Windows memory-cap test now waits 30 s for capped processes to exit and reports job membership if one survives.

Written for commit 1df9ffe. Summary will update on new commits.

View guided diff Turn on auto-fix

Confidence Score: 5/5RetriggerView in Greptile

The PR appears safe to merge; no actionable new issues remain.

Summary

The PR checks lowercase and original executable spellings on macOS and Windows so mixed-case names match deny rules.

  • Bash permission checks match mixed-case program names on macOS and Windows.
  • The load guard recognizes mixed-case launchers on macOS and Windows.
  • Refusal messages follow the host’s command-matching rules.
  • Review support gives Windows cleanup tests more time and adds a benchmark slice.

All three earlier findings remain fixed. No new actionable issues were found in the latest change.

Reviews (5) · Last reviewed commit: "test: Windows memory-cap test waits 30 s..." · Reviewed by Greptile

ualtinok and others added 3 commits December 6, 2026 17:39
Pin both deny-rule spellings, basename-only normalization, and launcher recognition with injected case behavior; the new macOS cases are red until the matching change.

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
Offer the host the ASCII-folded executable basename and the original resource so both lowercase and exact-spelling denies still work. Apply the same case policy to recognized launchers and to bridge denial attribution without changing refusal wording or Linux matching.

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
… slice descriptor

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
ualtinok and others added 2 commits December 6, 2026 17:55
…tion as the host matches

The synthetic-load guard read a mixed-case launcher's options under its
original spelling, so `Caffeinate -i yes` slipped past. Options are now
read under the folded name, with the exact word kept to tell Bash's `time`
keyword from an external time.

The bridge's refusal attribution mirrors the host again: case-insensitive
only on Windows. The scanner already sends the lower-case program-name
variant as its own part, so attribution needs no wider matching.

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
… Windows

Both match file names with Unicode case folding, so `ſh -c ...` runs sh
and a Kelvin-sign `maKe` runs make. The program such a name runs can't be
told from its spelling, so the line is unreadable there. File commands
(`Touch`, `RM`) also get their outside-the-project asks under any ASCII
letter case.

Found by an internal review of the bash permission scanner.

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
ualtinok and others added 2 commits December 6, 2026 18:39
…eping the others

Replacing every ask with one unreadable `*` ask hid the line's readable
commands from deny rules: `git push --force; é` asked instead of being
denied. Readable commands now keep their asks beside the unreadable one.

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
On a hosted Windows runner (run 47680427371, shard 8) the job-object kill
had ended the task, but one descendant was still running 5 s later.
Process teardown on a loaded runner can take that long, so the positive
wait is now 30 s. A process that really escaped the job still fails, now
with its job membership in the message, which tells the two apart.

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
@ualtinok
ualtinok force-pushed the fix/bash-case-fold-macos branch from 3effb25 to 1df9ffe Compare December 6, 2026 18:06
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