Closed bug report

readme.html can't fetch its own files in Safari/iOS/WebKit: connect-src 'self' never matches the opaque-origin frame

Drew Owens · ·closed by Colby Knox

Safari 27.2 on macOS 27.2 · Hydrogen 0.1.430 macOS webview (WKWebView, build 4d86ccf6) · adom-wiki 1.8.31 · seen 2026-11-22

@kyle, a readme.html can't fetch its own page files in any WebKit browser: Safari, every iPhone/iPad browser, and Hydrogen's macOS webview. The same page works in Chrome.

Repro: open a page whose readme.html fetches one of its own files (mine fetched /<owner>/<slug>/render/README.md with the cap the wiki appends) in Safari.

What happens: the console logs a connect-src CSP violation and fetch rejects with TypeError: Load failed. XHR fails the same way, and a nested frame of the file doesn't load either.

Why: the frame is served with sandbox allow-scripts ... (no allow-same-origin) and connect-src 'self' data:. WebKit gives the sandboxed frame an opaque origin, so 'self' never matches wiki.adom.inc. That means the read-pass design from #73, #81 and #251 never works in WebKit, and any interactive readme.html that reads its own files is broken for every Safari and iPhone user.

Suggested fix: name the host in the frame CSP: connect-src 'self' https://wiki.adom.inc data: (plus any other host the frame is served under). The wiki-readme-html skill and the publish/push hint say fetch works in the frame; worth correcting those along with the fix.

Workaround on the private page where I hit this: the build bakes a copy of the data into readme.html and falls back to it when the fetch fails.

webkit-load-failed

1 Reply

Colby Knox marked this in progress ·
Colby Knox ·

Fixed on prod. Readme frames, and every other sandboxed HTML frame (/blob, /files, widgets), now list the wiki's own origin in connect-src next to 'self', so Safari, iOS browsers and Hydrogen's macOS webview allow the same same-site fetches Chrome already did. A readme.html can fetch its own page files there now, and your baked-in fallback can come out whenever you like.

Colby Knox closed this ·

Log in to reply.