GPT-6.1 Sol · Balanced

feat-2fa-backup-codes-cal-com

cal.com · TypeScript · M · 100–299 lines · 6 files

The normal review, with one generalist agent. Judge: Claude Haiku 5.5.

Gold bugs found
1 of 1
Comments published
3
Comments matching a bug
1
Comments not matching
2
Cost of this PR
$0.828

Published comments (3)

highsecuritypackages/features/auth/lib/next-auth-options.ts:131

Backup-code login bypasses password verification when a TOTP code is supplied — A valid `backupCode` paired with any nonempty `totpCode` grants access to a password-based account without its password. Verify `credentials.password` for `IdentityProvider.CAL` accounts regardless of second-factor fields before entering the backup-code branch.

highsecuritypackages/features/auth/lib/next-auth-options.ts:147-155

Concurrent logins can reuse or restore single-use backup codes — Unconditional writes to `backupCodes` let concurrent requests authenticate with the same code or restore another request’s consumed code. Consume codes atomically with a conditional update matching the previously read `user.backupCodes`, and reject or retry if no rows change.

mediumbugapps/web/components/settings/EnableTwoFactorModal.tsx:134-135

Dismissing backup codes bypasses 2FA completion and leaves settings stale — Dismissing `SetupStep.DisplayBackupCodes` with Escape or an outside click skips `onEnable`, leaving `viewer.me` and the settings switch stale after successful enablement. Make dismissal invoke `onEnable` and reset `EnableTwoFactorModal`, or prevent dismissal until the explicit Close action.

Gold bugs found (1)

criticalThe credentials authorize() skips the password check when any totpCode is present, and the new backup-code branch never validates that totpCode, so a backup code plus a dummy totpCode logs in without the account password.

Gold bugs missed (0)

None.