feat(mfa): add schema for recovery codes factor - #2725
Merged
Conversation
fadymak
commented
Aug 24, 2026
xlgmokha
approved these changes
Aug 24, 2026
xlgmokha
left a comment
Contributor
There was a problem hiding this comment.
I left a few questions for you to consider. Otherwise, it looks good to me.
annabkr
reviewed
Aug 24, 2026
annabkr
reviewed
Aug 24, 2026
annabkr
reviewed
Aug 24, 2026
xlgmokha
reviewed
Aug 28, 2026
annabkr
reviewed
Aug 28, 2026
annabkr
reviewed
Aug 28, 2026
fadymak
force-pushed
the
fm/auth-1526
branch
2 times, most recently
from
August 31, 2026 09:11
713c62f to
5f66657
Compare
- Adds unique user_id to mfa_recovery_code_sets as a workaround to avoid creating a unique index on mfa_factors (user_id) which would impact large tables. - Renames fields for consistency - Adds unique index on mfa_recovery_codes (mfa_recovery_code_set_id, code_hash) to prevent duplicate codes per set.
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.
Adds the schemas required to support MFA recovery codes factor.
Note
To avoid long running migration on Auth server startup due to
mfa_factors (user_id) where factor_type = 'recovery_codes', we've decided to denormalize theuser_idfield and add it to themfa_recovery_code_setswhich would provide similar guarantees of a user only allowed to have a single set of recovery codes.