Repository navigation
Render the MFA QR for an account whose factor step is pending - #69
Open
dyussekeyev wants to merge 1 commit into
Open
dyussekeyev wants to merge 1 commit into
dyussekeyev wants to merge 1 commit into
Conversation
The credential-onboarding gate listed `mfa/setup` and `mfa/enable` as part of the factor step and not `mfa/qr`, so the image the page requests straight after `setup` answered 200 came back as a 403 from the gate. An administrator the deployment policy holds on that page could only type the secret by hand.
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.
What
GET /api/v1/auth/mfa/qranswered 403 during enrolment, whilePOST /api/v1/auth/mfa/setup(200) andPOST /api/v1/auth/mfa/enable(200)worked. The enrolment page asks for the QR immediately after
setup, so thepicture never appeared and only manual secret entry remained.
Why
mfa_qrresolvesrequire_self_service, which runs the credential-onboardinggate in
backend/app/api/deps.py._ONBOARDING_MFA_ALLOWEDlistedsetupandenable— the two calls that complete the factor step — but notqr, whichmerely renders the pending secret
setuphas just written. The endpoint itselfnever answers 403: it returns 409 when nothing is pending or 200 with the SVG.
The practical effect: an administrator forced into enrolment by
REQUIRE_MFA_FOR_ADMINScould not scan a code at all.Fix
/api/v1/auth/mfa/qrjoins_ONBOARDING_MFA_ALLOWED, with the comment sayingwhy it belongs to the step rather than behind it. No other behaviour changes:
the gate still refuses the rest of the platform, and
qrstill requires apending secret.
Test
tests/test_onboarding.py::TestTheGate::test_the_factor_step_can_show_the_qr_of_the_secret_it_just_issued— account with
must_enrol_mfa,setup200, thenqr200 andcontent-type: image/svg+xml.Verified red then green: with the route removed from the set the test fails with
assert 403 == 200; with it restored it passes.Checks
pytest tests/test_onboarding.py tests/test_mfa.py tests/test_auth_edges.py— 103 passedruff check app/api/deps.py tests/test_onboarding.py— All checks passed