Commit Graph
1 Commits
Author SHA1 Message Date
yetone 55dff77b4d gui: plugin pages load behind a proxy that signs in by cookie (xuanwo on X)
A plugin page's frame is sandboxed (opaque origin), so its stylesheet and
scripts are cross-site requests that carry no SameSite=Lax cookie. Behind
Cloudflare Access they were redirected to the sign-in page and the page
said it "didn't answer" (Day card). index.html's manifest link also
fetched without credentials.

In magpie web the page's HTML now comes as one document (pageinline.go):
classic scripts (bridge included) and url()-free stylesheets are written
in, scripts allowed by sha256 in the policy, deferred ones moved to the end
of body. A script the page adds later is fetched by the window (asset call,
folder-checked, window carries the cookie) and loaded from a data: address
(WebKit finds no blob made in a sandboxed frame). The manifest link has
crossorigin="use-credentials". Modules, url() stylesheets, images and
fonts loaded by the page itself still ask the proxy.

Run on mote at this tree: go test -run PluginPage ./internal/gui; node
--test plugin-page, plugin-page-idle, plugin-page-cookie-proxy in
chromium and webkit; gofmt; vet. Broken by hand: inlining off turns
TestPluginPageWebComesAsOneDocument red, the bridge shim off turns the
cookie-proxy test red in both engines.
Not tried: a real Cloudflare Access tunnel; images/fonts behind a proxy.
2026-11-11 19:11:55 +08:00