Skip to content

Audience Uniqueness Warning #4260

Open

Description

@ChrisJBurns

Description

When reconciling an MCPOIDCConfig, detect duplicate audience values across workloads referencing the same config and emit a Warning event. If two servers sharing the same OIDC config have the same audience, a token obtained for one is valid at the other — this is a security concern.

Implementation Notes

Location: Add to the MCPOIDCConfig controller reconciliation loop (02-C).

Logic:

  1. For each referencing workload, resolve the effective audience:
    • If spec.oidcConfig.audience is set, use it
    • Otherwise, use the default {kind}/{namespace}/{name}
  2. Check for duplicates in the resolved audience list
  3. If duplicates found, emit a Warning event on the MCPOIDCConfig resource:
    Warning AudienceDuplicate Duplicate audience "foo" found on workloads: server-a, server-b. Tokens may be replayable between these servers.
    

Event recorder: Use the controller's record.EventRecorder (already available in the controller struct pattern).

Testing

  • Two workloads with different audiences → no warning event
  • Two workloads with same explicit audience → Warning event emitted
  • Workload with default audience matching another's explicit audience → Warning event emitted

Acceptance Criteria

  • Duplicate audience detection runs during MCPOIDCConfig reconciliation
  • Warning event emitted on the MCPOIDCConfig resource when duplicates found
  • Event message identifies the duplicate audience value and the affected workloads
  • No warning emitted when all audiences are unique
  • Default audience computation ({kind}/{namespace}/{name}) is included in uniqueness check
  • Unit tests cover all audience uniqueness scenarios
  • Tests pass in CI (task test)

Activity

  1. added
    enhancement
    kubernetes
    on Mar 19, 2026
  2. ChrisJBurns commented on Apr 3, 2026

    @ChrisJBurns
    CollaboratorAuthor

    @jhrozek Am curious on your thoughts on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementkubernetesoperatorsecurity

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions