You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: uncaught URL parse crash on missing or malformed Host header across API handlers #516
Following #503 (which fixed new URL() throwing on missing/malformed Host headers inside requireAuth in src/server/signalling/utils.ts), the same unguarded new URL() pattern still exists across the main API router and route handlers:
src/server/signalling/server.ts (handleApiRequest, line 161):
Because this runs at the entry of handleApiRequestbefore routing or requireAuth, any unauthenticated HTTP request with a malformed Host header (e.g., Host: [) throws an uncaught TypeError [ERR_INVALID_URL] in the raw Node request listener, terminating the host server process.
src/server/signalling/handlers/rtc.ts (handleOffer, handleAnswer, handleIce, parseRequestMeta, parseAddress):
Uses the same new URL(req.url ?? "", http://${req.headers.host ?? "localhost"}) pattern without a try/catch.
Omits even the ?? "localhost" fallback and lacks error handling, crashing on missing or malformed Host headers.
Steps to Reproduce
Start the Rein server (npm run dev or packaged Nitro server).
Send a raw HTTP request with a malformed Host header:
GET /api/host/status HTTP/1.1Host: [Connection: close
new URL() throws an unhandled ERR_INVALID_URL exception and crashes the server process.
Expected Behavior
Request URLs should be parsed against a fixed loopback base (http://localhost) rather than interpolating the untrusted Host header, and any malformed request target should cleanly return HTTP 400 Bad Request without crashing the server.
Activity
github-actions commentedon Nov 22, 2026
Discussions are carried on Discord.
Instead of commenting here, go to the Discord channel.
macOS and macOS-related issues are not supported at the moment. We are looking for funding to support macOS and would appreciate sponsorships.
If you find this project useful, a GitHub star would be appreciated.