mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4397] [GUI] One request with an empty or malformed Host header kills the whole App Host process #1955
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#1955
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @TheHubUser4860938 on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4397
Problem: apps/host/server/index.mjs builds
new URL(req.url ?? '/',http://${req.headers.host ?? 'localhost'})at line 956, OUTSIDE the handler's try (which starts at line 969).?? 'localhost'only guards a MISSING Host; an empty (Host:on a raw line) or URL-invalid value (Host: a b) makes new URL throw a TypeError inside the async handler. There is no unhandledRejection handler anywhere in apps/host (grep found none; host-bootstrap.cjs "intentionally does nothing else"), and Node throws on unhandled rejections by default since v15 — so the rejection takes down the entire desktop backend (UI API, agent bridge, engine supervision).Environment:
Strata Version: 0.2.7 (source checkout at tag v0.2.7, commit
5e8a4cca; the file discussed is byte-identical to the tag)OS: Linux x86-64
Runtime: Node 26.12.1 for the probe
Reported from the Strata-Mnemosyne fork's merged tree; the offending code is upstream's own.
Reproduce: send a request whose Host header is present but empty (
Host:) to the App Host port. Measured here: the handler shape run standalone in Node 26.12.1 printedUNHANDLED REJECTION: Invalid URLand exited;new URL("/", "http://")andnew URL("/", "http://a b")both throw, whilenew URL('/','http://[::1]:80')works, so IPv6 clients are safe.Expected: a 400 (or a tolerated parse) and a live host.
Actual: unhandled rejection; on Node >= 15 defaults, process exit.
Reproduction status: mechanism measured standalone in Node; end-to-end against the packaged desktop host NOT run (no desktop app on this box). What would verify: start the app host, send one raw request with an empty Host, watch the host process exit.
@Niko1221 commented on GitHub (Nov 5, 2026):
Hello TheHubUser4860938,
Thank you. In Strata 0.2.11 an empty or malformed Host header (or a request target that is not a path) gets a bounded 400 with
{"error":"bad_host"}and the host keeps running; the shared listener is guarded the same way, and a response whose headers were already sent is ended instead of written again. On the old code the process died with no answer. If any request still takes the host down on 0.2.11, please send the raw request line.The Strata project