Skip to content

egress-relay: bound connections before public deploy (thread cap + idle/read timeout) #463

Description

@w1ne

The fixed-target WebSocket egress relay (crates/egress-relay) spawns one unbounded thread per accepted connection, and serve_connection's ws.read() blocks indefinitely with no idle/read timeout. A client that connects, sends a valid hello, then goes silent pins a thread + its backend socket forever; many such connections exhaust threads/FDs.

This is the abuse risk the design spec flagged as in-scope-before-public-deploy. The MVP is safe behind a non-public bind, but this must be closed before the relay is exposed (Task 6 live demo).

Fixes to make:

  • per-IP connection cap
  • idle / read timeout on ws.read()
  • wire a real tracing subscriber so the "rejected egress target" security log actually surfaces (currently a NoSubscriber stub swallows it)

Ref: docs/superpowers/specs/2026-07-04-browser-egress-ws-relay-design.md (Non-goals / risks).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions