Problem
The AgentRuntime CRD defines spec.auth.outbound[].audiences as an array (future-proofing), but AuthBridge's routing.Route struct only supports a single target_audience string.
Currently, the webhook silently takes the first audience and ignores any others:
// pod_mutator.go
if len(outboundRoute.Audiences) > 0 {
route["target_audience"] = outboundRoute.Audiences[0] // Only first is used
}
If a user specifies:
spec:
auth:
outbound:
- destination:
host: tool.svc.cluster.local
audiences:
- "spiffe://app1"
- "spiffe://app2" # ← SILENTLY IGNORED
The second audience is dropped without any feedback.
Proposed Solution
Add validation at webhook admission time:
if len(outboundRoute.Audiences) > 1 {
mutatorLog.Info("Multiple audiences specified but only first will be used",
"route", outboundRoute.Destination.Host,
"audiences", outboundRoute.Audiences,
"using", outboundRoute.Audiences[0])
// Consider: add a warning event on the AgentRuntime CR
}
Alternative: Reject the AgentRuntime entirely if multiple audiences are specified (stricter, but clearer failure mode).
Context
- AuthBridge source:
cortex/authbridge/authlib/routing/router.go - Route struct has Audience string
- CRD definition:
operator/api/v1alpha1/agentruntime_types.go - has Audiences []string
- The array format was chosen for future-proofing, but creates a mismatch with current AuthBridge capabilities
Related
/cc @alantech
Problem
The AgentRuntime CRD defines
spec.auth.outbound[].audiencesas an array (future-proofing), but AuthBridge'srouting.Routestruct only supports a singletarget_audiencestring.Currently, the webhook silently takes the first audience and ignores any others:
If a user specifies:
The second audience is dropped without any feedback.
Proposed Solution
Add validation at webhook admission time:
Alternative: Reject the AgentRuntime entirely if multiple audiences are specified (stricter, but clearer failure mode).
Context
cortex/authbridge/authlib/routing/router.go- Route struct hasAudience stringoperator/api/v1alpha1/agentruntime_types.go- hasAudiences []stringRelated
/cc @alantech