Repository navigation
Description
Needs your OK: this adds a cookie so an embedded signup can show people their own sign-ups, and changes the cookies page. Swap pipeline:proposed for pipeline:ready to have it built.
Part of #1061.
What happens
On /s/[slug], the os_commit cookie remembers this browser's sign-ups, so the page shows "you're signed up" with an Edit link. Inside another website's frame (#1062), the cookie is SameSite=Lax (setReturningCommitCookie in src/lib/returning-participant.ts), so the browser neither keeps nor sends it. Someone who signed up through an embed sees the sheet as though they never had. Their way back is the edit link in their confirmation email, and on a signup that doesn't ask for an email (requireEmail off), only the link the success view showed them once. #657 is about that wider problem.
Fix, in outline
- A second cookie, for the embed only, set
SameSite=None; Secure; Partitioned. The browser keeps it only for OpenSignup inside that one website, so it can't follow anyone from site to site. - The embed's sign-up says it's from the embed (a field in the request, say
embed: true), and the sign-up API then sets the partitioned cookie alongside the usual one. - The embed page reads both cookies. The normal page and its cookie don't change.
- HTTPS instances only.
SameSite=NoneandPartitionedboth needSecure, whichisHttpsDeployment()leaves off on plain-HTTP instances. There the embed carries on without it.
Watch for
- Who reads the cookie. Checked at 0a71fbf: only the signup page (
src/app/s/[slug]/page.tsx) reads it. The API routes only rewrite it, and changing or cancelling a sign-up (PATCHandDELETE /api/commitments/[id]) is authorized by the edit token in?token=orx-edit-token, never by the cookie. Keep it that way: aSameSite=Nonecookie travels with requests the host website makes to OpenSignup. - Changes made on the edit page. It opens in a new top-level tab, which can't write the embed's partitioned cookie. Old entries are harmless, because
getOwnCommitmentsForSignupkeeps only active sign-ups whose token matches, but a slot moved on the edit page won't show as yours in the embed. - Safari handles partitioned cookies differently from Chrome. Check it by hand, and accept the email link as the fallback there.
- Legal pages. The cookies page lists each cookie and its attributes, and the privacy page says what's stored. Update both and bump "Last updated", as CLAUDE.md asks of any cookie change.
- One expiry rule. Reuse
cookieMaxAgeandrememberUntilrather than a second copy. - CHANGELOG: an entry for the new cookie.
Choices this makes
- Whether to do it at all. Default: wait until A signup can't be shown inside another website's page #1062 has been used and organizers say people miss it. The success view and the email already give people a way back.
- A separate cookie for embeds, rather than loosening
os_commitfor everyone.
Order
After #1062, because it changes the embed page #1062 adds.
Done when
- Unit tests pin the new cookie's attributes, and the existing test that
os_commitis alwayshttpOnlyandsameSite: 'lax'(returning-participant.test.ts) still passes. - On an HTTPS instance, in Chrome, signing up inside an embed and reloading the host page shows "you're signed up". The Playwright projects are
chromium,mobile-safariandchromium-phone, and the e2e server runs on plain HTTP, so either the spec gets an HTTPS server or the PR records a check by hand. - The cookies and privacy pages describe the new cookie.
pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test,pnpm test:dband the e2e suite pass.
From the owner's notes, checked against main at 0a71fbf, and reviewed by a second agent against the code. https://claude.ai/code/session_016YZ9SSL4C6UVyX63KaR1bL
Activity