-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
mfa: prevent the user from deleting the last MFA device #6585
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
SecondFactorOTP
mean there can be no U2F devices stored for the user? If a user had a single OTP device but he intended to delete some of the (now unusable) U2F devices, wouldn't this error be incorrectly returned since the type of the device to be deleted doesn't seem to be taken into account?Analogically for
SecondFactorU2F
when deleting an OTP device.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block only returns an error if cluster requires
SecondFactorOTP
and there is exactly 1 OTP device registered (regardless of how many U2F devices there are).Same thing for
SecondFactorU2F
, the error only happens when there's 1 U2F device, regardless of any OTP devices.Maybe I misunderstand the question?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I understand that.
My worry is that this error would be returned even if a user requested to delete an U2F device and not the last OTP device. In other words, the type of the device to be deleted should be checked and the user should not be prevented from deleting an U2F device even if there is only a single OTP device left.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OTP is a sub-type of MFA, not a separate group.
Each user has multiple MFA devices. Each of those devices is either U2F or OTP.
In the loop above I calculate the number of devices of each type (
numTOTPDevs
andnumU2FDevs
).Does that clarify the logic?