Add uWebSockets.js - #151
Closed
MDA2AV wants to merge 2 commits into
Closed
Conversation
Requested upstream in uNetworking/uWebSockets.js#1298, where the maintainer asked to add uWS here and fix standards behaviour rather than chase benchmark lists. Implements the four probe endpoints with the idiomatic uWS API: any() routes with the wildcard registered last, req.forEach for /echo, and onData/onAborted with a cork()ed reply for the POST body echo. Header and cookie handling mirror the Node and Express servers so the three stay comparable. uWS is not on the npm registry, so the dependency is pinned to the v20.69.0 release tarball — release tags carry prebuilt .node binaries, so no build step and no git in the image. The base image is node:22-trixie-slim rather than the usual node:22-slim because those binaries need glibc 2.38 or newer and bookworm ships 2.36; on bookworm the module fails to load at startup.
Http11Probe — Compliance Comparison
✅ Baseline PassedCompliance
Smuggling
Malformed Input
Header Normalization
Commit: b3b4c89 |
Quality gate failed on Security Rating C for new code, from three major findings on the Dockerfile and one minor one. Add a generated package-lock.json and switch to npm ci, which pins the release tarball by sha512 integrity hash rather than trusting whatever the tag currently resolves to (docker:S8543, text:S8564). Pass --ignore-scripts; uWS declares no lifecycle scripts, so this costs nothing and closes the install-time execution path (docker:S6505). Run as the image's node user instead of root, matching Trillium, Effinitive, Horse and Swerver (docker:S6471) — port 8080 needs no privilege. .gitignore excluded every package-lock.json, which would have left the image building from an unpinned tarball in CI while working locally. Negate it for src/Servers so server locks are tracked; web/ is unaffected. Also Number.parseInt over the global (javascript:S7773). None of this touches HTTP behaviour: the suite scores 119/159 before and after, identical failure set.
MDA2AV
force-pushed
the
add-uwebsockets-js
branch
from
August 15, 2026 17:10
b8b0cad to
77706a9
Compare
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Two patterns account for most of it:
1. A generic
505for anything the parser rejects. Valid HTTP/1.1 requests come back as505 HTTP Version Not Supportedwith the bodyThis server does not support HTTP/1.0.— includingOPTIONS * HTTP/1.1and a well-formed chunked request with a trailer:This drives most of the Compliance and trailer-related Smuggling failures. The rejection itself is safe; the status code and message are misleading.
2. Duplicate
Content-Lengthis accepted.SMUG-DUPLICATE-CLsends two conflicting lengths and gets a200using the first, leaving the remainder in the buffer — a smuggling vector, MUST-level:Also worth flagging:
COMP-HEAD-NO-BODYfails because uWS sends the body on aHEADrequest (Content-Length: 2andOKon the wire). Node'shttpsuppresses it automatically; uWS does not, so every uWS app has to handle that itself.These are uWS's own parser behaviours, not artifacts of the harness code in this PR — the
505bodies are generated by uWS before any handler runs (<i>uWebSockets/20 Server</i>).Verified locally
Image builds; all six endpoint contracts from the Add a Framework guide check out (
GET /,POST /echo,HEAD /,OPTIONS /,POST /echo,/cookie); site build rendersservers/uwebsockets.htmlbound torenderServerPage('uWebSockets.js').