Do not allow accessing PhoneSetupController unless you are in account setup#8265
Merged
mitchellhenke merged 1 commit intomainfrom Apr 25, 2023
Conversation
changelog: Bug Fixes, Account Management, Require being in account setup when accessing the PhoneSetupController
aduth
approved these changes
Apr 24, 2023
Comment on lines
+96
to
+98
| return if user_fully_authenticated? && in_multi_mfa_selection_flow? | ||
| return unless MfaPolicy.new(current_user).two_factor_enabled? | ||
| redirect_to account_path |
Contributor
There was a problem hiding this comment.
Between this and confirm_user_authenticated_for_2fa_setup, trying to think of a scenario where it's not sufficient to just check for in_multi_mfa_selection_flow? ?
Suggested change
| return if user_fully_authenticated? && in_multi_mfa_selection_flow? | |
| return unless MfaPolicy.new(current_user).two_factor_enabled? | |
| redirect_to account_path | |
| redirect_to account_path unless in_multi_mfa_selection_flow? |
Contributor
Author
There was a problem hiding this comment.
I think we could drop the user_fully_authenticated? part, but the other one I think needs to remain since most tests do not go through MFA selection :/
Merged
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 of changes
The
Users::PhoneSetupControlleris intended for use by users that are in account registration. Users that are not in account setup use theUsers::PhonesControllerandUsers::EditPhoneController, both of which require recent authentication. To prevent users from managing 2FA without being recently authenticated, this PR adds a check so that only users going through account registration can access this controller.