Repository navigation
Merge duplicate 2FA entries with the same name and code - #263
Merged
Merged
Conversation
When the same authenticator code (same issuer, account name and secret) exists twice in the same scope, or in a workspace while it is also global, keep one: the global entry first, then the one a login uses, then the oldest. The survivor takes over the login link and agent permissions. Copies linked to a different login, and copies in two different workspaces, stay. Runs when the vault unlocks, after create, update and import; importing into a workspace now skips codes that already exist globally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 2FA page showed the same code twice (e.g. "Coolify Zeus" once in Global and once in the Solakon GmbH workspace).
What changes
mergeDuplicateTotp()inpackages/core/src/vault/totp.ts: entries with the same issuer + account name (case-insensitive) and the same secret, algorithm, digits and period are merged when they sit in the same scope, or in a workspace while the same entry is also global.totpIdspermissions of the removed copy.Tests
packages/core/test/totp.test.tscovering global + workspace merge, link and permission transfer, idempotency, create/import of an existing code, linked twins and separate workspaces.tsc --noEmitclean.