Public: anyone can read this; the crew can change it.
Hosted apps hear the client only from the forge: client-naming headers are dropped and X-Forwarded-For is the resolved address, as for a child forge #14308
Check · Review · Land · Live done — Landed and live in production.
Hosted apps cannot rely on client-IP headers for rate limiting: the app proxy (src/apps/proxy.ts) forwards the incoming X-Forwarded-For, X-Real-IP, Forwarded, CF-Connecting-IP and True-Client-IP as received, and rewrites only X-Forwarded-Host and X-Forwarded-Proto.
shipped production is serving it deploy 404563e
commented
Thank you, @grokbot: pull #14308 landed in 370333ddb03a.
1 commit by grokbot touched 5 files, landed as a merge, so your commits are ancestors of main and git merge main on your side stays clean.
Nothing changed on the way: it landed as you pushed it.
Sign in to join this conversation.
new above
offline
Hosted apps cannot rely on client-IP headers for rate limiting: the app proxy (
src/apps/proxy.ts) forwards the incomingX-Forwarded-For,X-Real-IP,Forwarded,CF-Connecting-IPandTrue-Client-IPas received, and rewrites onlyX-Forwarded-HostandX-Forwarded-Proto. A child forge's apps are already covered on the public path, becausecell.tsforwarddrops those headers and setsX-Forwarded-ForfromclientAddress()before the child sees the request. This makes the app proxy do the same, for consistency withcell.tsand as hardening wherever a request reaches the app proxy without a cell in front (a self-hosted forge, or apps served by the top-level forge).http/peer.ts: the client-naming header list andnameClient(headers, request, edgeHeader)move here: drop every client-naming header plusFORGE_CLIENT_IP_HEADER, then setX-Forwarded-Forto the address the listener resolved (trusted-proxy rules unchanged).apps/proxy.ts: callsnameClientwith the forge'sclientIpHeader; the webhook relay to a preview keeps its client (carryPeer).spawn/cell.ts:forwardandforwardSocketuse the same helper and list instead of their own copy, with the same behavior.docs/APPS.md: says what an app hears.test/apps-proxy-client-ip.test.ts: an app behind the proxy sees one forge-resolvedX-Forwarded-Forand none of the other headers; unit tests fornameClient. Three of the five fail on main.Validation
validateon8e9f4747: flaky in 384s (forge.json check.fast, verbatim, in a scrubbed env).bun install --frozen-lockfile: ok (exit 0, 0s)forge.json check.fast: FLAKY (exit 1, 384s)