1 · One request, end to end
Maya opens her Chirp home feed. The parent linked her profile through Phosra Link, so the Worker holds an applied content-rating ceiling of 13 for it.
- Worker deletes any
Phosra-Content-Rating-MaxorX-Origin-Auththe browser sent. - Worker asks Chirp who is signed in, finds Maya's applied ceiling, and adds
Phosra-Content-Rating-Max: 13plus its origin secret. - Chirp rejects anything without the origin secret, then runs
WHERE rating <= 13. - Chirp answers with
Phosra-Content-Rating-Applied: 13. - Worker passes acknowledged responses through; filters any listed response that is not acknowledged.
Everything Chirp adds is one small module and a few lines where it already builds its timeline:
// chirp/src/edge-policy.ts (26 lines) — trust the Worker, read its policy if (!fromTrustedEdge(request, EDGE_ORIGIN_TOKEN)) return 403 // origin is locked const ceiling = edgeCeiling(request) // Phosra-Content-Rating-Max const posts = await store.timeline({ maxRating: ceiling }) // WHERE rating <= ceiling response.headers.set("Phosra-Content-Rating-Applied", String(ceiling))
2 · The rule, enforced by Chirp
Same outcome as option 1 — 8 posts for Maya, 12 for Dana — but the filtering happened in Chirp's query, and the notice is Chirp's own UI. The Worker did not touch the page.
x-phosra-edge: …; enforced-by=origin13, so the Worker passed the response through: enforced-by=origin. Mobile and API clients get the same filtering, with nothing listed in the Worker config.3 · The origin only answers the Worker
This is what makes the header trustworthy. Here the Worker sends a secret X-Origin-Auth; in production
use a Cloudflare Tunnel (no public origin address), Authenticated Origin Pulls (mTLS), or Cloudflare Access with a service token.
403 · Origin locked for pages and for /api/timeline, even with a forged policy header. Compare option 1, where the open origin served all 12 posts.4 · A child can't loosen the policy
Maya opens her browser's dev tools and sends Phosra-Content-Rating-Max: 99 and a guessed
X-Origin-Auth through the public address.
5 · If Chirp stops enforcing, the Worker still does
To test this, the origin was swapped for a Chirp build that ignores the header — as if a deploy dropped the
enforcement code. With no Phosra-Content-Rating-Applied on the response, the Worker filters listed pages and feeds
itself (enforced-by=edge-fallback).
6 · The three ways to deploy
Every option uses the same parent flow, the same Gatekeeper and the same signed receipts. They differ in where Phosra runs and who filters content.
| Native | Option 1 · Worker enforces | Option 2 · Worker forwards, Chirp enforces | |
|---|---|---|---|
| Phosra SDK, tables, secret, background jobs | In Chirp | In the Worker | In the Worker |
| Chirp code for Phosra | ~230 lines + worker process | None (session endpoint + data-rating) | ~40 lines: trust check, read header, acknowledge |
| Who filters content | Chirp's query | Worker rewrites HTML / JSON | Chirp's query; Worker as backstop |
| Endpoints covered | All | Only those listed in Worker config | All (listed ones also backstopped) |
| Depends on page markup | No | Yes (selectors) | No (only for the backstop) |
| Origin must be locked | No | Yes, or it can be bypassed | Yes, required to trust the header |
| Gatekeeper upgrades | Chirp redeploy | Worker deploy | Worker deploy |
| New rule category | Chirp code | Worker code + selectors | Worker header + Chirp code |
| Run it | npm run demo:native | npm run demo:edge | npm run demo:edge-header |