Skip to content

Add Rate Limiting to TOTP related routes #1706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pano9000 opened this issue Apr 15, 2025 · 1 comment
Open

Add Rate Limiting to TOTP related routes #1706

pano9000 opened this issue Apr 15, 2025 · 1 comment

Comments

@pano9000
Copy link
Member

Describe feature

Add Rate Limiting to Login related routes, to make brute forcing a lot less practicable

Additional Information

No response

@pano9000 pano9000 self-assigned this Apr 15, 2025
@pano9000 pano9000 changed the title Add Rate Limiting to Login related routes Add Rate Limiting to TOTP related routes Apr 15, 2025
@pano9000 pano9000 removed their assignment Apr 15, 2025
@pano9000
Copy link
Member Author

loginRateLimiter for the /login route itself is already there:

    const loginRateLimiter = rateLimit({
        windowMs: 15 * 60 * 1000, // 15 minutes
        max: 10, // limit each IP to 10 requests per windowMs
        skipSuccessfulRequests: true // successful auth to rate-limited ETAPI routes isn't counted. However, successful auth to /login is still counted!
    });

    route(PST, "/login", [loginRateLimiter], loginRoute.login);

however it is not applied to the totp related routes → we need to check, for which routes it would make sense here:

   apiRoute(GET, '/api/totp/generate', totp.generateSecret);
    apiRoute(GET, '/api/totp/status', totp.getTOTPStatus);
    apiRoute(GET, '/api/totp/get', totp.getSecret);

    apiRoute(GET, '/api/oauth/status', openID.getOAuthStatus);
    apiRoute(GET, '/api/oauth/validate', openID.isTokenValid);

    apiRoute(PST, '/api/totp_recovery/set', recoveryCodes.setRecoveryCodes);
    apiRoute(PST, '/api/totp_recovery/verify', recoveryCodes.verifyRecoveryCode);
    apiRoute(GET, '/api/totp_recovery/generate', recoveryCodes.generateRecoveryCodes);
    apiRoute(GET, '/api/totp_recovery/enabled', recoveryCodes.checkForRecoveryKeys);
    apiRoute(GET, '/api/totp_recovery/used', recoveryCodes.getUsedRecoveryCodes);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant