Repository navigation
fix: stop a web fetch url being checked as a file path - #38791
bolichen97 wants to merge 1 commit into
Conversation
Sensitive Change ReviewSensitive files changed:
How to clear this check:
Only the author's comment counts this way. A reviewer can instead |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the exemption only applies to a positively identified harness web-fetch with trusted params, removes only the path tier, and takes nothing away. Notes
[DESIGN-REVIEWED] 24fd9ea Description read[DESCRIPTION-READ] a740f2abc77ad58fa69632d7a20602bee6c457c4a29285caf65f0f8d56db01c7 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 Nothing blocks. The fix targets the cause: during a resolver stall, the path tier was run over fetch strings that are never opened as files. The other fetch harnesses left out are listed in Notes
What this change shipsInventory (8 items) — 7 justifiedIntent: a Claude Code session's web fetch of a public page keeps working while the home-directory path resolver is stalled. FIX (#32640).
[FIRST-PRINCIPLES-REVIEWED] 24fd9ea Description read[DESCRIPTION-READ] 395ebc34bef1086c8164dd7c44ac80d6c8bf7b8d44887a50d73a351c1e64c7b5 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: |
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: This diff mostly loosens a guard. For a proven web fetch, it removes the path tier from the URL, the TIGHTENING: The ADJUDICATED: 15 candidates, 0 confirmed newly-refused PLATFORM COVERAGE:
The diff's only platform assumption is the UNADJUDICATED:
[SCOPE-REVIEWED] 24fd9ea |
|
Rebased: main moved in docs/system-specs/modules/security.md, src/kiro_crew/hook_runtime/gate_tiers.py, src/kiro_crew/hooks.py, src/kiro_crew/llm_helpers.py and src/kiro_crew/llm_helpers_parts/tool_approval.py since this head went green (eb15dd8 -> 98ad905); CI re-running. Rebased onto current main with no conflicts. On the new base the file line cap failed: main had grown |
7b72f61 to
76a166d
Compare
Sensitive change review
[operator: bolichen97] |
Code change approver recommendation: A person should decideWhy: the decider estimates a 12% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 483 lines, more than the 400 it may approve on its own. I recommend approving. The fix narrowly removes one check, the sensitive-path check, from a web fetch that is proven by its harness-stamped tool id, with params from the client's trusted copy and a top-level http/https URL with a host. Only three strings lose that check: the I checked the trust chain. Tier: 3, held for a person: merge conflict. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
76a166d to
72aa3fe
Compare
|
Rebased: main moved in docs/system-specs/modules/security.md, src/kiro_crew/hook_runtime/tool_identity.py, src/kiro_crew/hooks.py, src/kiro_crew/llm_helpers.py and test/test_hooks.py since this head went green (98ad905 -> faec552); CI re-running. GitHub reported this branch as conflicting: main edited the security spec bullet right above the one this change edits, so the only conflict was that one line, resolved by keeping main's bullet and this change's bullet as they each stood. Every line this change adds or removes is the same as on the previous head. Main's hook matcher change sits beside this one in |
A web fetch's URL, its "Fetch <url>" title and, on Claude Code, its prompt went through the sensitive-path tier of the permission gates, which resolves a string as a filesystem path. While the resolver cooldown under the home prefix is open, that tier refuses every check fail-closed, so a fetch of a public https page was refused as an unverifiable path. A fetch is proven when the harness-stamped tool id names that harness's own web-fetch built-in, the params are the client's trusted copy, and the url is an http or https URL with a host. For a proven fetch both gates skip the path tier on a title that is the URL, and the resolver splits the params by key: the string under the top-level url key, and on Claude Code's WebFetch only the string under the top-level prompt key, are judged by every tier except the path tier. A real WebFetch always sends that prompt, which goes to a model answering over the fetched page, never to a file or a tool, so sparing the URL alone still refused the call. The size ceiling, the bash and deny-rule tiers and the node cap still apply to those strings. Every other argument, a mapping or list under prompt, the same string under another key, a file:// URL, an unproven or untrusted fetch, MCP tools, sub-agent prompts and every non-fetch tool keep the full scan. Other harnesses' fetches keep the path tier on their other arguments until a captured frame vets them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72aa3fe to
24fd9ea
Compare
|
Rebased: main moved in docs/system-specs/modules/security.md, src/kiro_crew/hook_runtime/hook_manager.py, src/kiro_crew/hook_runtime/tool_identity.py, src/kiro_crew/hooks.py, src/kiro_crew/llm_helpers_parts/tool_approval.py and test/test_hooks.py since this head went green (faec552 -> 200131e); CI re-running. GitHub reported this branch as conflicting again on one line of the security spec: main dropped an issue reference from the same long bullet this change adds its paragraph to. Resolved by taking main's line and inserting this change's paragraph at the same place; every other added or removed line is the same as on the previous head. Main's app-agent change (#39500) adds an |
Problem / Motivation
Goal: A Claude Code web fetch of a public page is no longer refused by the sensitive-path check while that check is stalled under the home directory.
On the Claude Code backend, a
WebFetchof a publichttps://page was refused with "the path could not be verified against the sensitive-path list within the resolver budget ... Path: 'Fetch https://example.com/docs/some-page'". The permission gates ran the fetch's title, itsurland itspromptthrough the filesystem sensitive-path tier, which resolves a string as a path. While the resolver cooldown under the home prefix is open, that tier refuses every check fail-closed, so a URL that can never match the sensitive-path list was refused as an unverifiable path. Sparing the URL alone is not enough: a real WebFetch always sendspromptbesideurl(captured frametest/fixtures/acp_frames/claude/builtins-bash-edit-webfetch-live.jsonl), and the gate then refused it quotingPath: 'What is the page title?'.Why it matters
Any Claude Code session on a loaded host, or one with a home directory that reaches a slow or network volume, loses every web fetch for the length of a resolver cooldown, with a message that blames a "path" the user never named. The agent retries and is refused again, and the turn stalls on a read-only network call.
Not a goal
web_fetchframe is captured, with__tool_use_purpose,urlandmode, but no harness tool table row names it), so they get no fetch exemption at all: a stall still refuses them on the title (e.g.Fetching web content) and on every argument until their arguments are vetted the same way. The defaultkirochoice runs on KAS, soCloses #32640covers the Claude Code case the issue reports.urlof the opencode, mimocode, strands and antigravity web-fetch tools. Theirurlis spared; every other argument keeps the path tier until a captured frame vets it. On antigravity a call whosetool_callframe stated no name is named from its kind, so there afetch-kind call is proven by that kind (the spec says so).Task/Agent), spawn briefs and cron prompts: they go to an agent with tools and keep the path tier.What changed (motivation → approach → change)
Symptom: a proven web fetch was refused during a home-prefix resolver stall. Cause: both gates path-resolve the title, and the resolver's every-string tool_input loop path-resolves every argument, including the URL and the summarising prompt, neither of which is ever opened as a file.
A fetch is proven when its harness-stamped
harness_tool_idnames that harness's own web-fetch built-in, the params are the client's trusted copy, and the top-levelurlis anhttp/httpsURL with a host (proven_fetch_urlinhook_runtime/tool_identity.py, which asks the harness tool table throughis_harness_web_fetchinagent_sdk/__init__.py, carried to the hook gate as aToolCallfact and anon_tool_callkeyword inhook_runtime/hook_manager.py;hooks.pyre-exports it and bindsurlsplitfor the composed owners). For a proven fetch, both gates skip the path tier on a title that is that URL orFetch <url>(hook_runtime/gate_tiers.py,_title_denial). The resolver (llm_helpers_parts/tool_approval.py) splits the trusted params BY KEY, the way it already splits an MCP document body: the string underurl, and onclaude#WebFetchonly the string directly underprompt(the one row ofFETCH_PATH_FREE_FIELDSinplatform/tool_paths.py, sourced from the captured frame), are judged with_first_tool_input_denial(path_rule=False)inllm_helpers_parts/tool_input_denials.py, the mirror of the existingcommand_rules=False. Those strings keep the size ceiling, the bash tier and the deny-rule tier; the rest of the params keep the full scan and the node cap.llm_helpers.pylists the three names its owners now import for type checkers.The prompt leaves the path tier while spawn briefs and
Taskprompts keep it because of who reads it: a WebFetch prompt goes to a model answering over the fetched page (the capture's response isbytes/code/result/url), a spawn brief goes to an agent with tools. The security spec (docs/system-specs/modules/security.md) states the scope, what still applies, and the residuals above.Backwards compatibility
Compatible: the change only stops the path tier refusing two strings of a proven fetch; every call that is approved today is still approved.
Removes nothing: no key, record, validator or public function is removed; the gates accept strictly more calls, and only for the URL and claude WebFetch's prompt.
Tests
test/test_llm_helpers_non_shell_gate.py::TestAProvenFetchUrlIsNotAPath, with a real home-prefix cooldown seeded in the resolver where a case says "stall":AUTO_APPROVEandHOOK_BASED(and the url-only shape);https:link (the by-key condition); a mapping or list underprompt; a prompt that resolves to a credential file through a plantedhttps:link on an untrusted-params frame, an unproven frame, a non-fetch frame, claudeAgentand claudeTask; the same prompt under a stall on another harness's proven fetch (opencode#webfetch); afile://URL and a URL with no host; an IMDS URL in the prompt (bash tier) and; rm -rf /in the prompt (deny tier); an oversize prompt; a node-cap overflow;test/test_hooks.py::TestHookGateKwargscovers the newToolCallfact.The planted-
https:-link tests skip on Windows: a:cannot be part of an NTFS name, so the link cannot exist there; the key-based sparing still runs there through the unlisted-key and prompt cases.On Linux the class passed 20 repeated runs (33 passed each), and the whole file passed in three shuffled orders (70 passed each).
Proof: PROVEN test/test_hooks.py::TestHookGateKwargs::test_maps_every_event_field_verbatim, test/test_hooks.py::TestHookGateKwargs::test_missing_and_none_fields_take_the_gate_defaults, test/test_hooks.py::TestHookGateKwargs::test_the_toolcall_from_an_event_is_the_whole_gate_input, test/test_llm_helpers_non_shell_gate.py::TestAProvenFetchUrlIsNotAPath::test_a_fetch_is_not_refused_by_a_resolver_stall[ToolApprovalPolicy.AUTO_APPROVE], test/test_llm_helpers_non_shell_gate.py::TestAProvenFetchUrlIsNotAPath::test_a_fetch_is_not_refused_by_a_resolver_stall[ToolApprovalPolicy.HOOK_BASED] (head a773a2dc2673)
Manual verification
On a disposable Ubuntu Linux host (Python 3.12.3), a driver replayed the live-captured claude WebFetch frames through the client's real parser (
_dispatch.parse_session_update/build_permission_event, claude backend, every provenance cache) into_resolve_permissionwith a realHookManager, with a real home-prefix cooldown seeded in the resolver's degraded table, at both policies. On the base commit (main276eaffebdb5) the captured url+prompt frame under the stall was refused at both policies quotingPath: 'Fetch https://example.com', the issue's message. Ona773a2dc2673(this change on that base), with the frames rewritten per case, every row PASS at bothAUTO_APPROVEandHOOK_BASED:Real-machine verification
Machine: EC2 m7i.2xlarge, Ubuntu 24.04 x86_64, 8 vCPU / 32 GiB, Python 3.12.3; a disposable verification host with no inbound rules, about 2.9 h for this job (about $1.20 on-demand)
Before (main 276eaff):
KIROCREW_HOME=$(mktemp -d -p $HOME) python driver.py(the smoke driver above, captured url+prompt WebFetch under the stall) -> refused at bothAUTO_APPROVEandHOOK_BASED:Blocked: the path could not be verified against the sensitive-path list within the resolver budget ... Path: 'Fetch https://example.com'After (this change on main 276eaff, commit a773a2dc2673): the same command -> all 30 rows PASS (15 cases x 2 policies, the table above); the head commit 24fd9ea is the same patch (identical
git patch-id) on main 200131e, whose 34 further commits change none of this change's code or test filesCleanup: no gateway or other process was left running; the isolated data homes and planted links are temporary directories on a pooled verification host still serving other jobs, which the pool terminates once idle, taking its disk with it; no key pair was made (session access only)
Related Issues
Closes #32640
Sibling sweep
Swept:
git grep -nE "sensitive_path_refusal\(" -- src/kiro_crew/llm_helpers_parts src/kiro_crew/hook_runtimeandgit grep -n '"web_fetch"' -- src/kiro_crew/acp/harness_tool_names.pySibling:
src/kiro_crew/llm_helpers_parts/tool_input_denials.py-- changed hereSibling:
src/kiro_crew/llm_helpers_parts/tool_approval.py-- changed hereSibling:
src/kiro_crew/hook_runtime/gate_tiers.py-- changed hereSibling:
src/kiro_crew/acp/harness_tool_names.py-- not affected -- deferred, not fixed: KAS and kiro-cli fetches have no row to prove them, and other harnesses' non-url fetch arguments are unvetted; listed under Not a goalPattern harvest
Rule candidate: review-prompt
Pattern: an exemption that matches a string by its value instead of by the argument key it sits under spares that same string under any key in the payload
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commitsContribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.