Feature/issue 045 fingerprint ratelimit - #737
Merged
greatest0fallt1me merged 4 commits intoJul 29, 2026
Merged
Conversation
|
@ugoocreates-pixel Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Merging — thanks for staying scoped to the issue! |
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.
Closes #619
This PR addresses backend issue [b#045] by implementing a per-user token-bucket rate limit for the
/api/fingerprintendpoint. This ensures that we prevent abuse or excessive polling on the fingerprint route while returning a standard429 Too Many Requestsalong with aRetry-Afterheader when the limit is exceeded.Changes Made
src/config/env-schema.ts): Added configurable rate limit parametersFINGERPRINT_RATE_LIMIT_CAPACITY(default 60) andFINGERPRINT_RATE_LIMIT_WINDOW_MS(default 60,000 ms).src/middleware/rateLimit.ts): Exported a pre-configuredfingerprintRateLimiterutilizingcreatePerUserTokenBucketLimiter.src/routes/fingerprint.ts): Injected the rate limit middleware into theGET /api/fingerprintroute.tests/fingerprint.test.ts): Added an integration test that isolates an IP and exhausts the rate limit to verify that the 61st request correctly returns a429status code, the appropriate error code payload (rate_limit_exceeded), and theRetry-Afterheader.Validation & Guidelines
{ error: { code, ... } }).