Files
hyperframes/packages/engine/src
Michael Wang 125a9446be fix(engine): restricted downloads apply the capture proxy's address rule (#7839)
* fix(engine): restricted downloads use the capture proxy's address rule

With PRODUCER_RESTRICT_PAGE_NETWORK on, remote asset downloads now go
through the same transport and host check as the render page's capture
proxy:

- An IPv6 literal host, or a name the capture proxy refuses, is not
  permitted, on the first request and on every redirect hop.
- Names resolve to IPv4 answers only, every answer must be public, and
  the download dials the checked address. A name with only IPv6 answers
  does not download, as in the capture proxy.
- Proxy variables (HTTPS_PROXY, NO_PROXY) are not used in this mode, so
  no host is dialled without the address check. HYPERFRAMES_CAPTURE_PROXY
  still routes downloads, as it does for the page.

With the setting off, downloads keep the existing transport.

* fix(engine): restricted downloads keep undici's transport with the capture resolver

The capture transport refuses any compressed response and sends no
User-Agent, and its socket and parse errors were not retried. Restricted
downloads now use the same undici agent as before, with a connect lookup
that calls the capture proxy's resolvePublicAddress: IPv4 answers only,
every answer public, and the checked address is the one dialled.

This keeps the old request headers (User-Agent, Accept: */*), gzip, br
and deflate unpacking for text fetches under the existing byte cap, the
asset path's refusal of compressed bodies, "fetch failed" retry handling,
and connection reuse. Non-public destinations stay non-retryable refusals.
2026-11-15 12:45:49 +00:00
..