ADR-0184 — A deployment chooses how much a static page may do
Status: Accepted · Date: 2026-12-01 · Amends: ADR-0103, ADR-0128
Context
ADR-0103 serves an author's static page as an inert document: sandbox,
inline styles, data: images and fonts, no script and nothing fetched. It
kept uploaded pages from acting on the product's domain or carrying
unlisted tracking.
On staging, real pages broke under it. "The Glasshouse" (crd.name/tester)
uses Google Fonts, the Phosphor icon font from unpkg and a canvas drawn by
an inline script. Under the floor its fonts fell back, its icons were blank
and the canvas never drew. The owner asked for pages like it to work on
staging now, with the full answer (a domain of their own for user pages)
before production.
Decision
One configuration key, HOSTING_STATIC_POLICY, read in one place
(config.HostingStaticPolicy), chooses the policy every author's document
is served with (handlers.staticDocumentCSP):
| Value | What the page may do |
|---|---|
inert (default) | ADR-0103's floor, unchanged |
external | also styles, images, fonts and media over https: |
scripted | also its own scripts (inline and https:), outbound fetches (connect-src https:) and blob workers |
Under every value:
- The sandbox never grants
allow-same-origin: the document stays in an opaque origin, so script reads none of the product's storage or session (ADR-0096).allow-top-navigationandallow-formsstay off; scripted pages getallow-scriptsand popups only.'unsafe-eval'is not allowed. X-Frame-Options: DENYandnosniffstay.- Markdown is the product's own rendering and is capped at
external; an SVG document staysinertwhatever the deployment chose. - A bundle keeps its artifact origin (
HOSTING_ARTIFACT_ORIGIN, ADR-0128) in every source list; underscriptedits.jsand.mjsentries are served astext/javascript, otherwise as opaque bytes. - Anything other than the two openings is
inert, so a typo closes the page rather than opening it.
Staging sets scripted (infra/staging/api.env). Production stays inert.
Consequences
- Pages that use web fonts, icon fonts, CDN images, video and their own scripts work on staging.
- On staging a page can load third-party resources and run script on the product's domain. Script cannot read the session, but a page could still imitate a sign-in form or call out to any server. Staging accepts that for testing.
- Before production opens it: serve user pages from a domain of their
own (010 Blocker 3,
HOSTING_ARTIFACT_ORIGIN), so an author's page never shares an origin, or a cookie domain, with the product. That is the decision this ADR leaves open, and the reason production staysinert.
Alternatives considered
- Keep the floor and tell authors to inline everything — rejected for staging: no author's real page survives it, and testing needs real pages.
- An allowlist of CDNs (the font, package and icon hosts pages commonly use) — rejected: it would break the next page that uses another one, and it does not change the risk of script, which is the real one.
allow-same-originwith script — rejected outright: the page would run as the product and could read the session.
Source: docs/decisions/0184-a-deployment-chooses-how-much-a-static-page-may-do.md