Files
apes-sidebar/tests
Pluto-Yt 32e8f56c4a fix(trust-fence): accept a bfcache-restored image with a stale cross-site marker
Chromium can restore a same-origin image subresource from bfcache while the
request still carries `Sec-Fetch-Site: cross-site`. The fence refused every
cross-site marker outright, so /sidebar/file answered 403 and the image
preview stayed blank until the tab was reloaded. Reproduced on a real
`dsh web` instance: the same URL returns 200 image/png normally and 403 once
the cross-site marker is present with no Origin.

The exception is deliberately narrow — GET /sidebar/file only, browser image
subresources only (`Sec-Fetch-Mode: no-cors` + `Sec-Fetch-Dest: image`), and
the unforgeable Referer must name the request's exact authority. `Sec-Fetch-*`
and `Referer` are forbidden request headers, so a foreign page cannot forge
them. API requests, non-GET media, non-image subresources, CORS image reads,
foreign/look-alike/malformed Referers and Referer-less requests stay refused,
and the existing Origin hostname check is unchanged.

tests/trusted-hosts.spec.ts covers the accepted loopback and trusted-remote
cases plus the refusal matrix over real GET /sidebar/file requests.
2026-09-15 10:47:30 +08:00
..
2026-09-09 11:15:30 +08:00