Fix/wallet rate limiter unused#288
Open
deltron-fr wants to merge 2 commits intoSuncrest-Labs:mainfrom
Open
Conversation
|
@deltron-fr 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! 🚀 |
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 #252
Summary
middleware.WalletRateLimiterinto the production chain incmd/api/main.go, immediately afterAuthenticateso the bucket is keyed by the wallet address in the JWT claims (not the caller's IP). A single wallet can no longer bypass rate limits by rotating IPs across VPNs, proxies, or Tor.RATELIMIT_WALLET_LIMIT(default60) andRATELIMIT_WALLET_WINDOW(default1m) to config with the same validation as the existing global and write limits. Documented in.env.example.walletKeyFromContexthelper that pulls the wallet from the authenticatedauth.User; unauthenticated requests produce an empty key and pass through the wallet limiter (public routes are still covered by the IP and write limiters that wrap the chain outside of auth).#252