Skip to content

fix: stop a web fetch url being checked as a file path - #38791

Open
bolichen97 wants to merge 1 commit into
mainfrom
fix/32640-fetch-url-path-tier
Open

bolichen97 wants to merge 1 commit into
mainfrom
fix/32640-fetch-url-path-tier

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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 WebFetch of a public https:// 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, its url and its prompt through 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 sends prompt beside url (captured frame test/fixtures/acp_frames/claude/builtins-bash-edit-webfetch-live.jsonl), and the gate then refused it quoting Path: '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

  • KAS and kiro-cli fetches. Neither has a qualified harness tool id the client can prove (kiro-cli's web_fetch frame is captured, with __tool_use_purpose, url and mode, 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 default kiro choice runs on KAS, so Closes #32640 covers the Claude Code case the issue reports.
  • The fetch arguments other than url of the opencode, mimocode, strands and antigravity web-fetch tools. Their url is spared; every other argument keeps the path tier until a captured frame vets it. On antigravity a call whose tool_call frame stated no name is named from its kind, so there a fetch-kind call is proven by that kind (the spec says so).
  • The "User refused permission" wording of the refusal.
  • The resolver cooldown itself, its length, or how a stall is detected.
  • Sub-agent prompts (claude 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_id names that harness's own web-fetch built-in, the params are the client's trusted copy, and the top-level url is an http/https URL with a host (proven_fetch_url in hook_runtime/tool_identity.py, which asks the harness tool table through is_harness_web_fetch in agent_sdk/__init__.py, carried to the hook gate as a ToolCall fact and an on_tool_call keyword in hook_runtime/hook_manager.py; hooks.py re-exports it and binds urlsplit for the composed owners). For a proven fetch, both gates skip the path tier on a title that is that URL or Fetch <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 under url, and on claude#WebFetch only the string directly under prompt (the one row of FETCH_PATH_FREE_FIELDS in platform/tool_paths.py, sourced from the captured frame), are judged with _first_tool_input_denial(path_rule=False) in llm_helpers_parts/tool_input_denials.py, the mirror of the existing command_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.py lists the three names its owners now import for type checkers.

The prompt leaves the path tier while spawn briefs and Task prompts keep it because of who reads it: a WebFetch prompt goes to a model answering over the fetched page (the capture's response is bytes/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":

  • the captured url+prompt claude WebFetch, built by the client's own parser from the capture, is approved under the stall at AUTO_APPROVE and HOOK_BASED (and the url-only shape);
  • still refused: a credential path under an unlisted key; the proven URL's own string under an unlisted key through a planted https: link (the by-key condition); a mapping or list under prompt; a prompt that resolves to a credential file through a planted https: link on an untrusted-params frame, an unproven frame, a non-fetch frame, claude Agent and claude Task; the same prompt under a stall on another harness's proven fetch (opencode#webfetch); a file:// 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::TestHookGateKwargs covers the new ToolCall fact.

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_permission with a real HookManager, with a real home-prefix cooldown seeded in the resolver's degraded table, at both policies. On the base commit (main 276eaffebdb5) the captured url+prompt frame under the stall was refused at both policies quoting Path: 'Fetch https://example.com', the issue's message. On a773a2dc2673 (this change on that base), with the frames rewritten per case, every row PASS at both AUTO_APPROVE and HOOK_BASED:

captured url+prompt WebFetch                stall     approved
url-only WebFetch                           stall     approved
captured url+prompt / url-only WebFetch     no stall  approved
file:// URL on a trusted WebFetch           stall     refused  Blocked: the path could not be verified ...
same frame stamped claude#Read              stall     refused  Blocked: the path could not be verified ... Path: 'Fetch https://example.com'
claude#Task with the same prompt            stall     refused  Blocked: the path could not be verified ... Path: 'Task'
WebFetch of https://:80/docs (no host)      stall     refused  Blocked: the path could not be verified ...
https://.aws/credentials, planted https: link (no stall):
  as the url of a claude#Read                         refused  Blocked: sensitive path in tool_input: https://.aws/credentials
  under an unlisted key of a proven fetch             refused  Blocked: sensitive path in tool_input: https://.aws/credentials
  as a claude#Task prompt                             refused  Blocked: sensitive path in tool_input: https://.aws/credentials
  as the prompt of an untrusted-params WebFetch       refused  Blocked: sensitive path in tool_input: https://.aws/credentials
IMDS URL as the url / inside the prompt     no stall  refused  Blocked: command accesses IMDS endpoint (169.254.169.254 ...)
~/.ssh/id_rsa under an unlisted key         no stall  refused  Blocked: sensitive path in tool_input: ~/.ssh/id_rsa

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 both AUTO_APPROVE and HOOK_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 files
Cleanup: 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_runtime and git grep -n '"web_fetch"' -- src/kiro_crew/acp/harness_tool_names.py
Sibling: src/kiro_crew/llm_helpers_parts/tool_input_denials.py -- changed here
Sibling: src/kiro_crew/llm_helpers_parts/tool_approval.py -- changed here
Sibling: src/kiro_crew/hook_runtime/gate_tiers.py -- changed here
Sibling: 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 goal

Pattern 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

  • A Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commits
  • 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; see the Licensing section of CONTRIBUTING.md.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/hook_runtime/gate_tiers.py

  • src/kiro_crew/hook_runtime/hook_manager.py

  • src/kiro_crew/hook_runtime/tool_identity.py

  • src/kiro_crew/hooks.py

  • @bolichen97 comment: does not name the current head 24fd9ea; post it again for this head

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: 24fd9eabd74940c88ab2271b007119d6625d59ee
- 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 17, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 24fd9eabd74940c88ab2271b007119d6625d59ee 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 17, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

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

  • KAS and kiro-cli fetches, the default kiro path, still stall on the title and every argument. That gap is scoped out under ## Not a goal. A follow-up should add a harness tool table row for kiro-cli's captured web_fetch frame, so the same proven_fetch_url covers it with no new mechanism.

[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 .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 17, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 24fd9eabd74940c88ab2271b007119d6625d59ee — 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 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 ## Not a goal.

Notes

  • Item 6 — one consumer, generalized: FETCH_PATH_FREE_FIELDS: Mapping[str, frozenset[str]] = MappingProxyType({"claude#WebFetch": frozenset({"prompt"})}) is a lookup table with only one entry, read from one place (tool_approval.py). Subtraction: replace the table with a direct event.harness_tool_id == "claude#WebFetch" check that adds "prompt" in _resolve_permission, and delete the constant and its llm_helpers.py type-check import.

What this change ships

Inventory (8 items) — 7 justified

Intent: a Claude Code session's web fetch of a public page keeps working while the home-directory path resolver is stalled. FIX (#32640).

  1. A proven fetch titled with its URL or Fetch <url> is no longer refused by the path check in either gate. — justified
  2. The url argument of every proven harness fetch (claude, opencode, mimocode, strands, antigravity) skips the path check. — justified
  3. The prompt argument of claude WebFetch skips the path check, while the size, bash and deny checks still run on it. — justified
  4. On antigravity, an unnamed call of kind fetch counts as a proven fetch. — justified
  5. The hook gate gets a new fetch_url field on ToolCall and a matching on_tool_call keyword. — justified
  6. New FETCH_PATH_FREE_FIELDS lookup table in platform/tool_paths.py. — one consumer, generalized
  7. New path_rule=False mode for _first_tool_input_denial. — justified
  8. New is_harness_web_fetch helper in agent_sdk, plus the matching section of the security spec. — justified

[FIRST-PRINCIPLES-REVIEWED] 24fd9ea

Description read

[DESCRIPTION-READ] 395ebc34bef1086c8164dd7c44ac80d6c8bf7b8d44887a50d73a351c1e64c7b5

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 17, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 24fd9ea

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

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

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 24fd9ea

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

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

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

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 Fetch <url> title and claude's prompt; the size, bash, deny and node-cap tiers still apply. The shell deny composite (sensitive-bash, exfil, deny-rules) is not touched, so the 15 shell candidates are expected to come back unchanged. The one new refusal is the _TARGET_PATH_MAX_NODES walk on a proven fetch's params, which is a tool-argument gate the classifier cannot measure; it is named under UNADJUDICATED below.

TIGHTENING: The _resolve_permission tool_input scan of a proven fetch now walks its trusted raw params with command_shaped_strings instead of _extract_tool_input_strings. That walk is capped at 10,000 nodes and refuses when it hits the cap. -- The threat it refuses is a fetch payload too large to scan completely. It lives in the hunk elif _fetch_keys and isinstance(event.raw_tool_params, dict): _rest_params, _path_free_strings = split_document_bodies(...); _scoped_strings = command_shaped_strings(_rest_params, body_keys=frozenset()); _scoped_truncated = _scoped_strings.truncated, and the test test_the_node_cap_still_refuses_a_fetch pins it.

ADJUDICATED: 15 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE:

  • posix: curl, wget and loopback curl spellings of the shell operation next to a fetch.
  • windows: curl.exe, Invoke-WebRequest and Invoke-RestMethod spellings of the same operations.
  • any: the strings the bash and deny tiers still read on a proven fetch: a bare https URL, the Fetch <url> title, the captured prompt, prose prompts that name commands or pipelines, and URLs that mention credentials or a destructive command only as page or query text.

The diff's only platform assumption is the https: planted-link test, skipped on NTFS. The URL proof itself (urlsplit, scheme http/https with a host) is the same on every host, so no platform's spelling goes unprobed.

UNADJUDICATED:

  • The guard: the tool_input scan in _resolve_permission (llm_helpers_parts/tool_approval.py). Its call path is a claude permission frame → _dispatch.build_permission_event → proven_fetch_url(event) (a claude#WebFetch/opencode#webfetch/antigravity#read_url_content id, trusted params, an http(s) url with a host) → _fetch_keys → the new split_document_bodies and command_shaped_strings branch → the 10,000-node cap (truncated) → "Blocked: tool arguments too large to security-scan".
  • What it newly refuses: before this change, the same frame went through _extract_tool_input_strings, which has no node cap. So a proven fetch with more than 10,000 param nodes is newly refused. Inputs I would have submitted:
    • a claude WebFetch with only url and prompt, as in the capture: 3 nodes, no refusal expected;
    • an opencode webfetch with url, format and timeout;
    • an Antigravity read_url_content with url alone.
  • Is it real? No captured harness frame sends structured fetch params anywhere near the cap, so I cannot show a legitimate input that loses the call.
  • Hook gate: _rule_sensitive_path in hook_runtime/gate_tiers.py only gains an exemption, names_fetch_url, so it refuses nothing new.

[SCOPE-REVIEWED] 24fd9ea

@bolichen97

Copy link
Copy Markdown
Contributor Author

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 src/kiro_crew/hook_runtime/gate_tiers.py to 1,997 lines and this change took it to 2,004, over the 2,000-line cap. Fixed by checking the fetch URL title inside the path rule through a small ToolCall.names_fetch_url helper instead of a separate property; the behaviour is unchanged and the file is at 1,998 lines. The related tests and the static gates pass locally on the rebased change. Every other lane was green on the previous head; the sensitive-change review still needs the reasoning record and a maintainer's review for the new head 76a166d.
[operator: bolichen97]

@bolichen97
bolichen97 force-pushed the fix/32640-fetch-url-path-tier branch from 7b72f61 to 76a166d Compare November 19, 2026 22:14
@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 76a166d
  • What rule changed: the filesystem sensitive-path tier of the tool permission gates no longer resolves three strings of a proven web fetch as a local path: a title that is the fetch URL or Fetch <url>, the string under the top-level url key, and, on Claude Code's WebFetch only, the string directly under the top-level prompt key. A fetch is proven only by the harness tool id naming that harness's own web-fetch built-in (on Antigravity, a call whose tool_call frame stated no name is named from its kind), trusted params, and an http/https URL with a host. The size ceiling, the bash tier (IMDS) and the deny-rule tier still read those strings, and the node cap still applies to the other params; every other key, a non-string prompt, file:// and hostless URLs, untrusted or unproven frames, MCP tools, sub-agent prompts and every non-fetch tool keep the full scan.
  • Before -> after (what was allowed/blocked, now): before, a home-prefix resolver stall refused a Claude Code WebFetch fail-closed as an unverifiable path. After, a proven Claude Code WebFetch of an http(s) URL is allowed through that stall; nothing that was refused for a sensitive-path match becomes allowed except the URL title, url or prompt string of a proven fetch, which is opened over the network or read by the model answering over the page, never opened as a file.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): if a call that is not a web fetch were taken as a proven one, a sensitive local path written as its URL title, its url string or (Claude Code WebFetch only) its top-level prompt string would skip the sensitive-path tier; the bash tier (IMDS), the deny-rule tier and the size ceiling would still read it, and every other key keeps the full scan. Nothing is newly refused (Security Scope Review on this head: 0 newly refused on Linux, macOS and Windows), so no command breaks and no user is locked out.
  • Evidence checked (which sandbox result proves it): the smoke ran on an earlier commit of this change, d344d187cd49 (base eb15dd8), not on this head. This head differs from it in two ways: it is rebased across 550 commits of main onto 98ad905, and, to keep hook_runtime/gate_tiers.py under the file line cap, the hook gate's URL-title check moved from a GateFacts.exempt_url property into a ToolCall.names_fetch_url method that _rule_sensitive_path calls (plus docstring and spec wording). An independent review of that refactor found the same answer for every target, title and fetch URL; the PR's test changes are identical in both commits, and Backend Tests and New-test stability pass in CI on this head. What ran, on a disposable Ubuntu Linux host (Python 3.12.3), in-process against the real gate (no OS sandbox is involved in this tier), on d344d187cd49: the live-captured Claude Code WebFetch frames, rewritten per case, through the client's own parser (parse_session_update / build_permission_event, seven provenance caches) into _resolve_permission with a real HookManager, an isolated data home, a real home-prefix cooldown seeded in the resolver and a frozen resolver clock, at AUTO_APPROVE and HOOK_BASED. On the base commit eb15dd8 the captured url+prompt frame under the stall was refused quoting Path: 'Fetch https://example.com'. On d344d187cd49 it is approved under the stall, as is the url-only frame; still refused: a file:// URL and a hostless URL on a trusted claude#WebFetch, which are not proven fetches, the same frame stamped claude#Read, claude#Task with the same prompt (all under the stall); https://.aws/credentials through a real planted https: -> home symlink as a Read's url, under an unlisted key of a proven fetch, as a Task prompt and as the prompt of an untrusted-params WebFetch; an IMDS URL as the url and inside the prompt; ~/.ssh/id_rsa under an unlisted key. All 30 rows as expected.
  • No regression:
    • Tools still work (which tools/commands were run, result): on the same host and driver, on d344d187cd49, a proven Claude Code WebFetch with url and prompt, and with url only, was approved at AUTO_APPROVE and HOOK_BASED both with the resolver stall and without it. In CI on this head the E2E lanes, Real Adapter Contract Tests, Integration (in-process gateway) and Denial Differential on Linux, macOS and Windows passed.
    • Backward compatible (old config / old data / old callers still work, how checked): no config, data or file format changes; the one new HookManager.on_tool_call keyword, fetch_url, defaults to empty, so an existing caller keeps the full scan it had, and the agent_sdk helper is_harness_web_fetch is additive. Checked by reading the diff and by Backend Tests passing on this head.
    • Existing tests (which suites passed on this head): on the host, on d344d187cd49 (not this head): 65 of the 66 entries of the repository's prepare-pr gate profile exit 0, including mypy, flake8, isort, the agent-SDK boundary gate, the file line cap and the frontend build. The one red entry, the backend related set (3,096 files), ran its first batch with one red, test/test_apps_worker_slots.py::test_the_raised_limit_wake_up_is_held_until_it_finishes, which failed the same way on the base with the same targets and passes alone on both sides (neither the test nor its module is in the diff), and its later batches did not run on the commit. Three extra checks then passed there: semgrep 1.78.0 diff-scoped with 0 findings; the flake-pattern ratchet; and six related test files, the two this diff touches (test/test_hooks.py, test/test_llm_helpers_non_shell_gate.py) plus four it does not (test/test_llm_helpers_facade.py, test/test_llm_helpers_tool_input_offload.py, test/test_hooks_path_tier.py, test/test_hooks_composition_contract.py): 360 passed. The fix's test class passed 20 of 20 runs and its file passed in 3 shuffled orders (70 each); prove.py --base origin/main: PROVEN. In CI on this head: Backend Tests (3.12, 8 shards), Backend Tests (Windows, 8 shards), Backend Tests (IPv6, ubuntu-latest and windows-latest), Backend Tests (namespace sandbox), Backend Tests (crew container), Frontend Tests (4 shards), New-test stability (ubuntu-latest and windows-latest), Flake Pattern Ratchet, SAST (Semgrep) and Coverage Gate passed.
  • How to undo: revert the single commit 76a166d; there is no data or config migration.
  • Residuals a reviewer should know: a Kiro (KAS), kiro-cli, goose or codex fetch has no web-fetch tool id the client can prove, so a stall still refuses it; the opencode, mimocode, strands and antigravity fetches spare only their URL title and url; the smoke did not run on this head (see Evidence checked); no Windows or macOS host ran the smoke or the host gates (the four planted-link tests skip on Windows, where a : cannot be part of a file name).

[operator: bolichen97]

@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Nov 20, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: 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 Fetch <url> title, the string under url, and, on claude#WebFetch only, the string directly under prompt. The params are split by key with the existing split_document_bodies, so the same string under any other key, or a mapping or list under prompt, is still scanned in full. The size ceiling, bash/IMDS check, deny rules and node cap all still apply to the spared strings.

I checked the trust chain. harness_tool_id comes from adapter-written _meta or the cached name from the tool_call frame, never from the model's payload, and split_harness_tool_id rejects any id whose backend has no tool table. In the hook gate, the change only touches the title target. _tier_param_paths still reads only path-keyed arguments, so url and prompt never reached it. Nothing is newly refused, nothing persists, and other callers of on_tool_call default to an empty fetch_url, so they keep the full check. The

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 76a166d30f · 483 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@bolichen97
bolichen97 force-pushed the fix/32640-fetch-url-path-tier branch from 76a166d to 72aa3fe Compare November 20, 2026 04:57
@bolichen97

Copy link
Copy Markdown
Contributor Author

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 hooks.py, hook_runtime/tool_identity.py and test/test_hooks.py, so the change was gated again on main faec552 before the push: the project's gate list, semgrep, the flake-pattern ratchet, the touched test files, the fix's test class 20 of 20 runs and three shuffled orders, prove.py PROVEN, and the captured WebFetch smoke with all 30 rows as expected. Two checks were red on the verification host and equally red on a clean checkout of that main commit, in files this change does not touch: test/test_host_git_repo_exec_neutralization.py::TestCliUpdate::test_up_to_date_diff_runs_no_textconv_planted_during_the_fetch (with a teardown error in test/test_live_target_pointer_visibility.py), and the frontend bundle-size budget, where website/ is identical to main. The sensitive-change review needs its record again for the new head 72aa3fe.
[operator: bolichen97]

@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: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 20, 2026
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>
@bolichen97
bolichen97 force-pushed the fix/32640-fetch-url-path-tier branch from 72aa3fe to 24fd9ea Compare November 21, 2026 08:23
@bolichen97

Copy link
Copy Markdown
Contributor Author

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 app_run field and keyword next to this change's fetch_url in the hook files, so the change was gated again before the push, on this patch on main 276eaff (commit a773a2dc2673): the project's gate list, semgrep, the flake-pattern ratchet, the touched test files, the fix's test class 20 of 20 runs and three shuffled orders, prove.py PROVEN, and the captured WebFetch smoke with all 30 rows as expected (the captured url+prompt fetch is refused under the stall on that main, quoting Path: 'Fetch https://example.com', and approved with the change). One check was red on the verification host and equally red on a clean checkout of that main commit, in files this change does not touch: test/test_host_git_repo_exec_neutralization.py::TestCliUpdate::test_up_to_date_diff_runs_no_textconv_planted_during_the_fetch (with a teardown error in test/test_live_target_pointer_visibility.py). The pushed head 24fd9ea is the same patch (identical git patch-id) on main 200131e; main's 34 commits in between change none of this change's code, test or gate files. The sensitive-change review needs its record again for the new head 24fd9ea.
[operator: bolichen97]

@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 21, 2026
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebFetch of a public URL is refused by the sensitive-path stall: the path tier resolves the URL as a file path

2 participants