mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-05-24 00:53:23 -05:00
[PR #7127] Add SSO cookie vendor endpoint for native apps behind auth proxies #23416
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/dani-garcia/vaultwarden/pull/7127
Author: @nathanmoreton
Created: 4/24/2026
Status: 🔄 Open
Base:
main← Head:feat/sso-cookie-vendor📝 Commits (6)
2b79525Add SSO cookie vendor endpoint for native apps behind authenticating proxies88b0ba0Merge branch 'dani-garcia:main' into feat/sso-cookie-vendor1fce93bMerge branch 'main' into feat/sso-cookie-vendora2d60c3Fix fmt and clippy on Rust 1.956b3d834Merge branch 'main' into feat/sso-cookie-vendor44e6a21Merge branch 'main' into feat/sso-cookie-vendor📊 Changes
5 files changed (+489 additions, -0 deletions)
View changed files
📝
.env.template(+22 -0)➕
docs/sso-cookie-vendor.md(+180 -0)📝
src/api/core/mod.rs(+19 -0)➕
src/api/core/sso_cookie_vendor.rs(+248 -0)📝
src/config.rs(+20 -0)📄 Description
Native Bitwarden apps cannot complete login when Vaultwarden sits behind an authenticating reverse proxy (Cloudflare Access, Authentik, Authelia, oauth2-proxy). The proxy redirects API requests to a browser-based IdP flow, which the apps' HTTP clients cannot follow.
Bitwarden addressed this upstream in February 2026 with a flow called SSO cookie vending. The server publishes, through
/api/config, acommunication.bootstrapblock naming the IdP login URL and the cookie the proxy sets. The app opens a system browser for the IdP step, the browser hits/api/sso-cookie-vendor, and the server 302-redirects tobitwarden://sso-cookie-vendor?<name>=<value>&d=1. The app captures the cookie from the deep link and attaches it to every future API request.Vaultwarden v2026.2.0 shipped the web-vault connector page from
clients#18476, but the server side has not landed. This PR adds it.Changes
sso_cookie_vendorthrough the existingmake_config!macro:SSO_COOKIE_VENDOR_ENABLED,SSO_COOKIE_VENDOR_IDP_LOGIN_URL,SSO_COOKIE_VENDOR_COOKIE_NAME,SSO_COOKIE_VENDOR_COOKIE_DOMAIN. Startup validation refuses to run when the flag is on but the three string fields are empty.GET /api/sso-cookie-vendorreads the proxy auth cookie from the request jar and 302-redirects to thebitwarden://deep link. Handles sharded cookies (<name>-0through<name>-19, which Cloudflare Access uses when the JWT exceeds single-cookie size limits), with a non-sharded cookie taking precedence. Missing cookie returns the upstream 404 HTML page; URIs over 8192 bytes return 400. Registered only when the flag is on.communication.bootstrapobject added to/api/config, matching the shape from upstream PR #6892 so clients pick it up unpatched.docs/sso-cookie-vendor.mdcovers the end-to-end flow, security notes, and per-proxy configuration.Default behavior
SSO_COOKIE_VENDOR_ENABLEDdefaults tofalse. Installs without the four env vars set are byte-identical to current behavior.Upstream references
/api/configTest plan
cargo fmt --checkcargo clippy --features sqlite -- -D warningscargo test --features sqlite -- sso_cookie_vendor🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.