Skip to content

egress: add credential injector - #1360

Merged
Eitan Yarmush (EItanya) merged 10 commits into
agent-substrate:mainfrom
yufan-su:egress-cred-injector
Sep 16, 2026
Merged

Eitan Yarmush (EItanya) merged 10 commits into
agent-substrate:mainfrom
yufan-su:egress-cred-injector

Conversation

@yufan-su

@yufan-su Yufan Su (yufan-su) commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

Adds egress credential injection: on the sdsmint egress gateway's decrypted MITM leg, when an actor's EgressPolicy rule matches and carries an inject_static_headers effect, the gateway resolves the referenced credential from a credential provider and sets it as a request header (e.g. Authorization: Bearer <token>) before re-originating upstream.

This implements the applyEffects in the egress handler. Injector runs as part of the existing egress ext_proc handler that already fetches/caches/evaluates each actor's EgressPolicy, so the MITM leg gains injection without a second ext_proc hop.

How it works

  • New CredentialProvider.FetchSecret plugin API (pkg/proto/credproviderpb): the gateway calls it with the credential URI and the actor's attested SPIFFE identity; the provider authenticates the gateway (mTLS) and resolves the secret.
  • The egress handler dials the provider over mTLS (egress.DialProvider) and injects on matched, allowed requests (egress.applyEffects).
  • Behavior:
    • TLS MITM leg + provider configured → inject the credential (overwriting any actor-set header).
    • Cleartext leg, or no provider configured → skip injection and pass the request through (never put a secret on a cleartext wire; don't block allowed egress).
    • Attempted but failed (unfetchable secret, empty/malformed secret, credential URI of an unserved provider class) → fail closed.

Installation

One flag stands up and wires the whole stack:

hack/install-ate.sh --deploy-ate-system --experimental-egress-credential-injection

--experimental-egress-credential-injection deploys credprovider and the injector, then re-wires the sdsmint egress gateway to route through the injector. It implies --experimental-use-sdsmint

New install flags

Two flags configure which credential provider the injector targets:

Flag Purpose Default
--credential-provider-name Provider class, as a ate-secret:// prefix; a policy URI of any other class is refused ate-secret://kubernetes.io
--credential-provider-address Where the injector dials the provider credprovider.ate-system.svc:50051

@EItanya Eitan Yarmush (EItanya) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI-assisted transfer of my actor-identity concern from #1335, since this PR is planned to merge first.

Comment on lines +40 to +41
// The SPIFFE ID of the actor on whose behalf the secret is fetched, as
// verified by the egress gateway. This field always contains a SPIFFE ID.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of "this field always contains a SPIFFE ID" maybe just say the format?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@EItanya
Eitan Yarmush (EItanya) merged commit 85ce8ed into agent-substrate:main Sep 16, 2026
11 checks passed
Keith Mattix II (keithmattix) pushed a commit to agentgateway/agentgateway that referenced this pull request Sep 17, 2026
Upgrade to the new codified protobuf contract:
agent-substrate/substrate#1360.

- [x] As required by the [Code of
Conduct](https://github.com/agentgateway/agentgateway/blob/main/CODE_OF_CONDUCT.md#generative-ai-policy),
the description, docs, and comments (words meant for humans) are written
by a human, not by an LLM.

Signed-off-by: Eitan Yarmush <[email protected]>
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.

7 participants