fix: remove duplicate imports and routes in authRoutes.js - #1201
Open
saidai-bhuvanesh wants to merge 1 commit into
Open
fix: remove duplicate imports and routes in authRoutes.js#1201saidai-bhuvanesh wants to merge 1 commit into
saidai-bhuvanesh wants to merge 1 commit into
Conversation
|
@saidai-bhuvanesh is attempting to deploy a commit to the Nitya Gosain's projects Team on Vercel. A member of the Team first needs to authorize it. |
saidai-bhuvanesh
force-pushed
the
fix/duplicate-imports-routes-authRoutes
branch
from
August 8, 2026 16:58
81faf22 to
f50de85
Compare
backend/routes/authRoutes.js defined the wallet-auth and profile routes twice — once with rate limiters (lines 68-76) and again as a bare single-quoted block (lines 91-96) that re-registered /nonce, /wallet-login, /wallet-register, /set-fallback-password and PUT /profile without the swagger docs, leaving only DELETE /profile unique. Duplicate route registration is a security and correctness hazard: the second registration shadows the first and, for the rate-limited wallet routes, an attacker could hit the unprotected shadow route to brute-force wallet auth. Remove the duplicate block entirely, keeping the documented, rate-limiter-protected first definitions plus the unique DELETE /profile route. Every wallet auth route now has exactly one registration with its rate limiter intact. Closes Nitya-003#1202
saidai-bhuvanesh
force-pushed
the
fix/duplicate-imports-routes-authRoutes
branch
from
August 15, 2026 03:47
f50de85 to
aefe0f1
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.
Summary
Fixes #1202
backend/routes/authRoutes.jsregistered the wallet-authentication and profile routes twice:GET /nonceauthLimiter✅POST /wallet-loginauthLimiter✅POST /wallet-registerregisterLimiter✅POST /set-fallback-passwordprotect✅PUT /profileOnly
DELETE /profilewas unique to the second block.Why this is a security issue
Express matches routes in registration order, but the second (bare) block re-registered the rate-limited wallet routes without their limiters. Re-registration creates a shadow path an attacker can hit to brute-force wallet authentication / nonce enumeration without throttling — exactly the abuse the
authLimiter/registerLimitermiddleware exists to prevent. It is also a maintenance hazard (which handler actually runs?) and applies middleware twice.Fix
Delete the entire duplicate single-quoted block (old lines 91–96), keeping:
/nonce,/wallet-login,/wallet-register,/set-fallback-password,PUT /profile), andDELETE /profileroute (moved up next toPUT /profile).Every route is now registered exactly once, with its rate limiter /
protectmiddleware intact.node --check backend/routes/authRoutes.jspasses.Files
backend/routes/authRoutes.jsSecurity checklist
This PR was created by an AI agent (OpenHands) on behalf of @saidai-bhuvanesh.