generated from MetaMask/metamask-module-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
ocap-enhancementOCAP Kernel enhancementOCAP Kernel enhancement
Description
Problem: The remote communications system lacks rate limiting, making it vulnerable to both accidental and intentional message flooding. Without limits, peers can overwhelm the system with excessive messages or connection attempts.
Expected Behavior:
- Track message count per peer with a sliding window of 1 second
- Limit to 100 messages per second per peer
- Limit connection attempts to 10 attempts per minute per peer
- When limits are exceeded, queue messages up to the queue limit, then drop new messages with an error log
Implementation:
- Add per-peer message count tracking with sliding window (1 second)
- Track connection attempt timestamps per peer
- Implement rate limit checks before sending messages and before dialing connections
- When message rate limit exceeded: queue if queue has space, otherwise drop and log error
- When connection rate limit exceeded: reject connection attempt and log error
- Coordinate with existing message queueing system
Acceptance Criteria:
- Maximum 100 messages per second per peer enforced
- Maximum 10 connection attempts per minute per peer enforced
- Messages are queued when rate limit approached (up to queue capacity)
- Messages are dropped with error log when queue full and rate limit exceeded
- Tests verify rate limiting behavior and queue/drop logic
Metadata
Metadata
Assignees
Labels
ocap-enhancementOCAP Kernel enhancementOCAP Kernel enhancement