Repository navigation
Description
Problem
Three checks trust a header that the caller (an external client or the agent itself) can set. Each lets a request skip a plugin chain or plugin. Line numbers are at ab5f01f26.
1. ext_proc picks the inbound or outbound chain from a header the client can forge
core/listener/extproc/server.go:197-215 chooses the pipeline from x-authbridge-direction. getHeader (:1324-1334) returns the first entry, and any value other than inbound means outbound.
- Inbound: the Envoy Lua filter in rossoctl (
charts/rossoctl/templates/authbridge-template-configmaps.yaml:169; same inagent-namespace-resources.yaml:244-246) usesheaders():add, which appends after the client's entry. An external caller who sendsx-authbridge-direction: outboundrunshandleOutbound. jwt-validation never runs, and the request reaches the agent unauthenticated. - Outbound: the outbound listener never strips the header. An agent that sends
x-authbridge-direction: inboundgets the inbound chain, so outbound OPA, IBAC and token exchange are skipped.
Fix:
- In the Envoy config: use
headers():replaceon inbound, and remove the header on the outbound listener. - In cortex: reject a request that carries more than one direction entry.
Not yet tested against a live Envoy. The claim that Envoy passes duplicate headers to ext_proc in insertion order is from reading the config.
2. An agent can turn off IBAC (and SPARC) by setting a header itself
core/plugins/ibac/plugin.go:341-343 returns Continue, with no skip recorded, when the request has X-IBAC-Judge: 1. sparc/plugin.go:262 does the same with its sentinel. Outbound pctx.Headers is the agent's own request, and nothing strips these headers.
IBAC's stated threat is a prompt-injected agent (docs/ibac-plugin.md:17-29). A tool that lets the model set headers sends POST exfil-server with X-IBAC-Judge: 1 and is never judged.
The guard protects against a loop that cannot happen: the judge uses its own http.Client that bypasses the listener (judge.go:48-55).
Fix: delete the header check in both plugins.
3. jwt-validation audience_mode: per-host takes the audience from the caller's Host header
core/plugins/jwtvalidation/plugin.go:261-263, 390-395 sets the expected aud to routing.ServiceNameFromHost(pctx.Host). On the reverse-proxy inbound listener, pctx.Host is r.Host (reverseproxy/server.go:343).
- Case: a caller with a token minted for
billingsends it to agentfoowithHost: billing. It passes, and the Director then forwards the request tofoo. This is the confused-deputy case thatjwks.go:63says the audience check exists to stop. - On ext_proc, inbound
Hostis deliberately empty (extproc/server.go:263-271). Per-host mode adds no default audience (plugin.go:133), so every inbound request gets a 503 (auth.go:330-336). - The two tests (
plugin_test.go:43, 191) only check Configure and Ready.
Fix: derive the audience from the listener's backend or original destination, or refuse per-host mode on inbound in validate().
Found by a code audit of main at ab5f01f.
Assisted-By: Claude (Anthropic AI) [email protected]
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
Merge main into feat/sbx-ws-upgrade (#1488)
fix: refuse forgeable headers that pick the ext_proc chain, disable I…