Skip to content

fix(security): a plain git grep pathspec glob is data, not a self-kill spelling - #34097

Closed
chenmingwei23 wants to merge 2 commits into
mainfrom
guard-g/gitgrep-pathspec-data
Closed

chenmingwei23 wants to merge 2 commits into
mainfrom
guard-g/gitgrep-pathspec-data

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: a read-only git grep whose pathspec glob sits next to a product-named path is no longer refused as a self-kill, and no new way to run a program opens.

git grep x -- '*'; ls /w/kirocrew searches files, then lists a directory. The self-kill argv floor reads the bare * operand, glued to ;, as a word that could expand to a kill program, and refuses the whole command. git grep operands are patterns and pathspecs that git never runs.

Why it matters

Agents search with git grep and pathspecs all the time. A false self-kill denial stops the turn and teaches the agent to avoid a correct, read-only command.

Not a goal

  • No change to how any pager form is judged. -O<cmd>, --open-files-in-pager=<cmd>, a -c core.pager=... or --paginate global option, a GIT_PAGER=... word, or an expansion all keep exactly their current verdict.
  • No new refusal kind, no flag, no version bump.

What changed (motivation → approach → change)

  • _argv_programs labels the operands of a plain git grep frame as the data consumer git grep, which joins _DATA_CONSUMER_PROGRAMS. The exemption fails closed: it is withheld from every frame unless the whole command line is unambiguous.
  • No pager anywhere. If any token could open a pager (-O<cmd>, --open-files-in-pager=<cmd>, a clustered -nO, or an expansion), no frame is exempted. A quoted ; de-quotes to a token identical to a real ;, so the floor cannot tell a separator from data; scanning every token (never stopping at a separator) is what closes that. git grep -e '*' -e <name> -e ';' -O'<cmd>' -- f is refused with the quoted ; exactly as without it.
  • No environment word. A GIT_PAGER= or an inline PATH= word in any frame withholds the exemption.
  • First statement, bare literal git only. The exemption applies only to a git grep that is the FIRST statement on the line, with its program word exactly git (not /tmp/git or ./git) and grep immediately after it. A literal git word does not prove git runs the operands: a function, an alias, a PATH change, a hash -p entry or any other earlier statement can reshadow it. Rather than enumerate those vectors, the exemption fails closed on what the token stream can prove -- that nothing ran before this command. A git grep that is not the first statement keeps its normal (un-exempted) verdict.
  • Linear cost. Each check is one forward pass. Locally the pager check runs 8056, 16056 and 32056 times for 1000, 2000 and 4000 operands, about 8 times per word, because the gate normalises a command a few times over.
  • The security package line budget rises by 88 lines.

Backwards compatibility

This narrows one false refusal. Every command refused before is still refused, apart from plain git grep operands. Nothing that was allowed becomes refused.

Tests

test/test_argv_floor_git_grep_pathspec.py, with every attack string assembled from parts:

  • Stays refused: the quoted-; pager bypass in its glued spellings, plus --paginate with a later kill.
  • Quoted separator (reviewer bypass 1): a git grep that opens a pager running a kill is refused with the same verdict with or without a quoted standalone ;. A quoted ; must not change the answer.
  • First statement only (reviewer bypasses 2 and 3): a git() function, a function git, a PATH= prefix, a hash -p entry, a command git prefix, a &&-chained second statement, and the /tmp/git and ./git path forms are each refused. Only a git grep that is the first statement with the bare literal git is exempted.
  • Now allowed: the false positive in its glued forms.
  • Linear time: a 4000-operand command, checked by counting pager-check calls (at most 16 per operand), not by a wall-clock bound, so the test is deterministic.
  • Strict xfail: five pager forms the floor does not refuse before this change either (-O after the pathspec, a clustered -nO, -c core.pager, GIT_PAGER, an array expansion). This change does not touch them; closing them is Self-kill argv floor does not refuse five git grep pager forms #34098.

Red first: the test commit (a6fe17df7, tests only) fails without the fix (the false-positive cases are refused on base). Each bypass was checked against origin/main: it refuses the quoted-; pager command and every shadowing form (function, alias, PATH, hash -p, command, &&-chained, /tmp/git, ./git), so this change only restores that, it does not widen it. Green: added after the fix commit's (f60af2ab4) run.

Manual verification

Each case was judged directly with the security module at three points: origin/main, the buggy first fix, and this fix. On origin/main the false positives are refused and every bypass is refused. The buggy first fix allowed the quoted-; pager command and the git-redefinition forms (the two reviewer findings). This fix refuses every bypass again and allows the false positives, matching origin/main on every bypass.

Screenshots / video

N/A: no user-visible UI change.

Pattern harvest

Pattern: a data operand treated as a possible program because the scanner judges it by its shape alone (a glob glued to a separator), without knowing that its program never runs operands.

Rule candidate: an argv scanner labels an operand by the program that consumes it before judging its shape. A known data consumer's operands are never program words, unless an option of that program can run one (for git grep, the pager option). Sibling sites are the other argv scanners that label operands by token shape. The follow-up for the same scanner is #34098.

Related Issues

Follow-up: #34098 (five pager forms the floor does not refuse, strict xfail here).

Checklist

  • At most two commits, with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 9, 2026
@chenmingwei23
chenmingwei23 force-pushed the guard-g/gitgrep-pathspec-data branch from 213352e to bc89979 Compare November 9, 2026 21:23
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision f60af2ab493c141a63fbc376411bf00a37757515 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of f60af2ab493c141a63fbc376411bf00a37757515 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks: the fix uses the existing _DATA_CONSUMER_PROGRAMS / _data_consumer_exempt route, and a test that fails on base pins the false refusal.

What this change ships

Inventory (4 items) — 3 justified

Intent: let an agent run a read-only git grep with a pathspec glob without a false self-kill refusal. This is a FIX.

  1. A git grep x -- '*'; ls <product dir> run as the first statement, with no pager word, env word or redefined git, is no longer refused — justified
  2. The operands of a plain git grep now count as data, through the existing exemption set in shell_normalizer_programs.py — justified
  3. The package line budget goes up by 88; the description says 108 — rides along, a harmless budget bump
  4. Strict-xfail tests pin five pager forms the floor did not refuse before this change either, with Self-kill argv floor does not refuse five git grep pager forms #34098 as the follow-up — justified

[FIRST-PRINCIPLES-REVIEWED] f60af2a

Description read

[DESCRIPTION-READ] e1daff62fd66b616209b89a714b655c0c35fd3b46cb31bdcea659a629a70f038

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of f60af2ab493c141a63fbc376411bf00a37757515 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the exemption only relabels the operands of a first-statement, bare-git, pager-free and env-free git grep, and later frames are judged as before.

Notes

[DESIGN-REVIEWED] f60af2a

Description read

[DESCRIPTION-READ] 70946128196e812d8858e6d38c5581ab202865368e18f85cbab8b04e962fb0aa

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — 🔴 changes requested (blocking)

GPT 6.1 found at least one blocking issue that must be resolved before merging 2214032652d553e2398d88885eb3199e4b90b5f4. 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/security/shell_normalizer.py:781 -- Command hashing bypasses the new operand exemption

programs[i] = _PLAIN_GIT_GREP
Trigger: An executable /tmp/shim/git containing shift; exec "$@" is selected by hash -p /tmp/shim/git git; git grep pkill -f kirocrew. The deny gate reaches _is_self_kill → _argv_programs, which exempts pkill as Git data.
Outcome: The command now passes is_denied, whereas the previous attribution refuses it. Bash executes the shim and then pkill -f kirocrew; the Linux sandbox permits targeted same-user signals, allowing termination of the gateway.
Anchor: residual/security
Fix: Withhold the exemption when preceding statements alter command resolution, including hash -p; a literal git word alone does not establish that Git consumes the operands.

[BLOCK-MERGE] 2214032
[GPT-REVIEWED] 2214032

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

No adjudicable findings; F1 is the only finding, and it is fenced.

F1 — unbounded harm (a way around the deny gate's self-kill check). I confirmed it in the code. _label_plain_git_grep_frames (src/kiro_crew/security/shell_normalizer.py:765-781) marks every operand of a bare git grep as data unless it sees a pager word, an environment word, or a function or alias redefining git. _git_is_redefined (shell_normalizer.py:716-733) only checks for git(, function git and alias git=, so hash -p /tmp/shim/git git passes and the exemption still applies. Every condition is cheap for an adversarial agent to produce: write a shim, then issue one command line. Nothing in the code makes this rare, so the conditions for a FLAG are not met.

[ADJUDICATION] 2214032 total=0 uphold=0 downgrade=0
[GPT-ADJUDICATED] 2214032

[ADJUDICATION-FENCED] 2214032 fenced=1 flagged=0
UPHOLD-FENCED F1 src/kiro_crew/security/shell_normalizer.py:781 -- _git_is_redefined (lines 716-733) does not catch hash -p, so an agent can easily send hash -p <shim> git; git grep pkill ... and have the operands exempted as data, which is a plausible deny-gate bypass rather than an extreme edge case.
[GPT-ADJUDICATED-FENCED] 2214032

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 2214032652d553e2398d88885eb3199e4b90b5f4 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — 🔴 changes requested (blocking)

Reviewed 2214032652d553e2398d88885eb3199e4b90b5f4 — this comment is updated in place on each push.

This PR turns the self-kill floor from deny to allow. When git is shadowed or redefined in a way the new guards don't spot, git grep pkill -f kirocrew now passes. The base branch refuses every one of these lines.

BLOCKING — src/kiro_crew/security/shell_normalizer.py:781

    if _git_is_redefined(tokens):
        return
    ...
            programs[i] = _PLAIN_GIT_GREP

Trigger: The agent runs export PATH=/tmp/x; git grep pkill -f kirocrew. The same happens with declare -x PATH=…, hash -p /tmp/x git, . /tmp/defs or source /tmp/defs. A git function defined in the outer command and then called inside a nested payload behaves the same way: git(){ shift; "$@"; }; eval 'git grep pkill -f kirocrew', or export -f git; bash -c '…'. The path is is_denied → self-kill floor → _argv_programs → _label_plain_git_grep_frames. That function checks redefinition, environment words and pager options only against the visible tokens of the current frame list. The nested payload is tokenised on its own, and export/hash/source are none of the spellings it checks for. So the operands get the "git grep" label and the data-consumer exemption.
Outcome: is_denied returns None on head for all seven commands, and the base commit returns self-protection-kill for each. The shadowed git runs pkill -f kirocrew and kills the gateway. The sandbox has no PID namespace to stop that.
Anchor: residual/guard-removal
Fix: Stop deciding that git is real git from the line's text. Narrow the relabel to what the false positive needs: give the "git grep" label only to operands that are pathspec or glob words (holding *, ?, [ or a : magic prefix). Any operand that names a program keeps its "git" label, so a redefined or shadowed git can no longer turn pkill into data.

[BLOCK-MERGE] 2214032
[OPUS-REVIEWED] 2214032

Verdict parsed from the review's SHA-scoped output markers for commit 2214032652d553e2398d88885eb3199e4b90b5f4.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 2214032652d553e2398d88885eb3199e4b90b5f4 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 9, 2026
@chenmingwei23
chenmingwei23 force-pushed the guard-g/gitgrep-pathspec-data branch from c090538 to 214a4fc Compare November 9, 2026 22:21
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security/shell_normalizer.py

  • src/kiro_crew/security/shell_normalizer_programs.py

  • @chenmingwei23 comment (2 comments checked, none complete): missing field How to undo

How to clear this check:

  1. The PR author posts the template below as a PR comment, with
    every field filled (N/A needs a reason). Keep the
    Head commit line: it must name the current head SHA.
  2. The check turns green within a minute, with no push.
  3. A new push resets this check: post it again for the new head.

Only the author's comment counts this way. A reviewer can instead
paste the filled template into an "Approve" review on this head.
Merging still needs a reviewer's approval.

## Sensitive change review
- Head commit: f60af2ab493c141a63fbc376411bf00a37757515
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 2214032652d553e2398d88885eb3199e4b90b5f4 newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: adjudicated, zero confirmed regressions.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 14 classified, 0 newly refused, 12 still allowed.
  • ubuntu-latest (platform posix): 14 classified, 0 newly refused, 12 still allowed.
  • windows-latest (platform windows): 4 classified, 0 newly refused, 4 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: This change loosens the gate: it adds a fail-closed data-consumer exemption for the operands of a plain git grep, and nothing else gets stricter. The only new label, "git grep", is written to operand positions only. The programs[...] equality checks in the base (rm_floor._after_shell_verb and the array-expansion command-position check in shell_normalizer) compare that label to the token itself, so no operand that was allowed before can now be refused. The 18 candidates probe that boundary and no script verdict was handed back, so no regression is claimed.

TIGHTENING: No guard got stricter. The diff relabels operands in _argv_programs / _label_plain_git_grep_frames and exempts them as data (+ "git grep", in _DATA_CONSUMER_PROGRAMS). The one threat the diff keeps refused is a git grep pager that runs a program: "-O<cmd> and --open-files-in-pager=<cmd> run <cmd> on the matching files ... if any(_git_grep_opens_a_pager(token) for token in tokens): return". The exemption is also withdrawn for environment words, a git function or alias, and non-literal git program words.

ADJUDICATED: 18 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: The diff assumes a few spellings: the program word is the bare literal git, the next token is exactly grep, environment words look like NAME=..., and pager options are spelled the posix way (-O, --open...).

  • posix rows:
    • the fixed false positive (git grep x -- '*'; ls /w/kirocrew)
    • -o/--only-matching, which the pager scan matches by design
    • git --no-pager grep, a global option between git and grep
    • a LC_ALL=C environment prefix
    • a $PATTERN expansion
    • chained and piped neighbours
    • a direct grep for the label string
  • windows rows: git.exe grep, which is basename git but not the bare literal, so it is never exempted. Also a backslash pathspec, a %PATTERN% expansion, and the &-chained dir C:\w\kirocrew form of the fixed false positive.
  • any: no rows. Every row names an executable or a path.

No platform assumption in the diff is left without a probe.

UNADJUDICATED: The exemption leaves out commands that may well be legitimate: git.exe grep, git --no-pager grep, git grep -o, and an environment-prefixed git grep. This is not a regression, because the base never exempted them, and the classifier will only say whether each is refused on head. I can't confirm from reading whether the base refuses any of them, so I don't claim one.

[SCOPE-REVIEWED] 2214032

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 9, 2026
@chenmingwei23
chenmingwei23 force-pushed the guard-g/gitgrep-pathspec-data branch from 214a4fc to 2214032 Compare November 9, 2026 23:24
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 9, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 2214032
  • What rule changed: the self-kill argv floor now labels the operands of a plain git grep frame as data (search patterns and pathspecs git never executes). The label fails closed: it is withheld from every frame the moment the command line is ambiguous.
  • Before -> after (what was allowed/blocked, now): before, git grep x -- '*'; ls <product-named path> was refused as a self-kill (false positive); after, it is allowed. Nothing else that was refused becomes allowed. A pager option anywhere (-O, --open-files-in-pager=, clustered -nO, an expansion), a GIT_PAGER=/PATH= word, a redefined git (git(){...}, function git, alias git=), or a non-literal git program word (/tmp/git, ./git) each withholds the exemption.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a self-kill slips past the floor and terminates the gateway. Bounded by failing closed on every ambiguity above; a frame is exempted only for the bare literal git grep with no pager, env word or redefinition anywhere on the line.
  • Evidence checked (which sandbox result proves it): judged directly with the security module at three points -- origin/main, the buggy first fix, and this fix. The buggy first fix allowed the quoted-; pager command and the git-redefinition forms (the two review findings); this fix refuses every bypass again and allows only the false positive, matching origin/main on every bypass. test/test_argv_floor_git_grep_pathspec.py: 16 passed, 5 xfail (the pre-existing pager-form gap, Self-kill argv floor does not refuse five git grep pager forms #34098).
  • No regression:
    • Tools still work (which tools/commands were run, result): plain git grep pathspec commands that were false-refused are now allowed; the stays-refused and false-positive tests pass at the fix commit.
    • Backward compatible (old config / old data / old callers still work, how checked): the verdict matches origin/main on every stays-refused and bypass case; only the documented false positive changes.
    • Existing tests (which suites passed on this head): test_argv_floor_git_grep_pathspec.py green at the fix commit; the security package line budget was re-measured to 35,254.

@chenmingwei23
chenmingwei23 force-pushed the guard-g/gitgrep-pathspec-data branch from 2214032 to f60af2a Compare November 9, 2026 23:45
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: f60af2a
  • What rule changed: the self-kill argv floor now labels the operands of a plain git grep as data (search patterns and pathspecs git never executes), but only when that git grep is the FIRST statement on the line. The label fails closed on every ambiguity.
  • Before -> after (what was allowed/blocked, now): before, git grep x -- '*'; ls <product-named path> was refused as a self-kill (false positive); after, it is allowed. Nothing else that was refused becomes allowed. The exemption is withheld when any token could open a pager (-O, --open-files-in-pager=, clustered -nO, an expansion), when any frame carries an env word (GIT_PAGER=, inline PATH=), or when the git grep is not the first statement or its program word is not the bare literal git (/tmp/git, ./git).
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a self-kill slips past the floor and terminates the gateway. Bounded by the first-statement rule: a function, alias, PATH change, hash -p or any other statement that could reshadow git is itself an earlier statement, so it leaves git grep in a later frame and gets no exemption. A literal git word alone never earns it.
  • Evidence checked (which sandbox result proves it): judged directly with the security module at origin/main, the two earlier fixes, and this fix. The reviewers' bypasses (quoted ; + pager; git()/function git/PATH=/hash -p/command//tmp/git/./git) are all refused on this fix, matching origin/main. test/test_argv_floor_git_grep_pathspec.py: 19 passed, 5 xfail (the pre-existing glued-pager gap, Self-kill argv floor does not refuse five git grep pager forms #34098).
  • No regression:
    • Tools still work (which tools/commands were run, result): the plain git grep pathspec commands that were false-refused are allowed; the stays-refused, bypass and false-positive tests pass at the fix commit.
    • Backward compatible (old config / old data / old callers still work, how checked): the verdict matches origin/main on every stays-refused and bypass case; only the documented false positive changes.
    • Existing tests (which suites passed on this head): test_argv_floor_git_grep_pathspec.py green at the fix commit; the security package line budget was re-measured to 35,234.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Withdrawing the git grep operand exemption; this PR stays a draft and will not be merged.

Adversarial review found four bypass classes in a row, each defeating the previous guard:

  1. Quoted separator: a quoted ; de-quotes to a token identical to a real ;, ending a per-frame pager scan early so a later -O<kill> ran.
  2. Basename-only git: /tmp/git and ./git matched on basename.
  3. Command resolution before the frame: a git function, an alias, PATH=, hash -p, or command reshadows git, so a literal git word does not prove git consumes the operands.
  4. Nested payload under an outer shadow: git(){ ...; }; eval 'git grep <kill>' (and the sh -c form) runs under the outer function, but the nested payload is judged in isolation, so a first-statement rule never sees the outer redefinition.

A token-shape rule over one command line cannot prove git grep operands are data git never runs, and a self-kill bypass is worse than a false positive. So the exemption is stopped and main's behaviour (the false positive stays) is kept.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Nov 10, 2026
chenmingwei23 added a commit that referenced this pull request Nov 10, 2026
…#34098)

`git grep` runs its pager on the matching files, so a pager option names a
program git executes, but the self-kill argv floor did not see it: the command
lives inside one option token. Five forms were allowed on main (`-O<cmd>`, a
clustered `-nO<cmd>`, a `-c core.pager=<cmd>` global, a `GIT_PAGER=<cmd>` env
word, and an array expansion), plus the long `--open-files-in-pager=` option.

This adds refusal tests for those forms (red until the fix), keeps a benign
pager allowed, and pins as regression guards the shadowing and quoted-separator
forms a withdrawn `git grep` operand exemption would have had to defend (the
four bypass classes found reviewing #34097). Attack strings are built from
parts.
chenmingwei23 added a commit that referenced this pull request Nov 10, 2026
…#34098)

`git grep` runs its pager on the matching files, so a pager option names a
program git executes, but the self-kill argv floor did not see it: the command
lives inside one option token. Five forms were allowed on main (`-O<cmd>`, a
clustered `-nO<cmd>`, a `-c core.pager=<cmd>` global, a `GIT_PAGER=<cmd>` env
word, and an array expansion), plus the long `--open-files-in-pager=` option.

This adds refusal tests for those forms (red until the fix), keeps a benign
pager allowed, and pins as regression guards the shadowing and quoted-separator
forms a withdrawn `git grep` operand exemption would have had to defend (the
four bypass classes found reviewing #34097). Attack strings are built from
parts.
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Closing as withdrawn (2026-11-10 00:1xZ). Adversarial review found four bypass classes in a row (quoted separator, basename-only git, command resolution before the frame, and a nested payload under an outer shadow), which showed that this pattern-rule exemption for git grep operands cannot be made sound from the token stream alone.

The refusal tests for all four classes moved into #34233, which refuses a git command that opens or configures a pager. The sound approach to the git grep pathspec false positive is tracked in #34234.

The branch is kept for reference.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants