diff options
author | BlackDex <[email protected]> | 2020-12-14 19:58:23 +0100 |
---|---|---|
committer | BlackDex <[email protected]> | 2020-12-14 19:58:23 +0100 |
commit | de86aa671eec9d08ab0e0d4cdd30584606882732 (patch) | |
tree | a3f4aba1e2de1a98ac6fef5e96cf919c8428b152 /migrations | |
parent | e38771bbbddcf8ad8135a6e07ad9930341448846 (diff) | |
download | vaultwarden-de86aa671eec9d08ab0e0d4cdd30584606882732.tar.gz vaultwarden-de86aa671eec9d08ab0e0d4cdd30584606882732.zip |
Fix Key Rotation during password change
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
Diffstat (limited to 'migrations')
6 files changed, 3 insertions, 0 deletions
diff --git a/migrations/mysql/2020-12-09-173101_add_stamp_exception/down.sql b/migrations/mysql/2020-12-09-173101_add_stamp_exception/down.sql new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/migrations/mysql/2020-12-09-173101_add_stamp_exception/down.sql diff --git a/migrations/mysql/2020-12-09-173101_add_stamp_exception/up.sql b/migrations/mysql/2020-12-09-173101_add_stamp_exception/up.sql new file mode 100644 index 00000000..bcad3922 --- /dev/null +++ b/migrations/mysql/2020-12-09-173101_add_stamp_exception/up.sql @@ -0,0 +1 @@ +ALTER TABLE users ADD COLUMN stamp_exception TEXT DEFAULT NULL;
\ No newline at end of file diff --git a/migrations/postgresql/2020-12-09-173101_add_stamp_exception/down.sql b/migrations/postgresql/2020-12-09-173101_add_stamp_exception/down.sql new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/migrations/postgresql/2020-12-09-173101_add_stamp_exception/down.sql diff --git a/migrations/postgresql/2020-12-09-173101_add_stamp_exception/up.sql b/migrations/postgresql/2020-12-09-173101_add_stamp_exception/up.sql new file mode 100644 index 00000000..bcad3922 --- /dev/null +++ b/migrations/postgresql/2020-12-09-173101_add_stamp_exception/up.sql @@ -0,0 +1 @@ +ALTER TABLE users ADD COLUMN stamp_exception TEXT DEFAULT NULL;
\ No newline at end of file diff --git a/migrations/sqlite/2020-12-09-173101_add_stamp_exception/down.sql b/migrations/sqlite/2020-12-09-173101_add_stamp_exception/down.sql new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/migrations/sqlite/2020-12-09-173101_add_stamp_exception/down.sql diff --git a/migrations/sqlite/2020-12-09-173101_add_stamp_exception/up.sql b/migrations/sqlite/2020-12-09-173101_add_stamp_exception/up.sql new file mode 100644 index 00000000..bcad3922 --- /dev/null +++ b/migrations/sqlite/2020-12-09-173101_add_stamp_exception/up.sql @@ -0,0 +1 @@ +ALTER TABLE users ADD COLUMN stamp_exception TEXT DEFAULT NULL;
\ No newline at end of file |