feat: SSO improvements — auto-redirect, Key Connector, logout redirect, auto-enrollment#6949
feat: SSO improvements — auto-redirect, Key Connector, logout redirect, auto-enrollment#6949brendan-kite wants to merge 1 commit intodani-garcia:mainfrom
Conversation
|
You might as well store your master password on plain text in the database then. It is never ever a good idea to store the key that is able to decrypt your vault into the same database. This also looks like AI generated code, which doesn't really notice how the codebase works. |
96986eb to
2738774
Compare
…t, auto-enrollment Add six new opt-in configuration flags that enhance the SSO experience: SSO_AUTO_REDIRECT (requires SSO_ONLY=true): Automatically redirect users to the SSO provider login page instead of showing the Vaultwarden login form. Uses PKCE with S256 challenge. SSO_IDENTIFIER: Custom organization identifier for SSO flows. SSO_LOGOUT_REDIRECT (requires SSO_AUTO_REDIRECT=true): On logout, redirect to the SSO provider's OIDC end_session endpoint. Uses localStorage to detect logout vs fresh visit. SSO_KEY_CONNECTOR (requires SSO_ONLY=true, SSO_KEY_CONNECTOR_SECRET): Built-in Key Connector — SSO users never need a master password. All stored keys are encrypted at rest with AES-256-GCM using a key derived from SSO_KEY_CONNECTOR_SECRET via HKDF-SHA256 with per-key salts. File format: salt(32) || nonce(12) || ciphertext || tag(16). The secret only exists as an env var, never on disk. SSO_KEY_CONNECTOR_SECRET: Required 256-bit hex secret for encrypting Key Connector keys at rest. Can be sourced from external KMS (AWS KMS, HashiCorp Vault) via deployment tooling for stronger security guarantees. SSO_AUTO_ENROLL: Auto-create organization and enroll SSO users on first login. Startup validation ensures SSO_KEY_CONNECTOR_SECRET is set and valid (64 hex chars) when SSO_KEY_CONNECTOR is enabled. Addresses: dani-garcia#2583 (Key Connector), dani-garcia#6191 (auto-redirect), dani-garcia#6316 (SSO_ONLY flows) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2738774 to
6fc40c0
Compare
|
Agreed, Key Connector will not be supported by Vaultwarden in this way, as this completely breaks the encryption model in ways that we don't want. The fact that Bitwarden supports it (likely because a client with more money than sense asked for it) doesn't mean we have to do it too. Key Connector, if it's ever supported by us, would have to be a separate service (ideally on a separate machine) and using some HSM or hardware security measure to ensure it's not instantly breakable. I think for most users SSO with trusted devices is just as convenient and more secure. About the SSO logout redirect, this seems to be relying on modifying application internals to clear its state, which is going to be a maintenance nightmare for us. If this is a problem using the official self-hosted server, it should be reported there. About the SSO auto redirect, if introducing the SSO identifier is creating too much friction, the correct solution is to see how self hosted clients implement Claimed domains support, which is the official way to have some emails bypass the identifier selection. Given that, I think this PR can be closed as there's nothing actionable for us. |
|
Thanks for the detailed feedback! We understand the architectural concerns — Key Connector as a built-in feature doesn't align with Vaultwarden's security model, and the JS injection approach for auto-redirect creates maintenance overhead you don't want to carry. We'll take this in the direction you've outlined: a separate Key Connector service with proper trust-boundary separation and KMS-backed key storage, rather than building it into Vaultwarden. We'll also look into Claimed domains support and trusted device encryption as the preferred approaches for SSO usability improvements. We appreciate the time reviewing this — the feedback was valuable in shaping the right architecture. |
Daniel, I am genuinely impressed. Thank you for your integrity. I send you a mental hug. That is, if you are ok with a hug. ;-) |
Summary
Five new opt-in configuration flags that address long-standing SSO usability gaps:
SSO_AUTO_REDIRECT— Skip the login form entirely, go straight to the IdP (SSO with OIDC asks for Email, then Username, which it should already know #6191)SSO_LOGOUT_REDIRECT— End the IdP session on logout, preventing auto-re-login loopsSSO_KEY_CONNECTOR— Built-in Key Connector so SSO users never need a master password (Feature Request: key-connector for master-passwordless SSO #2583)SSO_AUTO_ENROLL— Auto-create org and enroll users on first SSO loginSSO_IDENTIFIER— Custom org identifier for the above featuresAll features are off by default and fully backwards-compatible. 547 lines added across 7 files.
Motivation
With
SSO_ONLY=true, several flows are broken or frustrating:SSO_AUTO_REDIRECTeliminates thisSSO_LOGOUT_REDIRECTfixes this with OIDC RP-Initiated LogoutSSO_KEY_CONNECTORprovides a clean-room, file-based Key ConnectorSSO_AUTO_ENROLLcreates one automaticallySecurity Note
Key Connector stores wrapped master keys server-side, trading the zero-knowledge property for usability. This is the same tradeoff as Bitwarden's official Key Connector. The feature is opt-in and clearly documented.
Configuration