Kept internal under SECURITY.md: this one is exploitable. The GitHub advisory goes out with the fix.
The Node upgrade listener (src/http/ws.ts:104) matches WebSocket routes with no error boundary. A request for /bad% with an upgrade header, against any WS route that has a parameter (/ws/:id), throws URIError from decodeSegment (src/http/router.ts:294) inside an event listener. That is an uncaught exception, and the process exits. One unauthenticated request takes down every connection.
Fix: normalize and validate the path with normalizeRequestPath, which also fixes GitHub #42. Wrap matching in try/catch, and answer 400 and destroy the socket on failure. Test: an upgrade to /ws/bad% gets a 400 and the server keeps serving.
Kept internal under SECURITY.md: this one is exploitable. The GitHub advisory goes out with the fix.
The Node `upgrade` listener (src/http/ws.ts:104) matches WebSocket routes with no error boundary. A request for `/bad%` with an upgrade header, against any WS route that has a parameter (`/ws/:id`), throws `URIError` from `decodeSegment` (src/http/router.ts:294) inside an event listener. That is an uncaught exception, and the process exits. One unauthenticated request takes down every connection.
**Fix:** normalize and validate the path with `normalizeRequestPath`, which also fixes [GitHub #42](https://github.com/Expressive-Tea/green-tea/issues/42). Wrap matching in try/catch, and answer `400` and destroy the socket on failure. **Test:** an upgrade to `/ws/bad%` gets a 400 and the server keeps serving.
Fixed in 26.11.0-rc.1 (59763c9). From the changelog:
A malformed WebSocket upgrade no longer takes a Node server down (#104). The upgrade path never ran the request-path normalization HTTP runs, so a bad percent escape in a param segment (/room/%E0%A4%A) threw out of the 'upgrade' listener as an uncaught exception, and one request was enough to end the process. Upgrades now go through the same normalization: a malformed escape or a repeated slash gets a 400, an unknown route a written 404 instead of a silent disconnect, and anything else that throws in the listener a 500. //rt//echo used to match /rt/echo on upgrade while HTTP refused it; both refuse it now. On Deno, Bun and the edge the same paths close with 1008 invalid request path rather than 1011 internal error, and on Deno a 1008 sent before the socket finished opening now reaches the client instead of leaving it hanging.
Fixed in **26.11.0-rc.1** (`59763c9`). From the changelog:
- **A malformed WebSocket upgrade no longer takes a Node server down** (#104). The upgrade path never ran the request-path normalization HTTP runs, so a bad percent escape in a param segment (`/room/%E0%A4%A`) threw out of the `'upgrade'` listener as an uncaught exception, and one request was enough to end the process. Upgrades now go through the same normalization: a malformed escape or a repeated slash gets a `400`, an unknown route a written `404` instead of a silent disconnect, and anything else that throws in the listener a `500`. `//rt//echo` used to match `/rt/echo` on upgrade while HTTP refused it; both refuse it now. On Deno, Bun and the edge the same paths close with `1008 invalid request path` rather than `1011 internal error`, and on Deno a `1008` sent before the socket finished opening now reaches the client instead of leaving it hanging.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Kept internal under SECURITY.md: this one is exploitable. The GitHub advisory goes out with the fix.
The Node
upgradelistener (src/http/ws.ts:104) matches WebSocket routes with no error boundary. A request for/bad%with an upgrade header, against any WS route that has a parameter (/ws/:id), throwsURIErrorfromdecodeSegment(src/http/router.ts:294) inside an event listener. That is an uncaught exception, and the process exits. One unauthenticated request takes down every connection.Fix: normalize and validate the path with
normalizeRequestPath, which also fixes GitHub #42. Wrap matching in try/catch, and answer400and destroy the socket on failure. Test: an upgrade to/ws/bad%gets a 400 and the server keeps serving.Fixed in 26.11.0-rc.1 (
59763c9). From the changelog:/room/%E0%A4%A) threw out of the'upgrade'listener as an uncaught exception, and one request was enough to end the process. Upgrades now go through the same normalization: a malformed escape or a repeated slash gets a400, an unknown route a written404instead of a silent disconnect, and anything else that throws in the listener a500.//rt//echoused to match/rt/echoon upgrade while HTTP refused it; both refuse it now. On Deno, Bun and the edge the same paths close with1008 invalid request pathrather than1011 internal error, and on Deno a1008sent before the socket finished opening now reaches the client instead of leaving it hanging.