fix(iframe-embed): server-side framable check so the XFO-DENY fallback actually triggers#16
Merged
Conversation
…k actually triggers Live e2e surfaced that the graceful-degradation fallback (REQ-IFRAME-003) never fired for the primary case — a target sending X-Frame-Options: DENY or frame-ancestors 'none'. The browser cannot tell such a block apart from a normal cross-origin embed: both leave the iframe's contentDocument null, so the client-side onLoad heuristic marked the blocked frame 'ready' and the user saw a permanently blank frame instead of the fallback card. Fix: check framing server-side before rendering the iframe. - IframeService::checkFramable() fetches the target and inspects X-Frame-Options (deny/sameorigin/allow-from) and CSP frame-ancestors; fail-closed on the allow-list and on unreachable/unverifiable targets. - IframeController::checkFramable() → POST /api/iframe/framable (registered). - IframeWidget calls it on mount/url-change; a non-framable target renders the fallback card up front and the iframe is not rendered at all (no wasted load of a blocked target). Tests: +6 PHPUnit (XFO deny/sameorigin, frame-ancestors none, host-not-allowed no-fetch, unreachable fail-closed, framable-ok) — 26 green; +1 vitest asserting a server-reported refusal shows the fallback and renders no iframe — 13 green. Existing iframe tests updated to mock the new client call.
rubenvdlinde
requested review from
SudoThijn,
WilcoLouwerse,
bbrands02,
remko48 and
rjzondervan
as code owners
July 26, 2026 08:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by live Playwright e2e: the iframe widget's graceful-degradation fallback (REQ-IFRAME-003) never fired for the primary case — a target sending
X-Frame-Options: DENYorframe-ancestors 'none'(verified against realgithub.com). The user saw a permanently blank frame.Root cause
The browser cannot distinguish an XFO/frame-ancestors block from a normal cross-origin embed — both leave the iframe's
contentDocumentnull. The client-sideonLoadheuristic therefore marked a blocked frameready.Fix — check server-side before rendering
IframeService::checkFramable()fetches the target and inspectsX-Frame-Options(deny/sameorigin/allow-from) and CSPframe-ancestors; fail-closed on the allow-list and on unreachable/unverifiable targets.IframeController::checkFramable()→POST /api/iframe/framable(routed).IframeWidgetcalls it on mount/url-change; a non-framable target renders the fallback card up front and the iframe isn't rendered at all.Verification
@spectags point at the canonical spec path).Will live-verify against real github.com through Playwright after merge+redeploy.