Skip to content

Fix/wallet rate limiter unused#288

Open
deltron-fr wants to merge 2 commits intoSuncrest-Labs:mainfrom
deltron-fr:fix/wallet-rate-limiter-unused
Open

Fix/wallet rate limiter unused#288
deltron-fr wants to merge 2 commits intoSuncrest-Labs:mainfrom
deltron-fr:fix/wallet-rate-limiter-unused

Conversation

@deltron-fr
Copy link
Copy Markdown

@deltron-fr deltron-fr commented Apr 24, 2026

Closes #252


Summary

  • Wires the existing but unused middleware.WalletRateLimiter into the production chain in cmd/api/main.go, immediately after Authenticate so 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.
  • Adds RATELIMIT_WALLET_LIMIT (default 60) and RATELIMIT_WALLET_WINDOW (default 1m) to config with the same validation as the existing global and write limits. Documented in .env.example.
  • Adds a walletKeyFromContext helper that pulls the wallet from the authenticated auth.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

@deltron-fr deltron-fr requested a review from 0xDeon as a code owner April 24, 2026 19:52
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 24, 2026

@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! 🚀

Learn more about application limits

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

Successfully merging this pull request may close these issues.

[Backend] Per-wallet rate limiter is defined but never wired — only coarse IP-based limits are active

1 participant