Skip to content

docs: stream gh JSON payloads on stdin in the PR-body fallback and the sage poster - #21307

Merged
bolichen97 merged 1 commit into
mainfrom
replace/8353-flags
Nov 8, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
replace/8353-flags

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Replaces #8353 (by @atomsbaza), narrowed by the owner's decision to its stdin edits.

Problem / Motivation

Goal: Two shipped gh recipes send their JSON body on stdin instead of through a temporary file.

The prepare-pr skill's REST fallback for a failed gh pr edit (references/ci.md) and the code-review-sage poster prompt (sage_lib/review_driver.py) both write the JSON payload to a temp file, then pass --input <file>. The temp file lands in a shared /tmp and is never cleaned up.

Why it matters

An agent following either recipe leaves a body file behind in /tmp, where another session can read or overwrite it. Piping the JSON on stdin (--input -) does the same job with nothing left on disk.

Not a goal

  • Refusing gh's body-from-file flags (gh api --input <file>, --field k=@<file>, gh release --notes-file <file>). The owner (iamwhatever, a maintainer) decided this PR drops that refusal, answering bolichen97's review 5804824533: a command that works on main keeps working. Block versus prompt stays open in Data-exfiltration deny pattern misses the long-form file-body flags #7365.
  • Any change to the deny gate, its catalog or the shared shell reader.

What changed (motivation → approach → change)

Recipe Before After
prepare-pr REST body fallback (ci.md) JSON written to /tmp/pr-patch.json, then --input /tmp/pr-patch.json python3 -c … | gh api … -X PATCH --input -
code-review-sage poster (review_driver.py) payload written to a temp file, then --input <tmpfile> payload piped on stdin, --input -

Both recipes send the same request as before; only the transport of the body changes. Two small tests pin the shipped text, and one checks that the exfil gate allows the stdin form.

Why this shape: the earlier version of this PR added a new deny row for gh's file flags. The owner decided to drop it, so this PR keeps only the stdin edits bolichen97 marked as fine to keep.

Backwards compatibility

Compatible: both recipes produce the same API call; stdin replaces a temp file, and every gh version that supports --input reads - as stdin.

Removes nothing: no rule, key or function is taken away; only two command examples change.

Tests

  • test_prepare_pr_rest_fallback_uses_stdin: ci.md shows -X PATCH --input - and no --input /tmp/.
  • test_code_review_sage_poster_streams_its_payload_on_stdin: the poster prompt has no --input <tmpfile>, shows reviews --input -, and audit_bash_exfiltration allows the piped command.

Proof: not provable -- docs or config only

Local: the exfil, display-battery and security-liveness suites and the code-review-sage tests pass on the head. One code-review-sage test (test_store_ancestor_chain.py::…test_a_link_planted_inside_the_window_is_followed_outside_every_root) fails on this host and on main alike.

Manual verification

N/A — the change is two command examples, and the tests read the shipped text.

Related Issues

Part of #7365
Replaces #8353

Checklist

  • At most two commits (one is the norm), 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

Contributed under Apache-2.0. Original finding and design by @atomsbaza in #8353.

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 16, 2026 16:37
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: ddbce2d
  • What rule changed: The data-exfiltration deny gate (security/exfil.py, audit_bash_exfiltration) gains one matcher for gh's body-from-file flags, under a new catalog row data-exfil-gh-file-body (security/denied_rules.py).
  • Before -> after (what was allowed/blocked, now): Before: gh api|repo --input <file>, --field k=@<file>, gh release create|edit --notes-file <file> / -F <file> were allowed; gh api -F k=@file was already refused. After: all are refused. Still allowed: --input -, --field k=@-, --notes-file -, gh pr create --body-file, echo/grep of the flag text, another command's own --input.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): Breaks commands: a gh upload from a local file is refused. The refusal names data-exfil-gh-file-body, which an operator can turn off alone in Settings; curl rows stay on. No secret leaks: the change only adds denials.
  • Evidence checked (which sandbox result proves it): Local probe of the gate and is_denied on main 32dddfc vs this head: the 4 gh shapes go from allowed to refused; curl/wget long forms and the stdin form keep their verdicts (table in the PR body, pinned in test/test_exfil_gate_opt_out.py).
  • No regression:
    • Tools still work (which tools/commands were run, result): gh … --input -, gh pr create --body-file, gh api -F title=hello, gh issue view return no denial (tests).
    • Backward compatible (old config / old data / old callers still work, how checked): No existing row, pattern or export changes; disabled_ids naming old ids work as before (test_exfil_gate_opt_out.py).
    • Existing tests (which suites passed on this head): security, exfil, denied-rules, hooks, argv-floor, shell-normalizer, read-only-bash and display-battery suites: 4203 passed locally.
  • How to undo: Revert this commit, or turn off data-exfil-gh-file-body in Settings.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

  • No sensitive path changed; nothing to check.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 16, 2026
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision e7755668fee7aa48c5633c5291f70de8187dafb2 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 Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the PR only changes how two shipped recipes send their JSON body (stdin instead of a temp file), and the API call they make is unchanged.

Notes

  • The sage poster test checks a hand-written jq … | gh api command, not the recipe text the prompt ships. It shows the gate allows the general stdin form, not the exact line an agent will run.

[DESIGN-REVIEWED] e775566

Description read

[DESCRIPTION-READ] 57cab4b3381cb5a1d9039d174209f34de8a06be49f91fe0ff3526b74ad071e64

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 Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of e7755668fee7aa48c5633c5291f70de8187dafb2 — 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. It is a fix to two shipped command recipes, the harm is named (a body file left in a shared /tmp), and no default or product shape changes.

What this change ships

Inventory (3 items) — 3 justified

Intent: Agents that follow the PR-body REST fallback or the sage poster should leave no JSON body file in a shared /tmp. This is a FIX.

  1. The prepare-pr skill's REST fallback for a failed gh pr edit now pipes the JSON body on stdin (--input -) instead of writing /tmp/pr-patch.json — justified
  2. The code-review-sage poster prompt now tells the agent to pipe github_review_payload on stdin instead of writing a temp file — justified
  3. Two tests pin the shipped text of both recipes and check that the exfil gate allows the piped form — justified

[FIRST-PRINCIPLES-REVIEWED] e775566

Description read

[DESCRIPTION-READ] e279c0e5943ba6c8a5cd56a12390b637a724271129f58c51fe3015e652df6703

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 Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] e775566

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

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

Comment thread src/kiro_crew/security/exfil.py Fixed
Comment thread src/kiro_crew/security/exfil.py Fixed
Comment thread src/kiro_crew/security/exfil.py Fixed
@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 Oct 16, 2026
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of e7755668fee7aa48c5633c5291f70de8187dafb2 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] e775566

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

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 97ef64921526f9349028833b72c4daec643b59b4 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): 24 classified, 0 newly refused, 23 still allowed.
  • ubuntu-latest (platform posix): 24 classified, 0 newly refused, 23 still allowed.
  • windows-latest (platform windows): 5 classified, 0 newly refused, 5 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: No regression has been confirmed by the script. The new matcher only fires when gh is a command's program word. Within api/repo/release it only looks at --input <file>, --field/-F k=@<file> and release --notes-file/-F <file>. The candidates probe stdin forms, plain -F values, -f raw fields, the other subcommands and text that only mentions a flag. One narrowing could be argued but not confirmed: legitimate uses that read a file through these exact flags are now refused by design. They are named under UNADJUDICATED and do not block.

TIGHTENING: a new catalog row, data-exfil-gh-file-body, matched on shell words in the exfil tier (audit_bash_exfiltration) and also as an is_denied argv floor that fails closed. It refuses one threat: gh uploading a local file as a request body. Quoted from the hunk: "Blocks gh sending a request body read from a LOCAL FILE: gh api --input <file>, --field k=@<file>, and gh release --notes-file <file>. Stdin (--input -, k=@-) is not blocked." The diff also adds an opt-in whole_words reading to shell_commands.read_commands, and only this matcher sets it.

ADJUDICATED: 29 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: 24 posix rows and 5 windows rows.

  • posix: covers the shell-word assumptions the diff adds. These are $( … )/${ … }/$(( … )) kept as one word, quoted here-documents in --notes and commit messages, env-prefix and redirection forms, -- passthrough on repo clone, -p/-D on release download, and the matcher's cheap "gh" substring check (--grep='github').
  • windows: rows for gh.exe, a cmd type … | gh api … --input - pipe, drive-letter -D/--body-file paths, and %VAR% in -F values. These cover the matcher's assumption that the program basename is exactly gh and that - and /dev/stdin are the only stdin spellings.
  • Not probed: PowerShell's own tokenizer (backtick escape, Get-Content … |). The matcher reads bash quoting only, so how a PowerShell command line is read is open.

UNADJUDICATED: The legitimate ordinary operations this row refuses are the threat shape itself. Per scope rules they were not written as rows:

  • gh api graphql -F query=@<file>.graphql: reading a GraphQL query from a file.
  • gh release create <tag> -F CHANGELOG.md / --notes-file: release notes from a file.
  • In the base tree, .github/workflows/main-red-pr-notice.yml:210,214 runs gh api … -F body=@"$work/comment.md".

Those workflows run outside the agent gate, so this diff does not affect them. An agent asked to replay one would be refused, and would need to switch to the stdin forms (--input -, k=@-, --notes-file -) that the row keeps allowed. The narrowing is a policy choice the PR makes on purpose (it updates the prepare-pr and sage prompts to match), not a confirmed over-match. One more open point: on any exception the is_denied floor fails closed (gh_flag = "?") for every command the "gh" check lets through, including any text containing "github", "high" and so on. No candidate can reliably trigger a reader exception, so that fail-closed path is unmeasured.

[SCOPE-REVIEWED] 97ef649

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 16, 2026
@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 Oct 16, 2026
@iamwhatever
iamwhatever force-pushed the replace/8353-flags branch 2 times, most recently from 4b36e7c to 69322c0 Compare October 16, 2026 19:01
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 69322c0
  • What rule changed: The data-exfiltration deny gate (security/exfil.py, audit_bash_exfiltration) gains one matcher for gh's body-from-file flags, under a new catalog row data-exfil-gh-file-body (security/denied_rules.py).
  • Before -> after (what was allowed/blocked, now): Before: gh api|repo --input <file>, --field k=@<file>, gh release create|edit --notes-file <file> / -F <file> were allowed; gh api -F k=@file was already refused. After: all are refused. Still allowed: --input -, --field k=@-, --notes-file -, gh pr create --body-file, echo/grep of the flag text, another command's own --input (after ;, &&, | or a newline), a quoted field value that mentions --input, a known option's value (--title '--input=x'), a here-document body, stdin names (/dev/stdin, /dev/fd/N, <( … )).
  • Worst case if wrong (breaks commands / leaks secret / locks user out): Breaks commands: a gh upload from a local file is refused. The refusal names data-exfil-gh-file-body, which an operator can turn off alone in Settings; curl rows stay on. No secret leaks: the change only adds denials.
  • Evidence checked (which sandbox result proves it): Local probe of the gate and is_denied on main 32dddfc vs this head: the 4 gh shapes go from allowed to refused; curl/wget long forms and the stdin form keep their verdicts (table in the PR body, pinned in test/test_exfil_gate_opt_out.py).
  • No regression:
    • Tools still work (which tools/commands were run, result): gh … --input -, gh pr create --body-file, gh api -F title=hello, gh issue view return no denial (tests).
    • Shipped callers: the prepare-pr fallback and the code-review-sage poster prompt now stream on stdin; issue_radar already did.
    • Backward compatible (old config / old data / old callers still work, how checked): No existing row, pattern or export changes; disabled_ids naming old ids work as before (test_exfil_gate_opt_out.py).
    • Existing tests (which suites passed on this head): security, exfil, denied-rules, hooks, argv-floor, shell-normalizer, read-only-bash and display-battery and code-review-sage suites: 5210 passed locally. The row's catalog regex is removed from the regex tier (_GH_FILE_BODY_PATTERN); the gate enforces it and honours its toggle.
  • How to undo: Revert this commit, or turn off data-exfil-gh-file-body in Settings.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 16, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 967a72c
  • What rule changed: new deny row data-exfil-gh-file-body (denied_rules.py, denied_rules_catalog.py, denied_rules_tables.py), matched by gh_file_body.py on shell words read from the shared shell_commands.read_commands(heredocs=True). The exfil gate (exfil_bash.py, re-exported in exfil.py) and the is_denied floor (deny_gate.py) run it while the row is enabled; the floor honours a per-session waiver like other rows.
  • Before -> after (what was allowed/blocked, now): before, gh api|repo --input <file>, gh's field flag reading a local file (k=@<file>) and gh release --notes-file <file> were allowed. Now they are refused where gh is a command's program word. Stdin forms (-, /dev/stdin, /dev/fd/N, <( … )), -f/--raw-field, and text that only mentions a flag (echo, grep, a heredoc body, a later command's own flag) stay allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): breaks commands: a harmless gh call refused, with the row's own toggle as the way out. On the leak side, the shapes the shared reader misreads (listed under Not a goal, tracked in rm floor: su feeding a heredoc to a shell is not read (su -s <shell> <user>, plain su <user>) #30593) let a gh upload through, as main does today.
  • Evidence checked (which sandbox result proves it): no sandbox change; this is a deny row before the sandbox. Evidence is test/test_exfil_gate_opt_out.py and test/test_shell_commands_heredoc.py through both audit_bash_exfiltration and is_denied, prove.py PROVEN on this head, and a mutant (the default stopping read) that fails 14 gh rows.
  • No regression:
    • Tools still work (which tools/commands were run, result): stdin forms and mention-only commands are allowed in the tests; the prepare-pr REST fallback and the code-review-sage poster now stream their body on stdin.
    • Backward compatible (old config / old data / old callers still work, how checked): the row can be switched off alone; catalog count 113 -> 114 and the golden fixture updated; no config format change.
    • Existing tests (which suites passed on this head): 940 passed across test_shell_commands_heredoc, test_exfil_gate_opt_out, test_denied_commands_security, test_security_gate_liveness, test_display_battery_rules_version, test_shell_heredoc_reader, test_denied_commands_security_rows, test_flake_pattern_ratchet.
  • How to undo: revert this single commit, or disable data-exfil-gh-file-body in Settings.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 791a3a6
  • What rule changed: new deny row data-exfil-gh-file-body (denied_rules.py, denied_rules_catalog.py, denied_rules_tables.py), matched by gh_file_body.py on shell words read from the shared shell_commands.read_commands(heredocs=True). The exfil gate (exfil_bash.py, re-exported in exfil.py) and the is_denied floor (deny_gate.py) run it while the row is enabled; the floor honours a per-session waiver like other rows.
  • Before -> after (what was allowed/blocked, now): before, gh api|repo --input <file>, gh's field flag reading a local file (k=@<file>) and gh release --notes-file <file> were allowed. Now they are refused where gh is a command's program word. Stdin forms (-, /dev/stdin, /dev/fd/N, <( … )), -f/--raw-field, and text that only mentions a flag (echo, grep, a heredoc body, a later command's own flag) stay allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): breaks commands: a harmless gh call refused, with the row's own toggle as the way out. On the leak side, the shapes the shared reader misreads (listed under Not a goal, tracked in rm floor: su feeding a heredoc to a shell is not read (su -s <shell> <user>, plain su <user>) #30593) let a gh upload through, as main does today.
  • Evidence checked (which sandbox result proves it): no sandbox change; this is a deny row before the sandbox. Evidence is test/test_exfil_gate_opt_out.py and test/test_shell_commands_heredoc.py through both audit_bash_exfiltration and is_denied, prove.py PROVEN on this head, and a mutant (the default stopping read) that fails 14 gh rows.
  • No regression:
    • Tools still work (which tools/commands were run, result): stdin forms and mention-only commands are allowed in the tests; the prepare-pr REST fallback and the code-review-sage poster now stream their body on stdin.
    • Backward compatible (old config / old data / old callers still work, how checked): the row can be switched off alone; catalog count 113 -> 114 and the golden fixture updated; no config format change.
    • Existing tests (which suites passed on this head): 940 passed across test_shell_commands_heredoc, test_exfil_gate_opt_out, test_denied_commands_security, test_security_gate_liveness, test_display_battery_rules_version, test_shell_heredoc_reader, test_denied_commands_security_rows, test_flake_pattern_ratchet.
  • How to undo: revert this single commit, or disable data-exfil-gh-file-body in Settings.

@iamwhatever

iamwhatever commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: _gh_argvs rejoins the outer command's words after an unquoted substitution

  • span=f28fcd39a1a2 A later quoted substitution consumes the outer command's pending argv

fixed in f39d4b3: the carried words join only the piece that starts right after the closing ) or backtick (only blanks or closers between, by source offset). A quoted "$(…)" later on the line starts inside the continuation, so it stays its own command. gh api $(echo /gists) --jq "$(echo .)" --input f is refused and gh api $(echo /gists) -f body="$(echo --input f)" is allowed, at the gate and is_denied (2 test rows; both fail on 791a3a6).

🤖 AI-assisted comment 🤖

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: f39d4b3
  • What rule changed: new deny row data-exfil-gh-file-body (denied_rules.py, denied_rules_catalog.py, denied_rules_tables.py), matched by gh_file_body.py on shell words read from the shared shell_commands.read_commands(heredocs=True). The exfil gate (exfil_bash.py, re-exported in exfil.py) and the is_denied floor (deny_gate.py) run it while the row is enabled; the floor honours a per-session waiver like other rows.
  • Before -> after (what was allowed/blocked, now): before, gh api|repo --input <file>, gh's field flag reading a local file (k=@<file>) and gh release --notes-file <file> were allowed. Now they are refused where gh is a command's program word. Stdin forms (-, /dev/stdin, /dev/fd/N, <( … )), -f/--raw-field, and text that only mentions a flag (echo, grep, a heredoc body, a later command's own flag) stay allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): breaks commands: a harmless gh call refused, with the row's own toggle as the way out. On the leak side, the shapes the shared reader misreads (listed under Not a goal, tracked in rm floor: su feeding a heredoc to a shell is not read (su -s <shell> <user>, plain su <user>) #30593) let a gh upload through, as main does today.
  • Evidence checked (which sandbox result proves it): no sandbox change; this is a deny row before the sandbox. Evidence is test/test_exfil_gate_opt_out.py and test/test_shell_commands_heredoc.py through both audit_bash_exfiltration and is_denied, prove.py PROVEN on this head, and a mutant (the default stopping read) that fails 14 gh rows.
  • No regression:
    • Tools still work (which tools/commands were run, result): stdin forms and mention-only commands are allowed in the tests; the prepare-pr REST fallback and the code-review-sage poster now stream their body on stdin.
    • Backward compatible (old config / old data / old callers still work, how checked): the row can be switched off alone; catalog count 113 -> 114 and the golden fixture updated; no config format change.
    • Existing tests (which suites passed on this head): 940 passed across test_shell_commands_heredoc, test_exfil_gate_opt_out, test_denied_commands_security, test_security_gate_liveness, test_display_battery_rules_version, test_shell_heredoc_reader, test_denied_commands_security_rows, test_flake_pattern_ratchet.
  • How to undo: revert this single commit, or disable data-exfil-gh-file-body in Settings.

@iamwhatever

iamwhatever commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: shared reader opt-in read_commands(whole_words=True), set only by the gh check
resolution: removed -- the rejoin in _gh_argvs is deleted

  • span=f28fcd39a1a2 Offsetless reader pieces discard gh's pending upload arguments

fixed in 87e6700: the rejoin is gone. The gh check reads argv with the shared reader's opt-in whole_words: an unquoted $(…), backtick, <(…), >(…) or $((…)) stays one word of its command, as a quoted one already did, and inside ${…} nothing cuts. A heredoc inside a later quoted "$(…)" therefore cannot take gh's words. Every other reader caller keeps the default; its output is byte-identical to the parent in 17,472 comparisons.
Not a goal, listed in the body: a literal ( inside ${…} inside $(…) ($(echo ${x//(/})) is miscounted by the shared close-paren finder _matching_close_paren, used by every floor; it gets its own fix.

🤖 AI-assisted comment 🤖

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 87e6700
  • What rule changed: new deny row data-exfil-gh-file-body (denied_rules.py, denied_rules_catalog.py, denied_rules_tables.py), matched by gh_file_body.py on shell words read from the shared shell_commands.read_commands(heredocs=True). The exfil gate (exfil_bash.py, re-exported in exfil.py) and the is_denied floor (deny_gate.py) run it while the row is enabled; the floor honours a per-session waiver like other rows.
  • Before -> after (what was allowed/blocked, now): before, gh api|repo --input <file>, gh's field flag reading a local file (k=@<file>) and gh release --notes-file <file> were allowed. Now they are refused where gh is a command's program word. Stdin forms (-, /dev/stdin, /dev/fd/N, <( … )), -f/--raw-field, and text that only mentions a flag (echo, grep, a heredoc body, a later command's own flag) stay allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): breaks commands: a harmless gh call refused, with the row's own toggle as the way out. On the leak side, the shapes the shared reader misreads (listed under Not a goal, tracked in rm floor: su feeding a heredoc to a shell is not read (su -s <shell> <user>, plain su <user>) #30593) let a gh upload through, as main does today.
  • Evidence checked (which sandbox result proves it): no sandbox change; this is a deny row before the sandbox. Evidence is test/test_exfil_gate_opt_out.py and test/test_shell_commands_heredoc.py through both audit_bash_exfiltration and is_denied, prove.py PROVEN on this head, and a mutant (the default stopping read) that fails 14 gh rows.
  • No regression:
    • Tools still work (which tools/commands were run, result): stdin forms and mention-only commands are allowed in the tests; the prepare-pr REST fallback and the code-review-sage poster now stream their body on stdin.
    • Backward compatible (old config / old data / old callers still work, how checked): the row can be switched off alone; catalog count 113 -> 114 and the golden fixture updated; no config format change.
    • Existing tests (which suites passed on this head): 940 passed across test_shell_commands_heredoc, test_exfil_gate_opt_out, test_denied_commands_security, test_security_gate_liveness, test_display_battery_rules_version, test_shell_heredoc_reader, test_denied_commands_security_rows, test_flake_pattern_ratchet.
  • How to undo: revert this single commit, or disable data-exfil-gh-file-body in Settings.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: shared reader read_commands: a backslash-newline is one escape step, so $\<newline>( is not read as $(

  • span=f28fcd39a1a2 Line continuations bypass gh's file-upload rule

accepted-and-deferred: not a regression. Probe on main and this head: gh api $\<LF>(echo /gists) --input f and gh release create $\<LF>(echo v1) --notes-file f are allowed on both; three other continuation shapes ($(…) \<LF>--input f, $(…)\<LF> --input f, a backtick before \<LF>--input f) are refused here and allowed on main.
A fold of backslash-newline in the gh check's text was tried and dropped: a local verifier showed it hides a gh upload after a # comment or inside a quoted here-document. Folding correctly needs the shared reader's comment and here-document state, so it is listed under Not a goal for the reader follow-up (#31979).

🤖 AI-assisted comment 🤖

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 41a8fd5
  • What rule changed: new deny row data-exfil-gh-file-body (denied_rules.py, denied_rules_catalog.py, denied_rules_tables.py), matched by gh_file_body.py on shell words read from the shared shell_commands.read_commands(heredocs=True). The exfil gate (exfil_bash.py, re-exported in exfil.py) and the is_denied floor (deny_gate.py) run it while the row is enabled; the floor honours a per-session waiver like other rows.
  • Before -> after (what was allowed/blocked, now): before, gh api|repo --input <file>, gh's field flag reading a local file (k=@<file>) and gh release --notes-file <file> were allowed. Now they are refused where gh is a command's program word. Stdin forms (-, /dev/stdin, /dev/fd/N, <( … )), -f/--raw-field, and text that only mentions a flag (echo, grep, a heredoc body, a later command's own flag) stay allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): breaks commands: a harmless gh call refused, with the row's own toggle as the way out. On the leak side, the shapes the shared reader misreads (listed under Not a goal, tracked in rm floor: su feeding a heredoc to a shell is not read (su -s <shell> <user>, plain su <user>) #30593) let a gh upload through, as main does today.
  • Evidence checked (which sandbox result proves it): no sandbox change; this is a deny row before the sandbox. Evidence is test/test_exfil_gate_opt_out.py and test/test_shell_commands_heredoc.py through both audit_bash_exfiltration and is_denied, prove.py PROVEN on this head, and a mutant (the default stopping read) that fails 14 gh rows.
  • No regression:
    • Tools still work (which tools/commands were run, result): stdin forms and mention-only commands are allowed in the tests; the prepare-pr REST fallback and the code-review-sage poster now stream their body on stdin.
    • Backward compatible (old config / old data / old callers still work, how checked): the row can be switched off alone; catalog count 113 -> 114 and the golden fixture updated; no config format change.
    • Existing tests (which suites passed on this head): 940 passed across test_shell_commands_heredoc, test_exfil_gate_opt_out, test_denied_commands_security, test_security_gate_liveness, test_display_battery_rules_version, test_shell_heredoc_reader, test_denied_commands_security_rows, test_flake_pattern_ratchet.
  • How to undo: revert this single commit, or disable data-exfil-gh-file-body in Settings.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

@bolichen97 Ready for re-review at head 41a8fd5b71a5.

  • Within your option B (comment 6543795707): the gh check reads argv only from the shared read_commands. The rejoin code is deleted. In its place is option A, an opt-in whole_words reader flag that keeps an unquoted substitution as one word of its command. Only the gh check sets it, and every other caller's output is unchanged.

  • AI review: every lane passes on this head (GPT, Opus, Design, First Principles, UX).

  • Not a goal, both allowed on main too:

    • a literal ( inside ${…} inside $(…), miscounted by the shared _matching_close_paren;
    • a backslash-newline inside the $( opener.

    See this disposition; the reader follow-up is Shell reader cuts a command's argv at an unquoted $(…), backtick or <(…) #31979.

  • Security Scope Review is red only because it holds an earlier rate-limited result. Its latest run on this head passed, so a writer can clear it.

  • Dependency License Gate is red because the repo's dependency-graph setting is off.

  • Sensitive Change template: it predates the whole_words flag; the PR body has the current description.

🤖 AI-assisted comment 🤖

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Conflict-only rebase onto main a254f30cf57a (head 41a8fd5b71a5 -> 7d72610caaf7): the one conflict was the package line budget in test/test_security_gate_liveness.py, now main 35,001 + this PR 269 = 35,270. No code change.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 7d72610
  • What rule changed: new deny row data-exfil-gh-file-body (denied_rules.py, denied_rules_catalog.py, denied_rules_tables.py), matched by gh_file_body.py on shell words read from the shared shell_commands.read_commands(heredocs=True). The exfil gate (exfil_bash.py, re-exported in exfil.py) and the is_denied floor (deny_gate.py) run it while the row is enabled; the floor honours a per-session waiver like other rows.
  • Before -> after (what was allowed/blocked, now): before, gh api|repo --input <file>, gh's field flag reading a local file (k=@<file>) and gh release --notes-file <file> were allowed. Now they are refused where gh is a command's program word. Stdin forms (-, /dev/stdin, /dev/fd/N, <( … )), -f/--raw-field, and text that only mentions a flag (echo, grep, a heredoc body, a later command's own flag) stay allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): breaks commands: a harmless gh call refused, with the row's own toggle as the way out. On the leak side, the shapes the shared reader misreads (listed under Not a goal, tracked in rm floor: su feeding a heredoc to a shell is not read (su -s <shell> <user>, plain su <user>) #30593) let a gh upload through, as main does today.
  • Evidence checked (which sandbox result proves it): no sandbox change; this is a deny row before the sandbox. Evidence is test/test_exfil_gate_opt_out.py and test/test_shell_commands_heredoc.py through both audit_bash_exfiltration and is_denied, prove.py PROVEN on this head, and a mutant (the default stopping read) that fails 14 gh rows.
  • No regression:
    • Tools still work (which tools/commands were run, result): stdin forms and mention-only commands are allowed in the tests; the prepare-pr REST fallback and the code-review-sage poster now stream their body on stdin.
    • Backward compatible (old config / old data / old callers still work, how checked): the row can be switched off alone; catalog count 113 -> 114 and the golden fixture updated; no config format change.
    • Existing tests (which suites passed on this head): 940 passed across test_shell_commands_heredoc, test_exfil_gate_opt_out, test_denied_commands_security, test_security_gate_liveness, test_display_battery_rules_version, test_shell_heredoc_reader, test_denied_commands_security_rows, test_flake_pattern_ratchet.
  • How to undo: revert this single commit, or disable data-exfil-gh-file-body in Settings.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: _gh_file_body_flag scans gh's flags word by word

  • span=f28fcd39a1a2 Respect gh's end-of-options marker

fixed in c0c98f1: the flag scan stops at the first bare -- that is not a known option's value, as gh's flag parser (pflag) does. gh release upload v1 -- --notes-file=asset.zip and gh api /x -- --input f are allowed again, as on main; --input f, --notes-file f, -F f and --field k=@f before --, and --title -- --notes-file f (where -- is the title), stay refused at the gate and is_denied. Test rows added; without the stop the two -- rows fail.

🤖 AI-assisted comment 🤖

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: c0c98f1
  • What rule changed: new deny row data-exfil-gh-file-body (denied_rules.py, denied_rules_catalog.py, denied_rules_tables.py), matched by gh_file_body.py on shell words read from the shared shell_commands.read_commands(heredocs=True). The exfil gate (exfil_bash.py, re-exported in exfil.py) and the is_denied floor (deny_gate.py) run it while the row is enabled; the floor honours a per-session waiver like other rows.
  • Before -> after (what was allowed/blocked, now): before, gh api|repo --input <file>, gh's field flag reading a local file (k=@<file>) and gh release --notes-file <file> were allowed. Now they are refused where gh is a command's program word. Stdin forms (-, /dev/stdin, /dev/fd/N, <( … )), -f/--raw-field, and text that only mentions a flag (echo, grep, a heredoc body, a later command's own flag) stay allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): breaks commands: a harmless gh call refused, with the row's own toggle as the way out. On the leak side, the shapes the shared reader misreads (listed under Not a goal, tracked in rm floor: su feeding a heredoc to a shell is not read (su -s <shell> <user>, plain su <user>) #30593) let a gh upload through, as main does today.
  • Evidence checked (which sandbox result proves it): no sandbox change; this is a deny row before the sandbox. Evidence is test/test_exfil_gate_opt_out.py and test/test_shell_commands_heredoc.py through both audit_bash_exfiltration and is_denied, prove.py PROVEN on this head, and a mutant (the default stopping read) that fails 14 gh rows.
  • No regression:
    • Tools still work (which tools/commands were run, result): stdin forms and mention-only commands are allowed in the tests; the prepare-pr REST fallback and the code-review-sage poster now stream their body on stdin.
    • Backward compatible (old config / old data / old callers still work, how checked): the row can be switched off alone; catalog count 113 -> 114 and the golden fixture updated; no config format change.
    • Existing tests (which suites passed on this head): 940 passed across test_shell_commands_heredoc, test_exfil_gate_opt_out, test_denied_commands_security, test_security_gate_liveness, test_display_battery_rules_version, test_shell_heredoc_reader, test_denied_commands_security_rows, test_flake_pattern_ratchet.
  • How to undo: revert this single commit, or disable data-exfil-gh-file-body in Settings.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

@bolichen97 New head c0c98f1420c0 for re-review. Since 41a8fd5b71a5: a conflict-only rebase, and one 2-line fix. The gh check now stops reading flags at a bare --, as gh's own parser does, so gh release upload v1 -- --notes-file=asset.zip names an asset and is allowed again, as on main (disposition). Every AI review lane and every test passes on this head. Security Scope Review is red only because it holds an earlier rate-limited result; its latest run on this head passed its legs, so a writer can clear it.

🤖 AI-assisted comment 🤖

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Conflict-only rebase onto main 95695bae9396 (head c0c98f1420c0 -> 3d0d385e14f4): the one conflict was the package line budget in test/test_security_gate_liveness.py, now main 35,036 + this PR 271 = 35,307. No code change.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 3d0d385
  • What rule changed: new deny row data-exfil-gh-file-body (denied_rules.py, denied_rules_catalog.py, denied_rules_tables.py), matched by gh_file_body.py on shell words read from the shared shell_commands.read_commands(heredocs=True). The exfil gate (exfil_bash.py, re-exported in exfil.py) and the is_denied floor (deny_gate.py) run it while the row is enabled; the floor honours a per-session waiver like other rows.
  • Before -> after (what was allowed/blocked, now): before, gh api|repo --input <file>, gh's field flag reading a local file (k=@<file>) and gh release --notes-file <file> were allowed. Now they are refused where gh is a command's program word. Stdin forms (-, /dev/stdin, /dev/fd/N, <( … )), -f/--raw-field, and text that only mentions a flag (echo, grep, a heredoc body, a later command's own flag) stay allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): breaks commands: a harmless gh call refused, with the row's own toggle as the way out. On the leak side, the shapes the shared reader misreads (listed under Not a goal, tracked in rm floor: su feeding a heredoc to a shell is not read (su -s <shell> <user>, plain su <user>) #30593) let a gh upload through, as main does today.
  • Evidence checked (which sandbox result proves it): no sandbox change; this is a deny row before the sandbox. Evidence is test/test_exfil_gate_opt_out.py and test/test_shell_commands_heredoc.py through both audit_bash_exfiltration and is_denied, prove.py PROVEN on this head, and a mutant (the default stopping read) that fails 14 gh rows.
  • No regression:
    • Tools still work (which tools/commands were run, result): stdin forms and mention-only commands are allowed in the tests; the prepare-pr REST fallback and the code-review-sage poster now stream their body on stdin.
    • Backward compatible (old config / old data / old callers still work, how checked): the row can be switched off alone; catalog count 113 -> 114 and the golden fixture updated; no config format change.
    • Existing tests (which suites passed on this head): 940 passed across test_shell_commands_heredoc, test_exfil_gate_opt_out, test_denied_commands_security, test_security_gate_liveness, test_display_battery_rules_version, test_shell_heredoc_reader, test_denied_commands_security_rows, test_flake_pattern_ratchet.
  • How to undo: revert this single commit, or disable data-exfil-gh-file-body in Settings.

@iamwhatever

iamwhatever commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Backend Tests reds on 3d0d385e14f4 (3.12 and Windows shards 5 and 6, and the Coverage Gate that follows them) are two tests that fail on main too: test_dashboard_server_composition_contract.py::test_the_lazy_imports_stay_inside_the_functions_that_need_them (136 == 135) and the two test_held_note_turn_starts.py tree-scan checks. #32606 re-pins both. No change here; this PR rebases once #32606 merges.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased onto main 0f1dd2bd02fe, which carries the main-red fix #32606 (head 3d0d385e14f4 -> 684b0c5de928). Clean rebase, no code change; CI re-running.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 684b0c5
  • What rule changed: new deny row data-exfil-gh-file-body (denied_rules.py, denied_rules_catalog.py, denied_rules_tables.py), matched by gh_file_body.py on shell words read from the shared shell_commands.read_commands(heredocs=True). The exfil gate (exfil_bash.py, re-exported in exfil.py) and the is_denied floor (deny_gate.py) run it while the row is enabled; the floor honours a per-session waiver like other rows.
  • Before -> after (what was allowed/blocked, now): before, gh api|repo --input <file>, gh's field flag reading a local file (k=@<file>) and gh release --notes-file <file> were allowed. Now they are refused where gh is a command's program word. Stdin forms (-, /dev/stdin, /dev/fd/N, <( … )), -f/--raw-field, and text that only mentions a flag (echo, grep, a heredoc body, a later command's own flag) stay allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): breaks commands: a harmless gh call refused, with the row's own toggle as the way out. On the leak side, the shapes the shared reader misreads (listed under Not a goal, tracked in rm floor: su feeding a heredoc to a shell is not read (su -s <shell> <user>, plain su <user>) #30593) let a gh upload through, as main does today.
  • Evidence checked (which sandbox result proves it): no sandbox change; this is a deny row before the sandbox. Evidence is test/test_exfil_gate_opt_out.py and test/test_shell_commands_heredoc.py through both audit_bash_exfiltration and is_denied, prove.py PROVEN on this head, and a mutant (the default stopping read) that fails 14 gh rows.
  • No regression:
    • Tools still work (which tools/commands were run, result): stdin forms and mention-only commands are allowed in the tests; the prepare-pr REST fallback and the code-review-sage poster now stream their body on stdin.
    • Backward compatible (old config / old data / old callers still work, how checked): the row can be switched off alone; catalog count 113 -> 114 and the golden fixture updated; no config format change.
    • Existing tests (which suites passed on this head): 940 passed across test_shell_commands_heredoc, test_exfil_gate_opt_out, test_denied_commands_security, test_security_gate_liveness, test_display_battery_rules_version, test_shell_heredoc_reader, test_denied_commands_security_rows, test_flake_pattern_ratchet.
  • How to undo: revert this single commit, or disable data-exfil-gh-file-body in Settings.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This head (684b0c5) cannot merge yet. The first item needs a maintainer decision before any code change.

  1. Open maintainer change request against the goal (src/kiro_crew/security/gh_file_body.py:1, src/kiro_crew/security/denied_rules_catalog.py:558)

    • Review 5804824533 (2026-11-06) asks to drop the new data-exfil-gh-file-body refusal. That covers the row, its wiring in deny_gate.py and exfil_bash.py, gh_file_body.py, the golden entry and the tests. It came after #30600 merged, so the earlier option B ruling does not cancel it.
    • Trigger: gh release create v1 --notes-file CHANGELOG.md, gh api graphql --field query=@q.graphql or gh api repos/o/r/pulls/1 -X PATCH --input body.json.
    • Outcome: at this head, audit_bash_exfiltration and is_denied both refuse all three. On main both allow them.
    • Later pushes changed the reader and kept the refusal, and no comment answers the review. #7365 also still records block or prompt as an open decision.
    • Fix: get an answer in this thread. bolichen97, do you withdraw the request, or should this PR close and the stdin text edits in ci.md and review_driver.py land on their own? The goal is frozen, so the author must not cut it down alone.
  2. The repo arm refuses flags that gh repo does not have (src/kiro_crew/security/gh_file_body.py:24, table at lines 36-42)

    • Trigger: gh repo edit o/r --field 'notes=@n.md' or gh repo create x --input f.
    • Outcome: gh exits with "unknown flag" before it sends a request, so the arm blocks nothing. The spec line at security.md:3291 and the body still say gh api|repo --input <file> is an upload path, which is not true.
    • Fix: remove "repo" from _GH_FILE_BODY_SUBCOMMANDS, delete its table and the test row at test_exfil_gate_opt_out.py:241, and change api|repo to api in the spec and the body.
  3. Shell re-spelling decoding goes past the Not a goal (src/kiro_crew/security/gh_file_body.py:57)

    • Trigger: $'g\x68' api ..., g''h api ..., g\h api ... or gh api /gists $'--\x69nput' f.
    • Outcome: these are refused only because of decoding added in one round to answer a "spelling Y reaches it too" finding. The PR's own Not a goal excludes re-spelled program names, and AGENTS.md calls this kind of change a review smell, not a fix.
    • Fix: delete the _decode_ansi_c_body import and the ansi state in _word_text (lines 14, 57, 62-64, 70). Reduce _may_run_gh to a plain "gh" substring test. Delete the re-spelling refused rows. Plain quote removal (--in''put) can stay.

Items 2 and 3 matter only if the refusal stays after item 1.

Optional:

  • Four recursive whole_words reads in shell_commands.py (lines 234, 236, 250, 368) have no pinning test. Rows such as x="$(gh api $(echo /gists) --input f)" would catch a regression.
  • The fail-closed branch of the is_denied floor (deny_gate.py:886-888) has no test. A test that patches _gh_file_body_flag to raise would pin it.
  • If the refusal stays, add a Reader line for the cron fire-time re-vet (mcp_cron_vet.py:vet_job_at_fire_time). Installed command jobs that use these flags will start to fail there.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Conflict-only rebase onto main 1dde2fb14f2d (head 684b0c5de928 -> 97ef64921526): the one conflict was the package line budget in test/test_security_gate_liveness.py, now main 35,040 + this PR 271 = 35,311. No code change.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 97ef649
  • What rule changed: new deny row data-exfil-gh-file-body (denied_rules.py, denied_rules_catalog.py, denied_rules_tables.py), matched by gh_file_body.py on shell words read from the shared shell_commands.read_commands(heredocs=True). The exfil gate (exfil_bash.py, re-exported in exfil.py) and the is_denied floor (deny_gate.py) run it while the row is enabled; the floor honours a per-session waiver like other rows.
  • Before -> after (what was allowed/blocked, now): before, gh api|repo --input <file>, gh's field flag reading a local file (k=@<file>) and gh release --notes-file <file> were allowed. Now they are refused where gh is a command's program word. Stdin forms (-, /dev/stdin, /dev/fd/N, <( … )), -f/--raw-field, and text that only mentions a flag (echo, grep, a heredoc body, a later command's own flag) stay allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): breaks commands: a harmless gh call refused, with the row's own toggle as the way out. On the leak side, the shapes the shared reader misreads (listed under Not a goal, tracked in rm floor: su feeding a heredoc to a shell is not read (su -s <shell> <user>, plain su <user>) #30593) let a gh upload through, as main does today.
  • Evidence checked (which sandbox result proves it): no sandbox change; this is a deny row before the sandbox. Evidence is test/test_exfil_gate_opt_out.py and test/test_shell_commands_heredoc.py through both audit_bash_exfiltration and is_denied, prove.py PROVEN on this head, and a mutant (the default stopping read) that fails 14 gh rows.
  • No regression:
    • Tools still work (which tools/commands were run, result): stdin forms and mention-only commands are allowed in the tests; the prepare-pr REST fallback and the code-review-sage poster now stream their body on stdin.
    • Backward compatible (old config / old data / old callers still work, how checked): the row can be switched off alone; catalog count 113 -> 114 and the golden fixture updated; no config format change.
    • Existing tests (which suites passed on this head): 940 passed across test_shell_commands_heredoc, test_exfil_gate_opt_out, test_denied_commands_security, test_security_gate_liveness, test_display_battery_rules_version, test_shell_heredoc_reader, test_denied_commands_security_rows, test_flake_pattern_ratchet.
  • How to undo: revert this single commit, or disable data-exfil-gh-file-body in Settings.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This head (97ef649) still cannot merge. The only push since my last review was a conflict-only rebase, so the blocking item below is unchanged.

  1. Open maintainer change request against the goal (security/denied_rules_catalog.py:557, security/gh_file_body.py:1)
    • Trigger: gh release create v1 --notes-file CHANGELOG.md, gh api graphql --field query=@q.graphql or gh api repos/o/r/pulls/1 -X PATCH --input body.json.
    • Outcome: at this head, both audit_bash_exfiltration and is_denied refuse all three. On main, both allow them. Piping on stdin (--input -) is still allowed.
    • Review 5804824533 asks to drop this refusal: the row, its wiring in deny_gate.py and exfil_bash.py, gh_file_body.py, the golden entry and the tests. No comment since then answers it. #7365 also still lists block versus prompt as an open decision.
    • Fix: a maintainer answer in this thread. bolichen97, do you withdraw the request, or should the PR shrink to the stdin edits in ci.md and review_driver.py? The goal is frozen, so the author should not cut it down alone.

Status of my earlier items:

  • Item 1 (open maintainer change request): still stands, see above.
  • Item 2 (the repo arm matches flags gh repo does not have, security/gh_file_body.py:24): still stands. It applies only if the refusal stays.
  • Item 3 (re-spelled program name decoding goes past the PR's Not a goal, security/gh_file_body.py:57): still stands. It applies only if the refusal stays.

Optional:

  • If the refusal stays, add Reader lines for the cron fire-time re-vet (mcp_cron_vet.py:vet_job_at_fire_time) and user script hooks (hook_runtime/script_hooks.py). Installed jobs and hooks that use these flags will start to fail there.
  • The body says the floor honours a per-session waiver. The row's category is credential-exfil, which makes it a self-guard, so a waiver never applies. Only turning the row off works. Please correct the text.
  • The added kiro_crew.security.shell_normalizer row in NOT_RULES (test/test_display_battery_rules_version.py:38) is not needed by this diff, and it loosens the import-closure ratchet. The gh_file_body row is needed and can stay.

…e sage poster

The prepare-pr REST fallback for a failed `gh pr edit`, and the code-review-sage
poster prompt, write their JSON payload to a temp file and pass `--input <file>`.
Both now pipe the JSON on stdin (`--input -`), so no temporary file is left in a
shared `/tmp`. Two small tests pin the shipped text.

No deny rule changes: refusing gh's body-from-file flags was dropped from this
change by the owner's decision; that question stays open in #7365.

Design and finding from #8353 by atomsbaza.

Co-authored-by: PISIT KOOLPLUKPOL <pisit.koolplukpol@outlook.com>
@iamwhatever

Copy link
Copy Markdown
Contributor Author

@bolichen97 @KiroCrewCaptain New head e7755668fee7. By the owner's decision (iamwhatever, a maintainer), the new refusal is gone: the data-exfil-gh-file-body row and its wiring, gh_file_body.py, the whole_words reader flag, the golden entry, their tests, and the shell_normalizer NOT_RULES row. What remains is the stdin edits in ci.md and review_driver.py, plus two tests that pin them (3 files, +34/-7). This answers review 5804824533. Refusing gh body-from-file flags is listed under Not a goal, and stays open in #7365.

🤖 AI-assisted comment 🤖

@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

This head (e775566) has no blocking findings, but it cannot merge yet. Two things are still open: a change request from @bolichen97, and PR Readiness.

Status of my earlier items:

  • Item 1 (open maintainer change request against the goal): fixed. The new refusal is gone, as review 5804824533 asked: the catalog row and its wiring, gh_file_body.py, the golden entry and their tests. The PR now holds only the stdin edits that review said were fine to keep.
  • Item 2 (the repo arm in gh_file_body.py): no longer applies. That file was removed.
  • Item 3 (decoding of re-spelled program names): no longer applies. That code was removed.

What this review checked on this head:

  • The diff matches the narrowed Goal. ci.md and review_driver.py now send their JSON on stdin with --input -, and no test, doc or spec on main still reads the old temp-file text.
  • Reverting either recipe hunk to main turns its new test red. Both tests only read files.
  • The ci.md recipe passes audit_bash_exfiltration, is_denied and is_sensitive_bash_command.
  • The head merges cleanly against main and against the two open PRs that touch the same files.

Still needed before merge:

  • @bolichen97, please re-review or dismiss your change request on this head.
  • 11 check runs failed on this head. The Static Ratchet Gate log shows HTTP 504 errors while downloading a tool. The other failures look like the same outage, not this diff. They need a rerun, and then PR Readiness needs to go green.

Optional:

  • test/test_exfil_gate_opt_out.py:235: the sage test reads the app's source by path from a core test. It will break when the app moves out of this repository. A better home is the app's own tests/test_review_driver.py, asserting on D.build_post_task(...) output.
  • test/test_exfil_gate_opt_out.py:245: the exfil gate allows the old temp-file form too, so this assertion passes with or without the change. Consider dropping it, or rewording it as a guard against a regression only.
  • review_driver.py:634: <print the payload JSON> does not say where the JSON comes from. Naming the extractor (read github_review_payload from data/results/<id>.json) keeps the model from typing the payload inline, where an apostrophe breaks the shell quoting.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Review-ready on e775566: all 102 checks pass and readiness: passed. Design and First Principles lanes PASS; GPT and Opus markers are fresh for this head. The earlier reds were the GitHub-wide HTTP 504 outage, cleared by a --failed rerun with no code change. Base moved +22 commits with no overlap on this PR's files. Only the two CHANGES_REQUESTED reviews remain.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving e775566 as maintainer. 102 checks pass. The six red ones are cancelled duplicates, and each has a newer passing run on this head. This replaces my change request on 7787396.

The point from that review is fixed: the new gh file-body refusal (gh_file_body.py, the data-exfil-gh-file-body catalog row and its deny-gate wiring) and its regexes are gone. What is left changes no gate:

  • The code-review sage poster prompt and the prepare-pr REST fallback now stream their JSON on stdin (--input -) instead of writing a temp file, so nothing is left in a shared /tmp.
  • Two tests pin both texts, and that the exfil gate allows the stdin form. The audit_bash_exfiltration call there reads an existing gate.

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.

5 participants