Mark host promises handled at the apply boundary
fix(GHSA-gjq8-xm47-88rc): mark host promises handled at the apply boundary
Mark host promises handled at the apply boundary5bb37f-fix-mark-host-promises-handled-at-the-cve-2026-92954fixmark host promises handled apply boundary
Committed by patriksimek-bot
commit message
fix(GHSA-gjq8-xm47-88rc): mark host promises handled at the apply boundary
Root cause: when a host function invoked from the sandbox returns a host
Promise, the bridge apply trap wraps it for the sandbox but leaves the
underlying host promise without a rejection reaction of its own. If sandbox
code ignores the result, Node's default unhandledRejection policy (Node 15+)
sees the raw host promise reject with no handler and terminates the host
process -- a sandbox-triggered host DoS from a single line of untrusted code.
The Category 22 (GHSA-hw58-p9xv-2mjh) swallow tail lives on the sandbox
Promise and never covers a host promise crossing the bridge; the GHSA-55hx
apply-trap sanitizer only fires when the sandbox actively chains .then/.catch.
Fix chokepoint: lib/bridge.js apply trap now calls markHostPromiseHandled(ret)
on every host->sandbox return value. It attaches a benign .then(noop, noop) to
the underlying host promise via the cached host Promise.prototype.then
(otherReflectApply), marking it handled for Node's bookkeeping. Promises
multicast, so the sandbox's own GHSA-55hx-sanitized reaction still observes the
sanitized rejection independently; the no-op onRejected returns undefined so no
new unhandled rejection is created; a [[PromiseState]] slot check plus try/catch
keep fulfilled promises and non-promise returns inert. Restores the host-process
liveness invariant for the host->sandbox direction, sibling of Category 22 which
covered sandbox->host.
Tests: test/ghsa/GHSA-gjq8-xm47-88rc/repro.js with host-reject-child.js forks a
handler-free child to observe host survival across hostReject / host async fn /
events.once, plus in-process checks that a sandbox .catch still receives the
sanitized sandbox-realm error and that fulfilled promises resolve unchanged.
docs/ATTACKS.md: extends Category 22 with the host->sandbox sibling subsection
and adds a How The Bridge Defends row. No version bump.Editor assessment
This commit patches CVE-2026-92954. The body explains the host-to-sandbox unhandled-rejection DoS: a host promise crossing the bridge without its own reaction can terminate the process, and markHostPromiseHandled attaches a benign then(noop, noop) without affecting the sandbox's sanitized reaction. The explanation is clear and tested. The GHSA identifier used as the scope is the only formal problem, capping an otherwise solid message at 3. The multicast nature of promises is what makes the no-op safe; stating that explicitly would answer the obvious reviewer question.