diff options
| author | bndw <ben@bdw.to> | 2026-02-14 21:53:14 -0800 |
|---|---|---|
| committer | bndw <ben@bdw.to> | 2026-02-14 21:53:14 -0800 |
| commit | 32ca0fba5108d0dc2c7415f36e55f031d5a0562e (patch) | |
| tree | ff91309ef9af7d0ec8c9b5bd5b6f39f073d4be55 /internal/storage/storage.go | |
| parent | e647880669b79cd968231cf85dc037a18e8bfd9c (diff) | |
feat: add rate limiting to WebSocket connections
WebSocket clients were completely unprotected from abuse. Add RateLimiter
interface to WebSocket handler and enforce limits on EVENT and REQ messages.
- Add RateLimiter interface with Allow(identifier, method) method
- Track client IP in connState (proxy-aware via X-Forwarded-For)
- Check rate limits in handleEvent and handleReq
- Use authenticated pubkey as identifier, fallback to IP
- Share same rate limiter instance with gRPC
- Add getClientIP() helper that checks proxy headers first
Critical security fix for production deployment. Without this, any client
could spam unlimited events/subscriptions via WebSocket.
Diffstat (limited to 'internal/storage/storage.go')
0 files changed, 0 insertions, 0 deletions
