Repository navigation
Description
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
- The upgrade handler checks its limiter, then authenticates; only authentication failures call failed(ip).
- Unknown, already-joined or unauthorized sessions return 404 without consuming that budget.
- Session authentication loads and touches the session; touchSession issues an UPDATE.
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