Skip to content

feat(saml): support zero-downtime SP key rotation #2575

Open
cemalkilic wants to merge 3 commits into
masterfrom
cemal/feat-saml-key-rotation
Open

feat(saml): support zero-downtime SP key rotation #2575
cemalkilic wants to merge 3 commits into
masterfrom
cemal/feat-saml-key-rotation

Conversation

@cemalkilic

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Feature

Summary

Adds GOTRUE_SAML_PRIVATE_KEY_NEXT to support safe rotation of the SAML SP signing key without interrupting active IdP integrations.

  • Config: PrivateKeyNext parsed, validated (same rules as primary), and derived into RSAPrivateKeyNext / CertificateNext; explicit nil-reset guards against envconfig zero-value allocation
  • Metadata: next cert injected as a second KeyDescriptor; Cache-Control drops to max-age=60 and XML cacheDuration is set to PT1H during the rotation window
  • Encrypted assertions: when AllowEncryptedAssertions=true, a failed ParseResponse is retried with the old key in primary position; original error returned if both fail
  • Settings: saml_private_key_next_configured boolean added to /settings
  • Runbook: docs/saml_key_rotation.md covers key generation, the dual-key window, promotion, rollback, and encrypted assertion considerations

@cemalkilic cemalkilic requested a review from a team as a code owner June 12, 2026 11:22
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