Context
The pinned Bun Bake ESM corpus at 4982b91e3702094330f3be3883354c52b8c01323 contains browser-input hardening added in Bun's round-4 hardening commit. Home reproduced three failures:
- browser console forwarding wrote OSC 52 and other control bytes to the developer terminal;
- URL origin normalization could return a length larger than the borrowed input (
http:h->http://h/), causing an index-out-of-bounds panic; - HTML routes served secret-bearing
/_bun/client/...URLs to a foreignHostheader.
The same upstream boundary also protects HMR WebSocket upgrades by validating both Host and browser Origin.
Scope
- Sanitize error-report strings and browser console forwarding before terminal output, including C0, DEL, and UTF-8 encoded C1 controls.
- Reject native normalized-origin lengths that exceed the supplied URL slice.
- Validate development HTTP
Hostauthorities for internal, framework, and HTML routes. - Validate HMR WebSocket
Originagainst the request host while retaining non-browser clients. - Preserve localhost,
.localhost, IP literal, and explicitly configured hostname access.
Acceptance criteria
- The three unchanged pinned hardening tests in
bake/dev/esm.test.tspass through Home's native VM. - Native unit tests cover terminal sanitization, URL length rejection, and fail-closed authority parsing.
- Existing Bake HTML/HMR and runtime gates remain green.
- No upstream fixture or assertion is weakened.