mediawiki-extensions-OATHAuth/src
Taavi Väänänen 2832e97046 Fix disabling TOTP keys with scratch tokens
The current implementation of OATHUserRepository::persist() causes every
key to get a new ID when it's saved. This, combined with ::removeKey()
which compares keys by ID, means that using recovery codes to disable
TOTP is broken since TOTPKey calls persist() to mark the code as saved
just before the key is deleted.

In this patch I've chosen to add a new ::updateKey() method instead of
fixing ::persist(). This is more in line with the other new APIs in
OATHUserRepository (namely ::createKey() and ::removeKey()), and is
something I've been planning to do eventually - this bug just made that
a bit more urgent. ::persist() should be dropped once WebAuthn has been
updated too.

Tests are also updated - OATHUserRepositoryTest now updates the key
before deleting it and there's a new TOTPDisableFormTest to test the
entire disabling process.

Bug: T363548
Change-Id: I86ddc8e5bfc9cf74c587ffdff523f559c5a3c08c
(cherry picked from commit 0dad2c7031)
2024-04-26 18:11:56 +00:00
..
Api/Module build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0 2024-03-11 20:43:28 +01:00
Auth Fix a few remaining occurances of recovery token 2024-01-11 14:00:57 +00:00
Hook build: Updating dependencies 2024-02-12 18:57:35 +00:00
HTMLForm Make the TOTP disable form only remove that single key 2024-03-02 18:53:00 +02:00
Key Fix disabling TOTP keys with scratch tokens 2024-04-26 18:11:56 +00:00
Module TOTP: Cleanup uses of getFirstKey, getModule 2023-12-28 12:20:03 +02:00
Notifications notifications: Show number of remaining devices 2024-01-11 23:49:14 +00:00
Special Make Key objects aware of their database IDs 2024-03-02 18:53:00 +02:00
IAuthKey.php Make Key objects aware of their database IDs 2024-03-02 18:53:00 +02:00
IModule.php OATHUserRepository: add method to create and persist a key 2023-12-22 17:07:52 +02:00
OATHAuth.php Add separate OATHAuthModuleRegistry service 2023-01-01 21:17:04 +02:00
OATHAuthModuleRegistry.php build: Updating dependencies 2024-02-12 18:57:35 +00:00
OATHAuthServices.php OATHAuthServices: Fix service name 2024-01-08 11:44:11 +02:00
OATHUser.php Make the TOTP disable form only remove that single key 2024-03-02 18:53:00 +02:00
OATHUserRepository.php Fix disabling TOTP keys with scratch tokens 2024-04-26 18:11:56 +00:00