Skip to content

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

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/gh-proxy-403-as-auth
Aug 19, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
fix/gh-proxy-403-as-auth

Conversation

@mohitranka

@mohitranka mohitranka commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Architecture

Enforcement already knew the host. The CONNECT proxy records every refused destination. The spawn used an EgressGrant that only had a port and a socket, so a failed command could only become SandboxDenied if explain_denial recognised a string in stderr.

Clients do not print Forge Sandbox Denied. They print their own 403 / auth / Forbidden text. The session then recorded a normal tool failure and the model chased the wrong fix.

The grant now shares the proxy control plane. After a confined spawn exits non-zero:

  1. Drain any host the proxy refused during that spawn.
  2. If explain_denial matches (FS or recognised network strings), still SandboxDenied, with that host if we have one.
  3. Else if the proxy refused a host, still SandboxDenied for that host.
  4. Else it is a real command failure (including a 403 from an already-allowed host).

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

Session HITL is unchanged in shape: SandboxDenied with denied_host asks to allow the host and retries confined.

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
  • cargo clippy --package forge-tools --package forge-core --all-targets -- -D warnings
  • Confined command to a blocked host (any client) should prompt to allow the host, not look like app-specific auth

gh prints "authentication token is invalid" / GraphQL 403 when the
CONNECT proxy refuses api.github.com, because it never sees
"Forge Sandbox Denied". If the proxy recorded a denied host during
the command, pause for a host allow instead of handing the model a
fake auth failure. A real GitHub 403 after an allowed CONNECT still
fails through.
@github-actions
github-actions Bot enabled auto-merge (squash) August 19, 2026 18:00
@github-actions
github-actions Bot merged commit d3cf438 into main Aug 19, 2026
8 checks passed
@mohitranka mohitranka changed the title fix: treat proxy-refused gh 403s as a host grant, not bad auth fix: surface proxy host refusals at the spawn grant Aug 19, 2026
mohitranka added a commit that referenced this pull request Aug 21, 2026
gh prints "authentication token is invalid" / GraphQL 403 when the
CONNECT proxy refuses api.github.com, because it never sees
"Forge Sandbox Denied". If the proxy recorded a denied host during
the command, pause for a host allow instead of handing the model a
fake auth failure. A real GitHub 403 after an allowed CONNECT still
fails through.
mohitranka added a commit that referenced this pull request Sep 11, 2026
gh prints "authentication token is invalid" / GraphQL 403 when the
CONNECT proxy refuses api.github.com, because it never sees
"Forge Sandbox Denied". If the proxy recorded a denied host during
the command, pause for a host allow instead of handing the model a
fake auth failure. A real GitHub 403 after an allowed CONNECT still
fails through.
mohitranka added a commit that referenced this pull request Sep 11, 2026
gh prints "authentication token is invalid" / GraphQL 403 when the
CONNECT proxy refuses api.github.com, because it never sees
"Forge Sandbox Denied". If the proxy recorded a denied host during
the command, pause for a host allow instead of handing the model a
fake auth failure. A real GitHub 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