Skip to content

fix: surface proxy host refusals at the spawn grant - #407

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/proxy-refusal-on-grant
Aug 19, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
fix/proxy-refusal-on-grant

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Why

#406 merged the first commit only. That version special-cased failed commands in the session loop when the proxy had refused a host, and the tests were named around gh.

The follow-up that actually moved the fact to the spawn grant never landed.

This PR

The CONNECT proxy already records refused hosts. The EgressGrant used to route a confined spawn now carries that control plane. After any confined process exits non-zero:

  1. Drain hosts the proxy refused on that spawn.
  2. If that list is non-empty → SandboxDenied { denied_host } (HITL to allow the host, retry confined).
  3. If the proxy allowed the CONNECT and the remote still failed → ordinary tool failure.

Session HITL stays generic. No per-app tools. gh, curl, cargo, npm all hit the same path.

Removes the GitHub-named test tool that landed in #406.

Test plan

  • cargo test --package forge-tools --lib proxy_refusal
  • cargo test --package forge-tools --lib without_a_proxy_refusal
  • cargo test --package forge-core --lib a_denied_host
  • cherry-pick applied cleanly onto d3cf438
  • Confined command to a blocked host (any client) should prompt to allow the host

A confined process can fail with whatever the client printed (HTTP 403,
"token invalid", "Forbidden"). That is not a per-app problem. The
CONNECT proxy already recorded the refused host; the grant used to
route the spawn now carries that log so bash and exec_command return
SandboxDenied. Session HITL stays generic: grant the host, retry
confined. A real 403 after an allowed CONNECT still fails through.
@github-actions
github-actions Bot enabled auto-merge (squash) August 19, 2026 18:07
@github-actions
github-actions Bot merged commit 50a3a4b into main Aug 19, 2026
8 checks passed
mohitranka added a commit that referenced this pull request Aug 21, 2026
A confined process can fail with whatever the client printed (HTTP 403,
"token invalid", "Forbidden"). That is not a per-app problem. The
CONNECT proxy already recorded the refused host; the grant used to
route the spawn now carries that log so bash and exec_command return
SandboxDenied. Session HITL stays generic: grant the host, retry
confined. A real 403 after an allowed CONNECT still fails through.
mohitranka added a commit that referenced this pull request Sep 11, 2026
A confined process can fail with whatever the client printed (HTTP 403,
"token invalid", "Forbidden"). That is not a per-app problem. The
CONNECT proxy already recorded the refused host; the grant used to
route the spawn now carries that log so bash and exec_command return
SandboxDenied. Session HITL stays generic: grant the host, retry
confined. A real 403 after an allowed CONNECT still fails through.
mohitranka added a commit that referenced this pull request Sep 11, 2026
A confined process can fail with whatever the client printed (HTTP 403,
"token invalid", "Forbidden"). That is not a per-app problem. The
CONNECT proxy already recorded the refused host; the grant used to
route the spawn now carries that log so bash and exec_command return
SandboxDenied. Session HITL stays generic: grant the host, retry
confined. A real 403 after an allowed CONNECT still fails through.
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.

1 participant