-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Admin MFA required check #51618
Fix Admin MFA required check #51618
Conversation
Should we lock the behavior in with test coverage? |
f0d717f
to
665c09b
Compare
@@ -9545,15 +9545,15 @@ func TestIsMFARequired_AdminAction(t *testing.T) { | |||
name: "mfa verified", | |||
adminActionAuthState: authz.AdminActionAuthMFAVerified, | |||
expectResp: &proto.IsMFARequiredResponse{ | |||
Required: false, | |||
MFARequired: proto.MFARequired_MFA_REQUIRED_NO, | |||
Required: true, |
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.
Do you think it's worth testing these using CreateAuthenticationChallenge instead? I've read the PR description a few times now but I confess I'm still a bit confused by it.
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.
CreateAuthenticateChallenge
calls authWithRoles.IsMFARequired
directly, so I think it's ok. I reorganized the PR description, hopefully the relation makes more sense now.
…om admin action mfa ceremony.
Since we aren't backporting #46891, I'll skip this backport as well. |
* Fix admin mfa required check. * Fix test. * Add client fallback mechanism by removing pre-existing mfa context from admin action mfa ceremony.
The MFA required check for admin actions would take into account whether the
IsMFARequired
(orCreateAuthenticationChallenge
) request itself was admin-mfa-verified. This could potentially cause two problems:CreateAuthenticationChallenge
will callIsMFARequired
and incorrectly think that it is already MFA verified.IsMFARequired
orCreateAuthenticationChallenge
consumes the MFA response and returns that MFA is not required.This PR changes
IsMFARequired
now just checks if Admin Action MFA is strictly not required - Whether because it's not enforced (totp allowed), disabled (TELEPORT_UNSTABLE_DISABLE_MFA_ADMIN_ACTIONS
), or the identity asking is a built role.There are no bugs presently caused by this issue, but it is needed for some UX improvements like #46891.