Skip to content

feat: opt-in SPIFFE mTLS for https backends - #535

Merged
stefanprodan merged 1 commit into
masterfrom
spiffe-client
Oct 26, 2026
Merged

stefanprodan merged 1 commit into
masterfrom
spiffe-client

Conversation

@stefanprodan

Copy link
Copy Markdown
Owner

Adds opt-in SPIFFE mTLS for calls from /api/echo to https backends, so two podinfo instances can be chained over SPIFFE mTLS.

Changes

  • New flags:
    • --spiffe-backend-mtls: call https backends with SPIFFE mTLS, presenting podinfo's SVID. Requires --spiffe-endpoint-socket.
    • --spiffe-backend-ids: server SPIFFE IDs accepted from backends. When empty, any ID in podinfo's trust domain is accepted. Requires --spiffe-backend-mtls.
  • Off by default. With SPIFFE enabled only for the server, https backends with WebPKI certs keep working. When the flag is on, all https backends must be SPIFFE workloads. http backends are never affected.
  • The client TLS config reads from the same X509Source as the server, so SVID rotation applies to backend calls.
  • Backend calls fail with a clear error before the SVID is issued and after shutdown.
  • Chart: new spiffe.backendMTLS and spiffe.backendIDs values. Rendering fails for backendMTLS without spiffe.enabled and for backendIDs without backendMTLS.
  • Docs: flag tables and a frontend/backend example in the README and chart README.

Testing

  • go test -race ./pkg/api/http/ -run SPIFFE: chains two SPIFFE podinfo instances and covers mutual authorization, rejection on either side, foreign trust domains, the disabled mode, flag validation and the error before the SVID is issued and after shutdown.
  • helm lint and helm template with valid and invalid value combinations.

- New flags --spiffe-backend-mtls and --spiffe-backend-ids. With
  --spiffe-backend-mtls, /api/echo calls the https backends over SPIFFE
  mTLS, presenting podinfo's SVID and authorizing the backend by ID, or
  by podinfo's trust domain when no IDs are given. SVID rotation applies
  to backend calls too. http backends are unchanged.
- Off by default, so https backends with WebPKI certs keep working when
  SPIFFE is enabled for the server.
- --spiffe-backend-mtls without --spiffe-endpoint-socket, or
  --spiffe-backend-ids without --spiffe-backend-mtls, fail at startup.
- Backend calls fail with a clear error before the SVID is issued and
  after shutdown closes the Workload API source.
- The backend transport no longer assumes http.DefaultTransport is an
  *http.Transport.
- Chart: new spiffe.backendMTLS and spiffe.backendIDs values, with
  template errors for invalid combinations.
- Tests chain two SPIFFE podinfo instances and cover mutual
  authorization, foreign trust domains and the disabled mode.
@stefanprodan
stefanprodan merged commit a112f6b into master Oct 26, 2026
5 checks passed
@stefanprodan
stefanprodan deleted the spiffe-client branch October 26, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant