fix: secure MFA — server-side TOTP secret, local QR code, WebAuthn counter#2171
Open
Wachhund wants to merge 1 commit into
Open
fix: secure MFA — server-side TOTP secret, local QR code, WebAuthn counter#2171Wachhund wants to merge 1 commit into
Wachhund wants to merge 1 commit into
Conversation
…WebAuthn counter check - Generate TOTP QR codes locally via 'qrcode' package instead of leaking secrets to api.qrserver.com as query parameters - Store TOTP enrollment secret server-side in Redis with 10min TTL, retrieve during verification instead of trusting client-provided secret - Add WebAuthn counter monotonicity check to prevent replay attacks - Add TODO markers for full @simplewebauthn/server integration
Author
|
Note on CI/hooks: The pre-commit (ESLint) and pre-push (typecheck) hooks failed due to pre-existing issues in the codebase, not related to this PR's changes:
The actual changes in this PR ( |
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.
Summary
Three critical MFA security fixes:
api.qrserver.comas query parameters during enrollment, exposing them in third-party access logs. Now generates QR codes locally using theqrcodenpm packageverifyTotpEnrollment()accepted the TOTP secret from the client request body, allowing an attacker to enroll their own known secret. Now stores the server-generated secret in Redis during enrollment (10min TTL) and retrieves it during verificationverifyWebauthnAssertion()— rejects assertions where the counter is not strictly greater than the stored value. Also adds TODO markers for full@simplewebauthn/serverintegration (requires API contract changes)Related Issues
Test plan