Skip to content

Implement SPIFFE trust-domain bundle management and rotation #6201

Description

@jhrozek

Description

Provide the validation material both SPIFFE credential types are checked
against: X.509 roots and intermediates for X.509-SVID chains, and JWT
verification keys for JWT-SVID signatures, keyed by an explicitly configured
trust domain.

This is the largest greenfield piece of the epic and the largest risk. The
spiffee-authserver branch has no bundle or rotation code at all —
spiffe.NewMiddleware takes only an expected trust domain and relies on chain
validation configured on the TLS listener. There is nothing to harvest here, so
the work should be split along the line where existing machinery stops.

Scope

Split into two halves; the JWT half is mostly existing machinery, the X.509
half is not.

JWT keys (largely existing):

  • Supply JWT verification keys restricted to the bundle's jwt-svid keys.
  • Reuse pkg/oauthproto/jwks.go's fetcher rather than adding a second cache
    and fetch path. It already has per-issuer caching, refresh on kid miss,
    HTTPS enforcement, a dial-time private-address SSRF guard, and a
    stale-on-error last-known-good path — extend it, do not reimplement it.

X.509 roots and bundle sources (new):

  • Add a trust-domain-keyed bundle registry.
  • Supply X.509 roots and intermediates for X.509-SVID chain validation.
  • Support explicitly configured SPIFFE Bundle Endpoints.
  • Support a SPIRE Workload API bundle source for locally attested deployments.
  • Implement bundle refresh hints, sequence handling, rotation overlap, and an
    explicit last-known-good policy.
  • Keep Workload API and remote Bundle Endpoint configuration independent —
    neither should imply or override the other.

Acceptance criteria

  • Bundle material is selected by a configured trust domain, never by an
    arbitrary issuer or claim taken from the credential being validated.
  • Bundle Endpoint URLs are explicitly configured and authenticated using
    WebPKI, kept separate from SPIFFE workload trust.
  • X.509 and JWT validation cannot mix keys across trust domains.
  • Old and new X.509 chains and JWT keys both validate during a configured
    rotation overlap.
  • Removed keys stop validating once the updated bundle becomes authoritative.
  • Unknown trust domains fail closed.
  • Bundle refresh and failure behaviour is observable without logging
    credentials or key material.

Dependencies

  • Sub-issue 1 (identity, association and configuration model) — the trust
    domain this registry is keyed by is declared there.
  • pkg/oauthproto/jwks.go (unpushed, xaa-spike-1). If this issue starts
    first, land that fetcher shared rather than copying it.

Related

  • Part of the SPIFFE client-authentication epic

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions