feat(seed): enroll TOTP auth factors from user config - #77
Merged
Conversation
Factors were the one authentication method a seed could not give a user — password and oauth_provider already are — so anything touching MFA administration needed post-boot enrollment calls whose state a restart loses: the environment came back with its users but no factors, and an empty ListAuthFactors is indistinguishable from "this user has no MFA". `totp: true` writes the same record the enrollment route writes, so the seeded factor is listed by GET .../auth_factors and drives the password grant's existing mfa_challenge step-up.
Greptile SummaryThe PR adds declarative TOTP-factor enrollment for seeded users and integrates those factors with the existing MFA challenge flow.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the previous YAML parsing documentation issue is corrected, and the configured parser and validation path match the revised explanation. Important Files Changed
|
The comment claimed YAML parses `totp: yes` to true, but the CLI's yaml v2 parser follows YAML 1.2, where `yes` — and `no` — are plain strings. Both are truthy, which is the actual hazard the check guards against: `totp: no` would otherwise enroll a factor the config explicitly declined.
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.
Summary
totp: truetoWorkOSSeedUser: the seed inserts the samews.authFactorsrecordPOST /user_management/users/{id}/auth_factorswrites (object: 'authentication_factor',type: 'totp',totp: { issuer, user, uri }), defaultingissuertoWorkOS Emulatorthe way that route does.passwordandoauth_provideralready are — so MFA administration needed post-boot enrollment calls whose state a restart loses, and an emptyListAuthFactorswas indistinguishable from "this user has no MFA".mfa_challenge(pending token + challenge) instead of a session, completed with theurn:workos:oauth:grant-type:mfa-totpgrant. The new spec walks that whole flow end to end.validateSeedConfigrejects a non-booleantotp(YAML'stotp: yesparses totrue, buttotp: "yes"would not), and the README documents the key under a new "Seeded MFA factors" section.On the optional pinned
totp_secret: left out, deliberately. Challenge verification compares the submitted code against the challenge's stored one-time code — it never computes a TOTP from the factor's secret — so a pinned secret would only make the otpauth URI deterministic while implying that a client can compute valid codes from it, which it can't. If real TOTP computation lands someday, atotp_secretseed key would make sense alongside it.Fixes #75