mirror of
https://github.com/dani-garcia/vaultwarden.wiki.git
synced 2026-10-25 08:26:47 +02:00
fix(security): revoke 2FA remember tokens when credentials or 2FA change (#7682)
This commit is contained in:
1 parent
57fbed1bed
commit
f1ff613008
3 files changed
+21
-2
No files matched your search
@@ -905,6 +905,12 @@ async fn twofactor_auth(
|
||||
|
||||
// Remove all twofactors from the user
|
||||
TwoFactor::delete_all_by_user(&user.uuid, conn).await?;
|
||||
|
||||
// No device may keep skipping 2FA once every second factor is gone.
|
||||
// `device` is cleared in memory too, since saving it later would restore its token.
|
||||
Device::clear_twofactor_remember_by_user(&user.uuid, conn).await?;
|
||||
device.delete_twofactor_remember();
|
||||
|
||||
enforce_2fa_policy(user, &user.uuid, device.atype, &ip.ip, conn).await?;
|
||||
|
||||
log_user_event(EventType::UserRecovered2fa as i32, &user.uuid, device.atype, &ip.ip, conn).await;
|
||||
|
||||
Reference in new issue
Block a user