Require exact single audience match in local token validation - #167
Merged
Merged
Conversation
gargipanatula
force-pushed
the
fix-audience-exact-match
branch
from
September 3, 2026 23:26
80b644f to
92dd985
Compare
A token whose audience list names another consumer in addition to the EKS Pod Identity audience is scoped to that other consumer as well. The local audience check previously accepted such a token because the expected audience appeared somewhere in the list, which on the cache-hit path could let a shared token be exchanged for credentials it should not unlock (a confused deputy). validateAudience now normalizes the aud claim and accepts only when it contains exactly one element equal to the expected audience. Table tests cover single-string, single-element-array, multi-audience, empty, and missing forms, both directly and through ValidateClaims.
gargipanatula
force-pushed
the
fix-audience-exact-match
branch
from
September 3, 2026 23:27
92dd985 to
68ceadd
Compare
kmala
approved these changes
Sep 4, 2026
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.
Change:
Amend the local JWT validation logic to require a token to strictly have 1 audience (
pods.eks.amazonaws.com).Why:
A token can carry multiple audiences (via the
TokenRequestAPI) so it can be shared between two consumers. A token that names another audience alongside the Pod Identity one is also scoped to that other consumer, so honoring it here would let that consumer exchange a shared token for these credentials (a confused deputy). Limiting to a single audience prevents that. Standaed pod identity webhook-projected tokens are single-audience and unaffected.Testing:
Extended the tests in
claims_validation_test.goto cover single-string, single-element-array, multi-audience, empty, and missingaudforms, both directly and throughValidateClaims. Rango build ./...,go test ./..., andgo vet ./...— all pass.