# System pages and outside code

> What may run on checkout, cart, sign-in and account pages - the owner's choices yes, unknown outside code no.

Vorjo owns the pages where people pay, sign in or change a password: **checkout, cart, login, signup, account and
password reset**. That holds on Vorjo's own pages and when a site shows them in its own layout (`<VorjoPage />`).

**The rule is simple.** The owner's own choices work there like on any website. Unknown code from outside developers
doesn't run there, and other companies' widgets are shut in sandboxed iframes. Vorjo's forms always stay Vorjo's.

## How others do it

- **Shopify** dropped `checkout.liquid`. Checkout UI extensions run in a sandboxed Web Worker, and web pixels run
  sandboxed and only receive events. The merchant still picks which pixels run.
- **WooCommerce/WordPress** has no sandbox. Plugins enqueue scripts anywhere, including the checkout.
- **Stripe** asks for Stripe.js on every page, to help its fraud checks. Its card fields are Stripe's own iframes.

## What runs where

| On checkout, cart, login, signup, account and password reset | |
|---|---|
| The owner's pixels and analytics (GA, GTM, Meta, TikTok, Pinterest, LinkedIn, Google Ads, Clarity) | **Yes**, like on any page. |
| The owner's Custom code, WhatsApp, chat, Calendly | **Yes.** On Vorjo's own checkout pages, only when the owner turns on **On checkout** (as always). |
| Payment providers (Stripe, PayPal, payment Gears) | **Yes**, loaded normally. They're the only ones that draw inside the payment field. |
| Captcha | **Yes.** It's Vorjo's own check. |
| Other companies' widgets: Trustpilot, reviews, trust and security badges | **Yes, but outside the forms**, as a sandboxed iframe (served from `/_vorjo/slot-frame`, opaque, with its own policy) or as a plain image. |
| The owner's own pasted widget (Embed a widget) | **Yes**, as the owner's code, outside the forms. |
| Outside developers' Gear page scripts | **Never.** A Gear can't ask for these pages, and only an admin-approved version runs on other people's sites. |

### Vorjo's forms stay Vorjo's

No widget place is inside a `<form>`. The **Checkout and cart** place sits in the order summary next to the form.
`Slot.svelte` also refuses to draw inside a form, and a test checks every Vorjo page for it. Inside the checkout's
payment field, only the payment providers draw.

### Headers

These pages get only harmless headers: `object-src 'none'; base-uri 'self'` and a `frame-ancestors` rule. There's no
`script-src`, because that would stop the owner's pixels and code.

## Isolation between customers

`vorjo.site` isn't on the Public Suffix List (see `docs/ops/psl-submission.md`). Every site is a subdomain, so browsers
treat all of them as one "site". That has three effects, and here is how each is handled:

- **Cookie tossing.** One site can set a cookie for all of `.vorjo.site`. Customer sessions are therefore
  `__Host-vorjo_customer` over https (Secure, `Path=/`, no `Domain`), and only that exact host can set it. The old
  name `vorjo_customer` is never read on a `vorjo.site` host, only on a shop's own domain until the cut-off. The
  owner marker is `__Host-vj_own` and is signed for one project.
- **SameSite doesn't separate sites.** A sibling's page counts as same-site, so a `Lax` cookie would go along.
  A change (not GET) from another origin is treated as signed out (`Accounts.crossOrigin`). Account endpoints also
  refuse it outright.
- **The Studio and admin panel** live on `vorjo.com`, `portal.vorjo.com` and `api.vorjo.com`, another registrable
  domain. Their cookies are host-only, so nothing on `*.vorjo.site` can read or set them.

One site's bad build or crash stays its own. Each request has its own error handling. A file that fails while being
sent ends only that response (`SFS.pipeTo`), and the sites service logs anything that escapes instead of exiting.
