Skip to content

Let another website show a signup's sign-up sheet in an iframe - #1114

Open
richshaw wants to merge 3 commits into
mainfrom
claude/issue-1062-embed
Open

richshaw wants to merge 3 commits into
mainfrom
claude/issue-1062-embed

Conversation

@richshaw

Copy link
Copy Markdown
Owner

Fixes #1062.

Session: https://claude.ai/code/session_016YZ9SWQEpV21Hn61XHhitV

The problem

Every response carries X-Frame-Options: DENY and frame-ancestors 'none', so an <iframe> of a signup on an organizer's own website shows an empty box. Organizers can only link to the sheet.

The fix

  • A new page, /s/[slug]/embed. The body of /s/[slug]/page.tsx moved to signup-page.tsx (renderSignupPage, signupPageMetadata, with { embed }), and both pages call it, so the embed shows the same sheet from the same data, with the same messages for draft, closed, archived and not found. In the embed:
    • no organizer strip, and it skips the session read for it; a draft shows the visitor message even to its own organizer
    • no recordPublicView (the privacy page and docs/telemetry.md say so)
    • redirectPunctuatedSlug sends /s/slug./embed to /s/slug/embed
    • same robots: noindex as the page
  • Headers (next.config.mjs). X-Frame-Options: DENY and the CSP with frame-ancestors 'none' moved to a rule whose source leaves the embed out (/:path((?!s/[^/]+/embed$).*)). The embed gets object-src 'none'; base-uri 'self'; frame-ancestors * and no X-Frame-Options. Both keep nosniff, Referrer-Policy, Permissions-Policy and HSTS. I checked the real headers on a production build for every path the issue lists. One edge: Next matches header sources case-insensitively, so /S/x/EMBED also gets frame-ancestors *. The app's routes are case-sensitive, so that address is only the global "not found" page.
  • Links out of the embed open a new tab (NEW_TAB in new-tab.ts: target="_blank" rel="noopener", plus aria-describedby pointing at one hidden "Opens in a new tab" note). This covers the success view's edit link, the returning participant's Edit and "Edit or cancel" links, and the site's name above the sheet. See alternatives stays in the frame and goes to /s/${slug}/embed.
    • I left state-message.tsx alone. Its only action is the own-draft note, which the embed never shows.
  • No site footer. The /s root layout skips SiteFooter when the path header ends in /embed (isEmbedPath in src/lib/signup-path.ts). src/middleware.ts is unchanged, since it already sets that header on every /s path.
  • EMBEDS_ENABLED (booleanFlag(), unset means on). With false, the embed page and its metadata call notFound(). It's read per request through embedsEnabled(). The README, .env.example and the CHANGELOG document it.
  • One new message, participant.signupView.opensInNewTab, with Swedish ("Öppnas i en ny flik") and German ("Öffnet sich in einem neuen Tab"), both marked with mark-translated.mjs. to-translate.mjs reports 0 missing and 0 stale for both languages and both audiences. I did not run the translate skill's screenshot review for this one hidden screen-reader line.
  • Legal pages, both with a new "Last updated" date (24 November 2026):
    • privacy: a paragraph on signups shown inside another website, and that their views aren't recorded
    • cookies: os_commit isn't kept inside another site's frame, and the saved name and email are kept separately for each website
  • Budgets. /s/[slug]/embed gets its own firstLoadJsKb entry, 129.6, which is what it measures (/s/[slug] measures the same). GET /s/[slug]/embed is 5 statements, the same as GET /s/[slug].
  • Not done here: the share panel's embed code is The share panel has no code for putting a signup on a website #1064, and the help article is The help pages don't say how to put a signup on a website #1066. Copy and Share in the success view already fail quietly when the host's frame doesn't allow the clipboard (both are wrapped in try/catch). I didn't check them in a host page that does allow them.
  • Changes src/messages/en.json, so whichever of this and Write every English apostrophe straight #1113 lands second has to mark sv/de again.

Tests

  • Unit:
    • embed/page.test.tsx: open, closed, draft (even for its own organizer), archived, unknown, EMBEDS_ENABLED=false, the punctuated-slug redirect, no strip, no session read, no view tracking, robots
    • layout.test.tsx: no footer on the embed
    • signup-view.test.tsx: Edit links get target, rel and the description in an embed, and not on the page
    • commit-dialog.test.tsx: the edit link and See alternatives in an embed
    • env.test.ts, signup-path.test.ts
    • Switching the embed page to { embed: false } fails 5 of its tests.
  • DB: the query budget gains GET /s/[slug]/embed for a returning participant (5).
  • E2E, tests/e2e/embed.spec.ts:
    • the exact CSP and X-Frame-Options on the embed and on /s/[slug], /s/[slug]/c/[id], /s/[slug]/unsubscribe, /app and /login
    • a host page on the other loopback name and its own port, framing a fresh signup's embed: signs up inside the frame and sees "You're in."; the edit link and the site's name each open a popup while the frame stays on the embed and never shows /c/; Done leaves the sheet in the frame
    • every link in the embed for a returning participant opens a new tab and is described as such
    • open (no strip, as its organizer), draft (visitor message, as its organizer), closed, archived and unknown, with no footer
    • the sheet in a 600px frame at phone width
    • The host page is served by a small Node server, not page.route: Chromium treats a routed page as public and blocks it from framing a local address.
    • a11y.spec.ts checks the embed with axe.
  • Ran and passed: pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test (3,902 passed, 1 expected fail), pnpm test:db (906), pnpm build && pnpm budgets with CI's NEXT_PUBLIC_* values.
  • E2E, chromium, container config, full suite: 310 passed. The failures were my own spec's: its "Bake sale" titles matched the seeded "Bake Sale" in organizer.spec.ts, and my local reruns used up the seeded organizer's create limit. I renamed the titles and cut the spec to 2 signup creates. After clearing the limit, embed, organizer, responses and time-format passed (45).

Generated by Claude Code

A new page, /s/[slug]/embed, shows the same sheet as /s/[slug] for every
state, without the site footer, the organizer strip or the note on an
organizer's own draft, and without writing a page-view row. It is the only
address another site may frame: every other path keeps X-Frame-Options DENY
and frame-ancestors 'none', from a header rule that leaves the embed out,
and the embed sends frame-ancestors * instead.

Every link that leaves the embed opens a new tab, described to screen
readers as "Opens in a new tab", so no other page loads inside the frame;
See alternatives goes back to the embed. EMBEDS_ENABLED=false makes the
address not found, read per request.

The privacy and cookies pages say what changes inside another website.

Fixes #1062.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SWQEpV21Hn61XHhitV
@richshaw richshaw added pipeline:tophat pipeline:ux Changes what a person using OpenSignup sees or does pipeline:working A session is working on it right now labels Nov 24, 2026 — with Claude
Comment thread tests/e2e/embed.spec.ts Fixed
The test-only host server built its page from the request's query string.
It now serves only the pages the tests registered, so nothing from a
request reaches the response.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SWQEpV21Hn61XHhitV
The spec made its signups through the API as the seeded organizer, whose
60-an-hour create limit the full e2e run already nearly uses up, so in CI
two other specs got rate_limited. It now uses createOrganizerIn, which puts
an organizer and their signups straight into the database, and the spec
makes no signup through the API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SWQEpV21Hn61XHhitV
@richshaw richshaw added pipeline:working A session is working on it right now and removed pipeline:working A session is working on it right now labels Nov 24, 2026 — with Claude

Copy link
Copy Markdown
Owner Author

Tophat: passed

See it: https://claude.ai/artifact/BkGNgkgYtyUPH9EQ6DbFvy
What changes for people: Organizers can put a signup's sign-up sheet on their own website by framing /s/<slug>/embed. Inside the frame people see the sheet and can sign up there. It has no organizer bar and no site footer, and its links open in a new tab. The normal signup page and every other page still refuse to be framed.

Check Result What I saw
Frame the embed from another origin, computer and phone ✅ Before: blocked, and the address was a 404. After: the sheet loads with no footer, no organizer bar and no console errors.
Sign up inside the frame ✅ "You're in." appeared. The edit link opened a new tab, and the frame stayed on /embed, including after Done.
Headers ✅ /embed sends frame-ancestors * and no X-Frame-Options. /s/<slug>, /c/<id>, /unsubscribe, /app and /login still send DENY and frame-ancestors 'none'.
Draft, closed, archived and unknown ✅ Each shows its own message, with no footer. A draft shows the visitor message even to its own organizer.
Links on /embed for a returning participant, and /s/<slug> beside it ✅ On /embed, the site name, "Edit or cancel" and Edit have target=_blank rel=noopener and the hidden "Opens in a new tab" note. /s/<slug> looks the same as on main.
Views not recorded, and EMBEDS_ENABLED=false ✅ Three embed loads added no signup.viewed rows, and one page load added one. With the flag off, /embed returns 404 and /s/<slug> still returns 200.

Worth a look:

Not checked:

  • Copy and Share on a host page that grants the clipboard.
  • The Swedish and German wording of the hidden note.
  • Browsers other than Chromium.

Ran 5e5fc93 against 7649fbc locally, Chromium at 1280×900 and 390×844, made-up data, with a small local host page on a second origin. https://claude.ai/code/session_016YZ9SVxBfqBzmszYHNZK5G


Generated by Claude Code

@richshaw richshaw added pipeline:review pipeline:working A session is working on it right now and removed pipeline:tophat pipeline:working A session is working on it right now labels Nov 24, 2026 — with Claude

@richshaw richshaw left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: passed (round 1)

Adds /s/[slug]/embed, the one address another site may frame, as the same sheet as /s/[slug]. Every state shows its message, organizer extras and view counting are left out, and links out open a new tab. I ran Next's own header matcher on the two rules: /, /app, /login, /s/x, /s/x/c/…, /s/x/embed/ and /_next/… all still get DENY and frame-ancestors 'none'. Only /s/<slug>/embed is framable.

Blocking (0)
Optional (3):

  • next.config.mjs:136: with EMBEDS_ENABLED=false the 404 is still sent with frame-ancestors *. It's harmless, but the README could say only the page goes away.
  • layout.tsx: with no footer, the embed has no privacy or AGPL source link. The issue chose this; worth a second look for AGPL §13.
  • The translate skill's screenshot review was skipped for the one hidden "Opens in a new tab" line.

Earlier threads: all resolved (CodeQL, test-only host page)
Checks: CI green on 5e5fc93. Tophat passed on 5e5fc93. I ran the header matching locally.

Waits for the owner because it's UX: a new public page, plus legal page changes. Card: https://claude.ai/artifact/BkGNgkgYtyUPH9EQ6DbFvy. Code risk: every response's frame headers now come from a negative-lookahead rule, so a future route named embed under /s/<slug> would also be framable.

https://claude.ai/code/session_016YZ9SVxbxv6CupZpeRavSt


Generated by Claude Code

@richshaw richshaw added pipeline:owner Passed; waits for the owner (UX or high-risk) and removed pipeline:review pipeline:working A session is working on it right now labels Nov 24, 2026 — with Claude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pipeline:owner Passed; waits for the owner (UX or high-risk) pipeline:ux Changes what a person using OpenSignup sees or does

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A signup can't be shown inside another website's page

3 participants