-
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
Add a null check to getMfaChallengeResponse
#50570
Conversation
Why the app access bug is present on branch/v17 but not on masterAs discussed on Slack, on branch/v17, the faulty
teleport/web/packages/teleport/src/services/apps/apps.ts Lines 51 to 60 in f4891b5
On master, that function is not called at all and the code for handling MFA returns early if teleport/web/packages/teleport/src/AppLauncher/AppLauncher.tsx Lines 121 to 123 in f9b61a0
teleport/web/packages/teleport/src/lib/useMfa.ts Lines 86 to 90 in f9b61a0
Broken password change flow with
|
const reauthOptions = getReauthOptions(mfaOptions, hasPasswordless); | |
setReauthMethod(reauthOptions[0].value); |
This throws an error, as reauthOptions
is empty if there's no MFA options available.
I don't know how many customers actually use TELEPORT_ALLOW_NO_SECOND_FACTOR
, but it's an issue we should probably solve separately from this specific problem.
As it is, the easiest way to check if this PR fixes the problem is to cherry pick it on branch/v17.
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 fixes the problem on v17.
I wanted to suggest adding some tests, but SSO MFA is going to land in v17 and useMfa
already has tests for when MFA is not required.
Since strict null checks are not enabled, another option to guarantee that the "no MFA challenge" is always handled would be to use a discriminated union, e.g. { kind: 'no-challenge' } | { kind: 'challenge', foo: Bar }
. This would also help with adding null checks "just in case", as functions that actually need to work on a challenge could accept only the union variant with the challenge.
It's tempting to use { required: false } | { required: true, foo: Bar }
. Unfortunately, discriminated unions on boolean fields don't work well with strict null checks turned off.
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.
Thanks @ravicious
Changelog: Fixed a bug in the WebUI that could cause an access denied error when accessing application.
Fix a bug caused by #49679 which was meant to check for null/undefined.
Closes #50556