mirror of
https://github.com/dani-garcia/vaultwarden.wiki.git
synced 2026-11-14 00:36:04 +02:00
Implement V2 registration support (#7765)
* Implement V2 registration support * Require the client version header on every login, like upstream Every user login (password, user API key, SSO, including a first SSO login) now needs the Bitwarden-Client-Version header, for V1 accounts too. V2 accounts need 2026.10.1, or 2026.10.2 for the desktop app, upstream's current minimum. * Escape the email in the client version log line On a first SSO login the email comes from the identity provider and isn't validated yet, so a newline in it could add a line to the log.
This commit is contained in:
1 parent
5ad0c6d41a
commit
d28c8339fb
18 files changed
+838
-113
No files matched your search
@@ -632,6 +632,9 @@ impl<'r> FromRequest<'r> for Host {
|
||||
pub struct ClientHeaders {
|
||||
pub device_type: i32,
|
||||
pub ip: ClientIp,
|
||||
/// `Bitwarden-Client-Version`, `None` when missing or not a version. Unlike the [`ClientVersion`] guard, this
|
||||
/// doesn't log an error, as not every client sends it.
|
||||
pub client_version: Option<semver::Version>,
|
||||
}
|
||||
|
||||
#[rocket::async_trait]
|
||||
@@ -648,10 +651,13 @@ impl<'r> FromRequest<'r> for ClientHeaders {
|
||||
.get_one("device-type")
|
||||
.and_then(|d| d.parse().ok())
|
||||
.unwrap_or(DeviceType::UnknownBrowser as i32);
|
||||
let client_version =
|
||||
request.headers().get_one("Bitwarden-Client-Version").and_then(|v| semver::Version::parse(v).ok());
|
||||
|
||||
Outcome::Success(ClientHeaders {
|
||||
device_type,
|
||||
ip,
|
||||
client_version,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user