Repository navigation
Commit 3902417
committed
substrate: inject an actor JWT minted through Control.MintActorJwt
Substrate's egress policy carries a second credential source beside
`credential_uri`: `CredentialHeader.actor_jwt` (field 4, `ActorJWTSource`
with `audiences` and `expiration_seconds`), agent-substrate/substrate#1960.
Substrate's own Envoy egress mints that JWT for the actor behind the
tunnel (agentgateway#2135, agentgateway#2141). The agentgateway egress read every entry as an
`ate-secret://` URI, so an `actor_jwt` entry was denied with
`403 invalid credential URI: `.
`apply_effects` now injects, for an `actor_jwt` entry whose header the
request carries, `<prefix><token>`, the token minted through
`Control.MintActorJwt` on the policy's own control API backend with the
entry's audiences and lifetime. It needs no credential provider. Tokens
are cached per actor, sorted audiences and lifetime, and reused until a
third of their lifetime remains; concurrent misses share one mint. A
request without the header is forwarded unchanged and mints nothing.
A failed mint denies the request: 403 when the actor is gone
(`NotFound`), 503 when the control API is unavailable or times out, 500
otherwise (new `ProxyError::SubstrateEgressInternal`), the classes of
Substrate's `mapActorJWTError`. A minted token that is empty or not a
valid header value is a 500.
The vendored `ateapi.proto` gains `ActorJWTSource`, `MintActorJwt` and
its messages, wire-compatible with Substrate's (audiences = 1,
expiration_seconds = 8, actor = 5, as after agentgateway#2421).
Signed-off-by: Timo Derstappen <[email protected]>1 parent e523afb commit 3902417
7 files changed
Lines changed: 589 additions & 8 deletions
File tree
- crates
- agentgateway
- src
- http/substrate
- proxy
- test_helpers
- tests/tests
- protos/proto
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
0 commit comments