Skip to content

Improve per-session MFA in a desktop session#52790

Merged
gzdunek merged 7 commits intomasterfrom
gzdunek/mfa-desktop
Mar 6, 2025
Merged

Improve per-session MFA in a desktop session#52790
gzdunek merged 7 commits intomasterfrom
gzdunek/mfa-desktop

Conversation

@gzdunek
Copy link
Copy Markdown
Contributor

@gzdunek gzdunek commented Mar 5, 2025

This PR fixes two bugs:

  1. If no WebAuthn MFA device is added, the UI gets stuck on a desktop loading screen indefinitely. Under the hood we receive "webauthn_challenge":null,"totp_challenge":false,"sso_challenge":null, which causes a runtime error in useMfa. To prevent this, I added a backend check to ensure empty challenges are not sent for desktop sessions (inspired by a similar check for SSH sessions). This is how it looks:

    image
  2. If you close the MFA dialog, you end up on a loading screen. This happened because the cancelation error wasn't handled. Now, the error is displayed using our Alert component:
    image

changelog: Web UI now properly shows per-session MFA errors in desktop sessions

Comment thread web/packages/teleport/src/lib/useMfa.test.tsx
Copy link
Copy Markdown
Collaborator

@zmb3 zmb3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please make sure we do some spot checks with per-session MFA for SSH and Kube as well.

Comment thread lib/web/desktop.go Outdated
Comment thread web/packages/teleport/src/lib/useMfa.test.tsx
Comment thread web/packages/teleport/src/lib/useMfa.ts Outdated
Comment thread lib/web/desktop.go
gzdunek added 3 commits March 6, 2025 19:35
# Conflicts:
#	web/packages/teleport/src/DesktopSession/DesktopSession.tsx
@gzdunek
Copy link
Copy Markdown
Contributor Author

gzdunek commented Mar 6, 2025

LGTM, please make sure we do some spot checks with per-session MFA for SSH and Kube as well.

I tested SSH, Kube and DBs in Web UI, they all display an error message if the user doesn't have a supported MFA method available.

@gzdunek gzdunek enabled auto-merge March 6, 2025 18:48
@gzdunek gzdunek added this pull request to the merge queue Mar 6, 2025
Merged via the queue into master with commit 522bd4e Mar 6, 2025
46 checks passed
@gzdunek gzdunek deleted the gzdunek/mfa-desktop branch March 6, 2025 19:27
@public-teleport-github-review-bot
Copy link
Copy Markdown

@gzdunek See the table below for backport results.

Branch Result
branch/v15 Failed
branch/v16 Failed
branch/v17 Failed

gzdunek added a commit that referenced this pull request Mar 7, 2025
* Do not try to send an empty MFA challenge in a desktop session

* Prevent a runtime error when neither a challenge nor a request is present

* Do not overwrite MFA errors with a custom message, show an error when the MFA dialog is closed

* Fix a test so that either a request or a challenge is passed

* Desktop Access -> Desktop access

* Reduce nesting

(cherry picked from commit 522bd4e)
gzdunek added a commit that referenced this pull request Mar 10, 2025
* Do not try to send an empty MFA challenge in a desktop session

* Prevent a runtime error when neither a challenge nor a request is present

* Do not overwrite MFA errors with a custom message, show an error when the MFA dialog is closed

* Fix a test so that either a request or a challenge is passed

* Desktop Access -> Desktop access

* Reduce nesting

(cherry picked from commit 522bd4e)
gzdunek added a commit that referenced this pull request Mar 10, 2025
* Do not try to send an empty MFA challenge in a desktop session

* Prevent a runtime error when neither a challenge nor a request is present

* Do not overwrite MFA errors with a custom message, show an error when the MFA dialog is closed

* Fix a test so that either a request or a challenge is passed

* Desktop Access -> Desktop access

* Reduce nesting

(cherry picked from commit 522bd4e)
github-merge-queue bot pushed a commit that referenced this pull request Mar 17, 2025
* Do not try to send an empty MFA challenge in a desktop session

* Prevent a runtime error when neither a challenge nor a request is present

* Do not overwrite MFA errors with a custom message, show an error when the MFA dialog is closed

* Fix a test so that either a request or a challenge is passed

* Desktop Access -> Desktop access

* Reduce nesting

(cherry picked from commit 522bd4e)
github-merge-queue bot pushed a commit that referenced this pull request Mar 17, 2025
* Do not try to send an empty MFA challenge in a desktop session

* Prevent a runtime error when neither a challenge nor a request is present

* Do not overwrite MFA errors with a custom message, show an error when the MFA dialog is closed

* Fix a test so that either a request or a challenge is passed

* Desktop Access -> Desktop access

* Reduce nesting

(cherry picked from commit 522bd4e)
github-merge-queue bot pushed a commit that referenced this pull request Mar 18, 2025
* Do not try to send an empty MFA challenge in a desktop session

* Prevent a runtime error when neither a challenge nor a request is present

* Do not overwrite MFA errors with a custom message, show an error when the MFA dialog is closed

* Fix a test so that either a request or a challenge is passed

* Desktop Access -> Desktop access

* Reduce nesting

(cherry picked from commit 522bd4e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants