Skip to content

Treat bash >& file redirects as file mutations in auto mode - #905

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-7633-treat-bash-file-redirects-as-file-mutations-in-auto-mode
Sep 11, 2026
Merged

Treat bash >& file redirects as file mutations in auto mode#905
TheGreatAxios merged 1 commit into
mainfrom
cl-7633-treat-bash-file-redirects-as-file-mutations-in-auto-mode

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Auto-mode shell policy now classifies >& path and n>& path (non-fd, non-/dev-sink targets) as file-mutation deny, same as > / >>. fd-dups (2>&1) still skip the rule.

Verification: classify-security + auto-shell-policy suites 108 pass; lint + build pass; typecheck/full-suite gaps pre-existing and environmental (vendor semver, git-env timeouts).

Fixes CL-7633

Bash combined redirects write a file the same way a plain redirect
does. The matcher skipped every form that started with >& so it
would not flag fd dups, and those writes auto-allowed. Classify >&
to a non-fd, non-safe-sink path as a file mutation and leave fd
dups unmatched.
@linear-code

linear-code Bot commented Sep 11, 2026

Copy link
Copy Markdown

CL-7633

@TheGreatAxios TheGreatAxios changed the title CL-7633: Treat bash >& file redirects as file mutations in auto mode Treat bash >& file redirects as file mutations in auto mode Sep 11, 2026

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to merge. The new >& word matcher treats bash combined redirects as file mutations while leaving 2>&1 / n>&- and safe /dev/* sinks unmatched — same shape as the existing > / >> rule. Regression cases cover spaced and unspaced forms plus the fd-dup non-deny. CI is green.

@TheGreatAxios
TheGreatAxios merged commit e57b944 into main Sep 11, 2026
9 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-7633-treat-bash-file-redirects-as-file-mutations-in-auto-mode branch September 11, 2026 05:10
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