Repository navigation
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Listen argument routing src/js/node/net.ts |
isPipeName(port) now selects the pipe-path branch. Strings that convert to nonnegative numbers use the port-handling path. |
Port validation and binding src/js/node/_http_server.ts, src/js/ahead-of-time/node/_http_server.ts, src/jsc/bindings/NodeValidatorBodies.h, test/js/node/http/node-http.test.ts |
Server.listen() defaults null ports to 0 when no socket path is supplied. It validates numeric and string ports, converts them to signed 32-bit numbers, and clears socketPath. Port-string trimming now includes U+3000 IDEOGRAPHIC SPACE. Tests cover synchronous port errors, ephemeral ports, and asynchronous EADDRINUSE events. |
Suggested reviewers: jarred-sumner
Priority:
Merge Risk: 
Minimal · up to a6b6a
-
Invalid ports are intended to fail synchronously while bind failures remain asynchronous. No merge-blocking issue was identified.
Security architecture risk: 
Low · up to c4081
-
Port validation becomes stricter without weakening the numeric range controls. The main security-relevant change is endpoint selection when port and path inputs overlap. No introduced authorization bypass was established, but downstream deployment exposure and cancellation-after-failure behavior remain incompletely assessed.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- inferred — The security-relevant exposure is listener placement for applications using these APIs. HTTP selects TCP when a valid port accompanies a path, while net accepts additional positional strings as pipe names. Deployment impact depends on caller configuration and endpoint access controls, which were not supplied.
Trust Boundaries and Controls
- observed — Numeric port inputs are validated before native binding. Strings classified as pipe names use the existing Unix-socket binding path, which already accepted nonnumeric paths before this PR. The routing expansion does not itself establish additional binding authority or a numeric validation bypass.
Resilience and Maintainability Implications
- observed — Successful net binding assigns handle ownership before scheduling listening, and close releases the handle. The added regressions check invalid-input error timing and asynchronous address conflicts, but do not exercise AbortSignal cleanup followed by retry. Test execution was not independently performed in this review.
Hardening Proposals
- proposed — Applications relying on filesystem-restricted IPC should explicitly reject simultaneous port and path configuration, rather than treating a supplied path as proof that the listener remains IPC-only.
-
Pre-merge checks: 
4
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Validate HTTP and HTTPS ports before binding, preserving asynchronous bind failures. Adapt the net string-routing and Unicode whitespace fixes from oven-sh#34083.
c40812a to
a6b6ade
Compare
http.Server.listen(65536)andhttps.Server.listen(65536)now throwRangeErrorwithERR_SOCKET_BAD_PORTsynchronously, like Node 24. Real bind failures such asEADDRINUSEremain asynchronouserrorevents.HTTP currently lets
Bun.serve()validate the port inside the bind-error catch. The fix validates before binding, preserves the original string until validation, and converts the complete numeric string instead of accepting aparseInt()prefix. Numeric ports take precedence over an accompanying path. The net portion preserves whitespace strings for validation and uses Node's pipe-name routing.Adapts the net string-routing and U+3000 validation changes from #34083, which remains open; thanks @robobun. This also covers HTTP/HTTPS timing and the full port overload matrix.
Proof:
aa8307619d8dccbda113a5a4aa1885e0cef7eabafails 36 of them and passes 39.The fork counterpart is openclaw#101; Linux x64 and macOS arm64 native CI passed before its guarded squash merge.
AOT-main rebase validation
Rebased onto upstream main
8d5672c5529049f1a9a3453d07e6cd6a1564abc7. Linux x64 main fails 36 added port-validation cases. The rebased release passes the full HTTP file: 389 passed, one skipped, zero failed. The fix is mirrored into the AOT HTTP implementation and shared validator. A compiled AOT probe passes invalid-port and port-zero checks; the alternate-source hash test and formatting also pass.The release build uses
bun run build:release --lto=off. Its executable revision matchesa6b6ade2c424991536423ddcb8c6513226c8b72b. Independent P0–P2 review passes. Earlier platform results above are historical; this rebase's fresh validation is scoped to the results here.