Skip to content

Remote comms: Basic Rate Limiting #661

@sirtimid

Description

@sirtimid

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

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions