Repository navigation
Conversation
📊 Automated PR Analysis
SummaryFixes handling of zsh's Review Checklist
Linked issues: #4918 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
3 tasks done
yungSNAT
added a commit
to yungSNAT/PascalsLetter
that referenced
this pull request
Nov 3, 2026
* fix(permissions): check the command after zsh's &! disown operator In zsh, 'git status &!git push' backgrounds and disowns the first command and then runs git push, but the permission split read the second segment as '!git push', so a deny or ask rule for git push did not match and the command was allowed. A ! glued to a background & now ends the operator, as zsh reads it; in bash, where '!git' names no command, this only adds a check. Same reading as rtk-ai#4968 for rtk-ai#4918. * fix(permissions): check both readings of a command after &! zsh runs the command after the `!` of `&!`; bash runs `!git` as a command name. Dropping the `!` (the previous commit) let a literal `!git:*` rule be skipped, so a segment that opens with a `!` glued to a background `&` is now checked both with and without it. Classification keeps one reading. Tests add the `!git:*` rule, a quoted command name, a zsh -c wrapper, a spaced, quoted or escaped `!` or `&`, and the wrapper policy.
3 tasks done
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4918
In zsh,
&!(and&|) is a single two-character operator that backgrounds and disowns the preceding pipeline without waiting for it, then continues executing the remainder of the command line.Previously:
rewrite_compoundtreated&as a standalone single-token boundary and restartedseg_startat the glued!, causingrewrite_segmentto prepend!to the rewritten trailing command and turninggit status &!git logintortk git status & ! rtk git log(which in zsh negates the second pipeline instead of disowning the first, or under&! git logleaves a bare!that prevents the trailing command from running).lexer::segmentsimilarly started the next segment at the glued!token, causingsplit_for_permissionsto return"!rm -rf /tmp/example"instead of"rm -rf /tmp/example"and hiding the trailing command from permission rules.This change detects when a boundary
&token is immediately followed by an adjacent!token (bang.offset == tok.offset + tok.value.len()) in bothlexer::segmentandregistry::rewrite_compound, steppingseg_startpast the!token while preserving&!verbatim in the rewritten output.Checklist
cargo fmt --check,cargo clippy --all-targets,cargo test)fix(scope): ...)developbranch (notmain)