Repository navigation
fix(security): let a trusted grep or glob search for curl upload flags - #31727
Conversation
Sensitive Change ReviewSensitive files changed:
How to clear this check:
Only the author's comment counts this way. A reviewer can instead |
Security Scope Review -- ✅ PASSWhich legitimate operations does Verdict basis: adjudicated, zero confirmed regressions. Security scope review -- adjudicated candidates
No candidate flipped from allowed to refused. Scope-Verdict: PASS Reason: The diff does not make any guard stricter. Its only change to the gate is an early TIGHTENING: none. The mechanism that moved is the ADJUDICATED: 14 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: Rows were written for posix (10) and windows (4); none are UNADJUDICATED: The changed branch only applies to non-shell tool calls: a kiro-cli permission request for the [SCOPE-REVIEWED] 8d0cd95 |
4d76b1f to
ce66916
Compare
|
Rebased: main moved in docs/system-specs/modules/ (22 specs beside security.md) since this head went green (8dbdf04 -> 678769e); CI re-running. The rebase also picks up the main fixes for the two reds on the previous head ( [operator: bolichen97] |
A file search for the text `-d @` or `-F x=@` was refused by the exfil gate: with no command, the only text a grep or glob call is judged on is its title, which is the text it searches for, and the curl rows read it as a command line. A call whose host-trusted identity names the grep or glob built-in, with no MCP server and no command of any kind, runs no shell, so the exfil rule no longer judges it. Every other tier still does; an untrusted or MCP-served name, the code built-in and any call carrying a command keep the rule. Builds on #23845.
ce66916 to
8d0cd95
Compare
|
Rebased: main moved in docs/system-specs/modules/security.md and the specs beside it since this head went green (678769e -> 464b547); CI re-running. Every red on the previous head was a GitHub API rate limit on the runner (the AI review lanes and the dependency license gate reached no verdict), not a finding, so they re-run on this head. The change itself is unchanged. [operator: bolichen97] |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level concerns: the exemption depends on the host-verified identity of the grep or glob tool, not on the title text, and it only skips a rule that has no command line to judge. [DESIGN-REVIEWED] 8d0cd95 Description read[DESCRIPTION-READ] 61f551eb21be7c92c7d97107a0fbe5afad1e759d8c2a121b3049c60ad6d748fb 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS This is a fix for #23586 that sits at the mechanism level. It is a point patch: the sibling Notes
Inventory (3 items) — 2 justifiedIntent: let the agent use Grep/Glob to search for curl upload flag text without the exfil gate refusing it — FIX.
[FIRST-PRINCIPLES-REVIEWED] 8d0cd95 Description read[DESCRIPTION-READ] 86c209cfa667c18ecfe12451234f20a0fe159178a70a98eaf171597f1078ef12 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved for the on-call. Review lanes pass on 8d0cd95, no conflict, no open change request.
#31727) A file search for the text `-d @` or `-F x=@` was refused by the exfil gate: with no command, the only text a grep or glob call is judged on is its title, which is the text it searches for, and the curl rows read it as a command line. A call whose host-trusted identity names the grep or glob built-in, with no MCP server and no command of any kind, runs no shell, so the exfil rule no longer judges it. Every other tier still does; an untrusted or MCP-served name, the code built-in and any call carrying a command keep the rule. Builds on #23845. (cherry picked from commit de98390)
Problem / Motivation
Goal: a grep or glob file search for curl upload flag text such as
-d @or-F x=@is no longer refused by the data-exfiltration gate.Bug fix: searching the code for the literal text
-d @with the built-in Grep tool was refused withBlocked: command matches data-exfiltration pattern '-d @', though the search runs no shell and sends nothing off the host (#23586). The shell half of the report (date -u -d @<epoch>) already passes on main.Why it matters
Anyone working on code or docs that mention curl's upload flags (the exfil gate itself, a script that posts a file, these docs) cannot search for them; the agent sees a refusal and stops or works around it.
Not a goal
echo '-d @x') is judged exactly as on main.What changed (motivation → approach → change)
The exfil rule reads each call's text as a command line. A grep or glob call has no command, so the only text it is judged on is its title, which is the text it searches for, and the curl rows refused it.
The fix keys on who the tool is, never on the title text: a call whose identity kiro-cli stamped and this client verified (
identity_trusted), with no MCP server, naming thegreporglobbuilt-in (_HOST_SEARCH_BUILTIN_TOOLS, the identity the read-only tier already proves a file search with), and carrying no command at all (no recoveredcommand, nocommand/cmdargument).For such a call
_rule_exfilinhook_runtime/gate_tiers.pyreturns no refusal: there is no command line for it to judge.docs/system-specs/modules/security.mdrecords the rule next to the existing-d @carve-out.Backwards compatibility
Compatible: the change only lets a trusted grep or glob call with no command through one rule that refused it; nothing main accepts is refused.
Removes nothing: no path, record, key or public function is removed; the exfil rule still runs for every other call.
Tests
test/test_hooks_search_builtin_proof.py::TestTheExfilRuleDoesNotReadASearch, driven throughHookManager.on_tool_call: a trusted grep or glob whose title holds-d @,--data-binary=@or-F file=@is not refused. Still refused by theexfiltier: an untrusted grep name, a glob served by an MCP server, thecodebuilt-in, a trusted grep carrying acommandargument or a recovered shell command, and a shellecho '-d @x'.Proof: PROVEN test/test_hooks_search_builtin_proof.py::TestTheExfilRuleDoesNotReadASearch::test_a_trusted_search_for_exfil_text_is_not_refused[-d @-grep], test/test_hooks_search_builtin_proof.py::TestTheExfilRuleDoesNotReadASearch::test_a_trusted_search_for_exfil_text_is_not_refused[-d @-glob], test/test_hooks_search_builtin_proof.py::TestTheExfilRuleDoesNotReadASearch::test_a_trusted_search_for_exfil_text_is_not_refused[--data-binary=@-grep], test/test_hooks_search_builtin_proof.py::TestTheExfilRuleDoesNotReadASearch::test_a_trusted_search_for_exfil_text_is_not_refused[--data-binary=@-glob], test/test_hooks_search_builtin_proof.py::TestTheExfilRuleDoesNotReadASearch::test_a_trusted_search_for_exfil_text_is_not_refused[-F file=@-grep] (head 8d0cd95)
Determinism: the new class passed 20 of 20 runs at
-n0, 10 of 10 at-n 4 --dist loadgroup --max-worker-restart=2besidetest_exfil_carveouts.pyandtest_hooks_trusted_identity.py, and the whole file in a shuffled order (seed 29353, 65 tests).Manual verification
N/A — unit coverage through the real gate (
HookManager.on_tool_call) is sufficient; this is a backend gate change with no UI.Screenshots / video
N/A — no user-visible frontend surface is touched.
Related Issues
Closes #23586
Builds on #23845 by @chenmingwei23.
Sibling sweep
Swept: git grep -n "audit_bash_exfiltration(" -- src/kiro_crew
Sibling: src/kiro_crew/hook_runtime/gate_tiers.py:632 -- changed here
Sibling: src/kiro_crew/mcp_cron_vet.py -- not affected -- it judges a cron job's real shell command line
Sibling: src/kiro_crew/computer_use/policy.py -- not affected -- it judges text typed into the screen, not a search
Pattern harvest
Not generalizable: one rule reading one tool's search text as a command line; the gate already keys other exemptions on the same host-trusted identity.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)