MiniMax M3 · 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
- 0 of 1
- Comments published
- 2
- Comments matching a bug
- 0
- Comments not matching
- 2
- Cost of this PR
- $0.239
Published comments (2)
TOCTOU race in backup-code consumption allows single-use code reuse — The read-modify-write of `backupCodes` is non-atomic, so two concurrent logins both pass `indexOf` before either `prisma.user.update` commits and the same code authenticates twice. Switch to an atomic update conditioned on the prior encrypted value, or store codes individually so DELETE-by-value is atomic.
Unguarded body.backupCodes dereference crashes DisplayBackupCodes render — In `EnableTwoFactorModal.tsx`, `handleSetup` calls `body.backupCodes.map` without verifying the field exists, so a malformed response throws inside the catch and leaves the user at an empty `DisplayBackupCodes`. Guard with `Array.isArray(body.backupCodes)` before mapping, or route to the error branch.
Gold bugs found (0)
None.