fix: bypass passwordless login when totpSecret is configured#520
Open
awsl1414 wants to merge 1 commit into
Open
fix: bypass passwordless login when totpSecret is configured#520awsl1414 wants to merge 1 commit into
awsl1414 wants to merge 1 commit into
Conversation
When a user has configured totpSecret for automatic TOTP code entry, the script should not wait for manual authenticator approval. Instead, click 'Other ways to sign in' to navigate to the password entry page, which will then lead to the TOTP code input where the secret can be used automatically. The fix follows the existing bypass pattern used by GET_A_CODE and OTP_CODE_ENTRY handlers, reusing the same otherWaysToSignIn selector and ghostClick utility. State flow after fix: LOGIN_PASSWORDLESS → SIGN_IN_ANOTHER_WAY → PASSWORD_INPUT → 2FA_TOTP
a51710d to
8eb1f45
Compare
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.
Problem
When a user has configured
totpSecretinaccounts.jsonfor automatic TOTP 2FA, the script ignores it if Microsoft presents the passwordless (Authenticator push notification with number matching) page. TheLOGIN_PASSWORDLESShandler only waits passively for manual approval, with no attempt to switch to the TOTP entry method.This is especially problematic because Microsoft may skip the password entry step entirely for some accounts, going straight from email input to the Authenticator push notification page.
Root Cause
The
LOGIN_PASSWORDLESShandler inLogin.tscallsPasswordlessLogin.handle()which only:Unlike
GET_A_CODEandOTP_CODE_ENTRYhandlers which actively try to bypass the current page by clicking "Other ways to sign in", the passwordless handler has no such bypass logic.Fix
When
totpSecretis configured, theLOGIN_PASSWORDLESShandler now:"Other ways to sign in"link (reusesotherWaysToSignInselector)SIGN_IN_ANOTHER_WAY→ clicks"Use your password"PASSWORD_INPUT→ enters password2FA_TOTP→ auto-fills TOTP code from the secretIf the bypass fails (e.g., "Other ways to sign in" link not found), it gracefully falls back to the original manual approval flow.
Verified State Flow
Tested with MCP-connected browser debugging against a live account. Log output:
Changes
src/browser/auth/Login.ts— Added totpSecret bypass inLOGIN_PASSWORDLESShandler.gitignore— Added.mcp.jsonand.claude/(project tooling files)