Egress proxy forwards a token endpoint for an ungranted optional OAuth credential #1643

Closed
opened 2026-10-27 13:41:13 +00:00 by sam · 0 comments
Owner

Proxy.forward intercepts a credential's token endpoint only when Proxy.granted returns true. For a rule that is not required, granted returns (false, nil) on ErrUnbound and the request is reverse-proxied verbatim, so the provider's real access and refresh tokens reach the container un-sentinelized. That contradicts "The real credential never enters the container" (docs/prds/external-agent-harness.md, Decision).

Evidence: internal/infrastructure/egress/proxy.go (forward: interceptOAuth only when granted), internal/infrastructure/egress/oauth.go (granted returns false, nil for an ungranted optional rule; sentinelize runs only inside interceptOAuth).

Reached when a Kit declares an OAuth credential with required = false and a token endpoint, and the run or setup session has no binding for it.

Fix: fail closed when a token-endpoint rule matched but the service is not granted, instead of falling through to the reverse proxy. Add a table test at the egress seam.

Done when: a request to a matched token endpoint with no grant is refused, and the response body is never the provider's real tokens.

Close reason

Verified: fixed in code or doc/file no longer exists (see burndown 2026-10-13)


Imported from beads archie-core-wcbr · GitHub #1553 · type bug · priority P2 · created 2026-10-08 · closed 2026-10-12

Proxy.forward intercepts a credential's token endpoint only when Proxy.granted returns true. For a rule that is not required, granted returns (false, nil) on ErrUnbound and the request is reverse-proxied verbatim, so the provider's real access and refresh tokens reach the container un-sentinelized. That contradicts "The real credential never enters the container" (docs/prds/external-agent-harness.md, Decision). Evidence: internal/infrastructure/egress/proxy.go (forward: interceptOAuth only when granted), internal/infrastructure/egress/oauth.go (granted returns false, nil for an ungranted optional rule; sentinelize runs only inside interceptOAuth). Reached when a Kit declares an OAuth credential with required = false and a token endpoint, and the run or setup session has no binding for it. Fix: fail closed when a token-endpoint rule matched but the service is not granted, instead of falling through to the reverse proxy. Add a table test at the egress seam. Done when: a request to a matched token endpoint with no grant is refused, and the response body is never the provider's real tokens. ### Close reason Verified: fixed in code or doc/file no longer exists (see burndown 2026-10-13) --- _Imported from beads `archie-core-wcbr` · GitHub #1553 · type bug · priority P2 · created 2026-10-08 · closed 2026-10-12_
sam added the mediumbug labels 2026-10-27 13:41:13 +00:00
sam self-assigned this 2026-10-27 13:41:13 +00:00
sam closed this issue 2026-10-27 13:41:13 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1643