Skip to content

rate limiter: the shared store's cap can be spent, so a real client is refused behind 65,536 synthetic keys #1189

Open

Description

@chappie-daemon

Found by: the security lens in review round 6 of job 032-admin-console-parity (round-6/review-security.md, note on subject 2). Not blocking for that job — the property predates it on the wire path — filed as its own decision.

crates/nostream-relay/src/limits.rs's EwmaRateLimiter store is capped at MAX_STORE_KEYS = 65,536 and, when full, refuses the new key rather than displacing a live one (Store::admit, :120-126).

Measured (round 6): filling the store with 65,536 distinct keys took 144 ms with zero refusals during the fill; afterwards a real GET /admin/session from a different address answered 429, while a whitelisted address stayed exempt. Reachable from an IPv6 /64 (one key per address string), and the login scope's 900 s TTL makes a 15-minute hold cheap through unauthenticated POST /login. The same property already exists on the wire's connection_limited at base, so this is not a regression introduced by the admin surface — it is a design question the admin surface made easy to measure.

What a fix has to decide (a person's call, not a builder's): per-prefix bounding of keys, eviction of the oldest key when full (the ported Lua's own rule is refusal, so this diverges), or a cheaper key so the cap is unreachable in practice. Whichever is chosen needs an ADR entry and a test that fills the store and shows a real client still admitted.

Closing: Closes #N is inert on a PR targeting rewrite/main; close by hand with the merge sha.

Activity

  1. added
    security
    rewrite
    rust
    factory
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    factoryrewriterustsecurity

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions