Repository navigation
[PM-42172] feat: Separate the Identity and SSO certificates, and rotate each one without downtime - #8850
Open
enmande wants to merge 60 commits into
Open
[PM-42172] feat: Separate the Identity and SSO certificates, and rotate each one without downtime#8850enmande wants to merge 60 commits into
enmande wants to merge 60 commits into
Conversation
…handling These tests record the current behavior of CouldHandleAsync before PM-42283 changes it. The tests cover: - Requests with the scheme query parameter, with and without a SAML message. - RSA 1.5 and OAEP encrypted assertions, signed and unsigned. - The message that the parser reads for each HTTP method, and the precedence of SAMLRequest and SAMLResponse.
…ing, behind a flag When the pm-42283-rsa-1_5-deprecation flag is on, CouldHandleAsync reads the SAML message with the same Sustainsys.Saml2 binding that the handler uses. Thus, CouldHandleAsync inspects the same message that the handler processes. The scheme query parameter now applies only to a request without a SAML message, such as a metadata or login-initiation request. Each request with a SAML message gets the issuer check and the signature check. When the flag is off, the behavior does not change.
…sertions When the pm-42283-rsa-1_5-deprecation flag is on, CouldHandleAsync accepts an encrypted assertion only when each key uses rsa-oaep or rsa-oaep-mgf1p key transport. CouldHandleAsync rejects an encrypted assertion that has no key. This check runs before the signature check. This check also applies when the configuration does not require signed assertions. The RSA 1.5 deprecation notice runs before this check. Thus, administrators get the notice when login fails. The exception message is constant.
…ames an EncryptedKey
…ity-and-sso-certificate-framework
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8850 +/- ##
==========================================
+ Coverage 68.69% 69.05% +0.36%
==========================================
Files 2759 2762 +3
Lines 118196 118543 +347
Branches 10859 10891 +32
==========================================
+ Hits 81189 81859 +670
+ Misses 34454 34125 -329
- Partials 2553 2559 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
JaredSnider-Bitwarden
left a comment
Contributor
There was a problem hiding this comment.
This is looking great so far. I'm not done reviewing but will be out rest of day so leaving these here for ya for now.
…ettings Declare the certificate settings members as nullable strings. Require a blob name before the host loads a certificate from blob storage. Add a test that a cloud future certificate with only a password stops startup.
Keep the pinned Azurite image in one constant in test/Common. Point the Renovate regex manager at that file, so one update changes every suite.
…y-and-sso-certificate-framework # Conflicts: # bitwarden_license/test/Sso.IntegrationTest/Saml2/Acs/SsoCertificateTests.cs # test/Identity.IntegrationTest/TokenEndpoint/DeviceLastActivity/IdentityJwksTests.cs
…in Certificates folders Move the Identity certificate tests into Certificates/ and split them into IdentitySigningKeyPublicationTests, IdentityTokenSigningTests, and IdentityCertificateStartupTests. Move the SSO certificate tests into Certificates/ and split them into SsoSigningKeyTests, SsoMetadataCertificateTests, SsoAssertionDecryptionTests, and SsoCertificateStartupTests. Move the helpers that more than one class uses into CertificateTestHelpers and SsoCertificateTestHelpers. Rename the test about a retired certificate that failed naming "the list entry" to name "the retired entry". No test logic changed.
…fier tests The tests wait for a background task. On a loaded CI runner, the task can start after the 5-second limit. A 30-second limit stops these false failures. A passing test does not wait longer.
enmande
commented
Nov 16, 2026
…y-and-sso-certificate-framework # Conflicts: # bitwarden_license/test/Sso.IntegrationTest/Flows/Saml2SpInitiatedLogin/Saml2SpInitiatedLoginFlowTests.cs # bitwarden_license/test/Sso.IntegrationTest/Helpers/Saml2SpInitiatedLoginSteps.cs # bitwarden_license/test/Sso.IntegrationTest/Helpers/SsoCertificateTestHelpers.cs
…e source check after the slots The Identity certificate type holds the certificates that the Identity settings configure in each slot. The new name, IdentityCertificateSlots, matches SsoCertificateSlots. Its Validation property is now Retired, which matches the slot names in the rotation document. The active source check now says that it reads only the settings.
…dentity fallback SsoCertificateSlots now records whether the role has an active certificate settings source. It no longer records the Identity fallback. The two resolve methods decide the fallback and set it on the set that they return. The summaries of both sets now say that the set holds the certificates that the role uses after the fallback.
…t read the Identity slots No test checked this case. The existing tests used Identity certificates that load. The new test makes each Identity slot read throw. It fails when a resolve method reads an Identity slot before it checks its own source. It also fails when the Identity slots load eagerly.
… when each host loads them The document now defines the terms role, slot, and set. It also lists the slots that each host loads at startup. The self-hosted section now calls the Identity validation certificates the retired certificates.
… certificate sets The signing and encryption sets now call their third list Retired, as the slots, the startup report, and the rotation document do. The staged certificates also validate or decrypt, so the old names did not tell the two lists apart. The setting names do not change.
The comment on the Azurite image now gives the reason for the pin.
…ate does not load A host now names globalSettings:identityServer and what to check when the Identity root certificate does not load. Hosts start and stop in the same cases as before. A Development host still uses a developer signing key.
…espaces The certificate role, slot, set, and report types are models, not utilities. They now live in Bit.SharedWeb.Certificates and Bit.Sso.Certificates, and their tests follow the same folders.
…tificate, and name rollback tests by rotation step
JaredSnider-Bitwarden
approved these changes
Nov 18, 2026
JaredSnider-Bitwarden
left a comment
Contributor
There was a problem hiding this comment.
Amazing work on a really hard problem. Thank you for your iterations and thoroughness in testing.
This branch has not been deployed
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.
🎟️ Tracking
PM-42172
📔 Objective
Give each server certificate its own settings, and let each one rotate with configuration changes and restarts only.
/identityglobalSettings:identityServer/ssoglobalSettings:ssoServer/ssoglobalSettings:ssoServer:encryptionWhat changes:
futureCertificateslot (enabled,active) and a list of outgoing certificates (validationCertificatesordecryptionCertificates)./ssosigns its OIDC tokens with the SSO signing certificate, not the Identity certificate./ssodecrypts with the active, staged, and outgoing encryption certificates.src/Core/Settings/IDENTITY_SSO_CERTIFICATE_ROTATION.mddescribes the settings, the rotation steps, and rollback.Deployment
/ssohost must setglobalSettings:ssoServerandglobalSettings:ssoServer:encryption. Without them,/ssodoes not start./ssohost with no SSO settings uses the Identity certificate for all three roles, as it does today.Testing
📸 Screenshots
Recordings of the continuity test: a real SAML sign-in in the browser at each rotation step.
Identity
Shows promotion steps with rollbacks for each.
r1-identity-rotation-cloud.mp4
SSO
Shows promotion steps with rollbacks for each.
r2-sso-split-rotation-cloud.mp4
🤖 AI-assisted review
main.bitwarden_license/src/Sso/CLAUDE.md.