feat(webhook): validate/warn when AgentRuntime.spec.auth.outbound route has multiple audiences
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 18
- Forks
- 50
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 8
Description
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 hasAudience string - CRD definition:
operator/api/v1alpha1/agentruntime_types.go- hasAudiences []string - The array format was chosen for future-proofing, but creates a mismatch with current AuthBridge capabilities
Related
- Discovered during PR #517 review
- Potentially related to future multi-audience token exchange support in AuthBridge
/cc @alantech
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the webhook logic in pod_mutator.go, then read operator/api/v1alpha1/agentruntime_types.go and cortex/authbridge/authlib/routing/router.go to confirm the audiences mismatch. Resolve whether admission should warn or reject multiple audiences before implementing the chosen behavior. Done means multiple audiences receive explicit handling instead of being silently ignored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100