mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-03-12 01:45:56 -05:00
[PR #1243] [MERGED] Fix Key Rotation during password change. #6566
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/1243
Author: @BlackDex
Created: 11/28/2020
Status: ✅ Merged
Merged: 12/14/2020
Merged by: @dani-garcia
Base:
master← Head:fix-key-rotate📝 Commits (1)
de86aa6Fix Key Rotation during password change📊 Changes
13 files changed (+83 additions, -18 deletions)
View changed files
➕
migrations/mysql/2020-12-09-173101_add_stamp_exception/down.sql(+0 -0)➕
migrations/mysql/2020-12-09-173101_add_stamp_exception/up.sql(+1 -0)➕
migrations/postgresql/2020-12-09-173101_add_stamp_exception/down.sql(+0 -0)➕
migrations/postgresql/2020-12-09-173101_add_stamp_exception/up.sql(+1 -0)➕
migrations/sqlite/2020-12-09-173101_add_stamp_exception/down.sql(+0 -0)➕
migrations/sqlite/2020-12-09-173101_add_stamp_exception/up.sql(+1 -0)📝
src/api/core/accounts.rs(+5 -4)📝
src/auth.rs(+22 -10)📝
src/db/models/mod.rs(+1 -1)📝
src/db/models/user.rs(+49 -3)📝
src/db/schemas/mysql/schema.rs(+1 -0)📝
src/db/schemas/postgresql/schema.rs(+1 -0)📝
src/db/schemas/sqlite/schema.rs(+1 -0)📄 Description
When ticking the 'Also rotate my account's encryption key' box, the key
rotated ciphers are posted after the change of password.
During the password change the security stamp was reseted which made
the posted key's return an invalid auth. This reset is needed to prevent other clients from still being able to read/write.
This fixes this by adding a new database column which stores a stamp exception which includes the allowed route and the current security stamp before it gets reseted.
When the security stamp check fails it will check if there is a stamp exception and tries to match the route and security stamp.
Currently it only allows for one exception. But if needed we could expand it by using a
Vec<UserStampException>and change the functions accordingly.fixes #1240
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.