feat(authproxy): use CLIENT_ID for per-agent inbound audience validation#282
Open
huang195 wants to merge 1 commit intokagenti:mainfrom
Open
feat(authproxy): use CLIENT_ID for per-agent inbound audience validation#282huang195 wants to merge 1 commit intokagenti:mainfrom
huang195 wants to merge 1 commit intokagenti:mainfrom
Conversation
9a080c3 to
c6d7443
Compare
…e EXPECTED_AUDIENCE Replace the EXPECTED_AUDIENCE env var with the agent's CLIENT_ID (from /shared/client-id.txt) for inbound JWT audience validation. This makes audience validation per-agent by construction — the operator or client-registration writes the agent's Keycloak client ID to this file, so each agent validates against its own identity. Previously, EXPECTED_AUDIENCE was: - Not set (most demos) → no audience check, tokens interchangeable - Set at namespace level → same value for all agents in namespace Now, audience validation is automatic and per-agent. A token intended for one agent cannot be used on another agent in the same namespace. Works for both SPIRE and non-SPIRE paths: - SPIRE: CLIENT_ID = spiffe://trust-domain/ns/namespace/sa/sa-name - Non-SPIRE: CLIENT_ID = namespace/workload-name Updated demo configmaps and docs to remove EXPECTED_AUDIENCE references. Signed-off-by: Hai Huang <huang195@gmail.com>
c6d7443 to
61ca04c
Compare
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the
EXPECTED_AUDIENCEenv var with the agent'sCLIENT_ID(from/shared/client-id.txt) for inbound JWT audience validation. This makes audience validation per-agent by construction.Problem
EXPECTED_AUDIENCEwas either:A token intended for one agent could be used on any other agent in the same namespace.
Solution
Use
CLIENT_IDfrom/shared/client-id.txtas the expected audience. This file is written by the operator (PR #247) or client-registration sidecar and contains the agent's unique Keycloak client ID:spiffe://trust-domain/ns/namespace/sa/service-accountnamespace/workload-nameThe audience scope created during client registration ensures platform tokens (kagenti UI) include this value in their
audclaim.Changes
config.ClientIDinstead ofEXPECTED_AUDIENCEenv varEXPECTED_AUDIENCEreferencesImpact on existing demos
All demos verified — no breakage:
Test plan
Generated with Claude Code