Commit Graph
3 Commits
Author SHA1 Message Date
chrnx 43a4316a29 fix(fetch): gate x-forwarded-for on trustProxy in app.fetch
The Web-Standards fetch adapter read x-forwarded-for unconditionally to
seed ctx.ip, unlike Node's deriveIp which only honours it when
trustProxy is enabled. A client could spoof ctx.ip on any handler
relying on it. Mirror deriveIp's first-hop semantics and only trust
the header when trustProxy is set; otherwise ctx.ip is ''.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-07-09 14:45:27 -05:00
chrnx 08cb8554e6 fix(fetch): security headers on early failures, live mesh boot gate
app.fetch's 413/400/501 body-acquisition failures were returned without
the injected security/CORS headers Node's writeHead patch always
applies, breaking byte-identical parity with the listen() path. Extract
computeInjected() (shared by handle() and buildFetch()) and merge it
into every error response, not just handle()'s outcomes.

Also, buildAppFetch captured `booted` by value at createApp() time, so
mesh apps (whose finalize() is deferred into listen()) had app.fetch
permanently throw even after a successful listen(). Read booted live
via a getter, mirroring explain()/graph()/inspect(), and lazily
build/cache the fetch handler on first call after boot.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-07-09 14:26:45 -05:00
chrnx 93a4246de5 feat(app): app.fetch — Web-Standards handler over the neutral core
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-07-09 14:15:26 -05:00