Skip to content

Apply an admission quota to authenticated exec WebSocket upgrade failures #546

Done

Description

@samuelmbabhazi

Priority: P3, resource hardening. Reviewed at main deff5f6.

The exec WebSocket upgrade limiter counts Origin/cookie/authentication failures, but not rejected upgrades after authentication succeeds. A signed-in client can repeatedly request a well-formed, nonexistent exec-session ID without consuming this limiter, while each request still authenticates the session against storage.

Conditions and impact

The client needs a valid browser session and the expected Origin header. It does not need container.exec permission or a real exec session: the unknown-ID branch returns before the tenant permission check. The listener handles the server's upgrade event directly, so Nest HTTP route guards do not supply an admission quota for this path.

The resulting exposure is repeated authentication work and session-activity writes without an effective quota on this refusal path. No shell is opened and no authorization bypass is demonstrated. This is a bounded hardening finding, not a demonstrated denial of service: no live load, database contention or service saturation was measured. Other infrastructure may impose additional limits, and the ordinary HTTP authentication path also performs authentication before its route limiter.

Evidence and reproduction

A bounded local probe invoked the real upgrade handler 100 times sequentially with the same synthetic source IP, an authentication stub returning a valid user, and an unknown, correctly shaped session ID. It observed 100 authentication calls, 100 HTTP 404 responses, zero failure entries and throttled=false. Socket, authentication and registry dependencies were fake; no actual cookie authentication, TLS connection, database write or load test was performed. Storage work follows from the production authentication implementation cited above.

Proposed correction and acceptance criteria

Introduce a bounded admission budget before expensive authentication, or otherwise ensure authenticated upgrade refusals consume an effective budget. Account for legitimate reconnects and shared source addresses; preserve uniform resource-hiding responses.

  • Repeated unknown-ID upgrades with a valid session eventually stop before another authentication call.
  • Unauthorized/already-joined refusals cannot evade the configured budget.
  • Budget expiry permits legitimate use again, and normal session joins still work.
  • Tests cover authenticated and unauthenticated failures, reconnects and concurrent requests.
  • Limiter state itself remains bounded and uses the existing trusted-proxy address policy.

Publication check (2026-11-27): main advanced to 817f6ac3b00fdb0e81331e519abc5668a1560aee through #539. The affected production paths cited above are unchanged; the source links retain the audited revision.

Activity

  1. added
    enhancement
    priority:P3
    on Nov 27, 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

    enhancementpriority:P3securitytrack:control-plane

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions