Skip to content

Fix: parked domains blank because CSP frame-ancestors blocks the masked-forward iframe - #14

Merged
ralyodio merged 1 commit into
masterfrom
fix/frame-ancestors-auto-dn
Jul 10, 2026
Merged

Fix: parked domains blank because CSP frame-ancestors blocks the masked-forward iframe#14
ralyodio merged 1 commit into
masterfrom
fix/frame-ancestors-auto-dn

Conversation

@ralyodio

Copy link
Copy Markdown
Collaborator

Why moshscript.com fails

moshscript.com (and any masked-forwarded parked domain) serves a Porkbun frameset that iframes https://moshcoding.com/?dn=moshscript.com. But moshcoding.com sends content-security-policy: frame-ancestors 'self' https://moshcode.sh …moshscript.com isn't in the list, so the browser blocks the frame and the page renders blank. It's a CSP block, not a server error (the tenant page itself returns 200).

Fix

Middleware now auto-adds the ?dn=<domain> being rendered (and its www.) to frame-ancestors. The framed request carries its own ?dn, so we trust it to iframe just its own tenant page. New parked domains work without hand-editing FRAME_ANCESTORS for each one. 'self' + the env list still apply; the dn is hostname-validated first.

Verified (local)

  • ?dn=moshscript.comframe-ancestors 'self' https://moshcode.sh https://moshscript.com https://www.moshscript.com
  • no dn → unchanged ('self' https://moshcode.sh)
  • junk dn (evil domain") → not injected (validation rejects it)

Also works as an immediate hotfix without deploying this: set FRAME_ANCESTORS = https://moshcode.sh https://www.moshcode.sh https://moshscript.com https://www.moshscript.com in Railway.

🤖 Generated with Claude Code

Masked-forwarded parked domains (Porkbun frameset, e.g. moshscript.com) iframe
moshcoding.com/?dn=<self>, but the CSP frame-ancestors only listed the domains
in FRAME_ANCESTORS, so any domain not hand-added there was blocked by the
browser and rendered blank. The framed request carries its own ?dn, so trust it
to iframe just its own tenant page — new parked domains now work without editing
FRAME_ANCESTORS each time. 'self' + the env list still apply; the dn is
hostname-validated before being added.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio
ralyodio merged commit b50c884 into master Jul 10, 2026
2 checks passed
@ralyodio
ralyodio deleted the fix/frame-ancestors-auto-dn branch July 10, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant