mirror of
https://github.com/Such-Software/smirk-backend-core.git
synced 2026-10-17 07:21:32 +02:00
Add tiered per-IP rate limiting to the router, completing the assembly: - STRICT tier (~2 req/s, burst 20) on the unauthenticated, abuse-prone surface: /api/v1/auth/* and /api/v1/website/*. This closes the website-challenge growth vector (the prior rate-limit LOW): an unauthenticated flood of challenge requests is now throttled per IP. - NORMAL tier (~10 req/s, burst 60) on the authenticated wallet/identity API. - PeerIpKeyExtractor keys on the peer IP; `main` now serves with into_make_service_with_connect_info::<SocketAddr> so the IP is available, and the test harness injects a loopback ConnectInfo (each test builds a fresh router with fresh limiter state). Over-limit returns 429. The limiter sits inside the global layers (CORS/timeout/ body/compression/trace) and in front of the handlers. L1 test proves it throttles: a 40-request burst to a strict-tier route returns 429 (the governor runs before the handler, so even unauthenticated requests count). All 33 integration tests + 114 lib tests pass through the fully-layered router; openapi unchanged.