Repository navigation
EN Bridge Security
Français · Type: explanation · Audience: admin · Context: Reality Bridge · Status: ready · Applies from: 4.2.5
The Reality Bridge,
localprofile (SQLite) · contract: stable · verified by CI (support matrix of 4.4.0, 2026-10-23): Node 22.13+ with node:sqlite, on Ubuntu; Chromium and WebKit end to end · automated checks: jobsreality,reality-xcheck; CI planreality; 2 test files · people's passes: none · known limits:bridge-rotation-resets-run-quotaThe Reality Bridge,
distributedprofile (Postgres) · contract: experimental · verified by CI (support matrix of 4.4.0, 2026-10-23): Postgres 16 in CI; The qualification profile: HTTPS, three instances (ops/qualify/) · automated checks: jobsbridge-postgres,deployment-smoke; CI planreality; 1 test file · people's passes:bridge-postgres-httpsnot run (#77) · known limits:bridge-rotation-resets-run-quotaThe connectors (email, Telnet, SSH, Open Badges) · contract: experimental · verified by CI (support matrix of 4.4.0, 2026-10-23): Node 22 on Ubuntu (Telnet and SSH not on Windows) · automated checks: jobs
connectors,connector-archive-e2e; CI planreality; 3 test files · people's passes:connectors-real-securitynot run (#79) · known limits:bridge-rotation-resets-run-quota
How the Reality Bridge decides who may propose a signal, how a player knows the Bridge accepted it, which secrets exist and where they live, how keys rotate and tokens are revoked, and what to do when one leaks. Two mechanisms, each for one question: Biscuit says who may propose what, on the Bridge only; an Ed25519 signature says what the Bridge accepted, verified by the player.
| Secret | Where | Who reads it | If it leaks |
|---|---|---|---|
| The Biscuit root's private half |
root.key (mode 600) |
grant only; serve never loads it |
Anyone can mint connector tokens: a new root |
| The event-signing key (Ed25519) |
config.json (eventKey, mode 600) |
serve |
Anyone can sign signals players accept: rotate |
| The operator's token |
admin-token (the only copy in clear); its SHA-256 in config.json
|
revoke, the /v1/admin/* routes |
Anyone can export, delete and revoke. No command replaces it alone: make one with init in a scratch folder, copy its adminTokenHash into config.json and its admin-token beside it, restart |
| A connector's Biscuit | the connector's tokenFile
|
that connector | Revoke it by id, grant a new one |
| A demonstration webhook's secret and token |
config.json (webhooks) |
serve |
Re-init, or never enable them on the Internet (--no-demo-webhooks) |
| A player's capability | the player's browser (localStorage); its SHA-256 on the Bridge |
the player's page | Revoke the player's link |
| The database URL and password |
BRIDGE_STORE or BRIDGE_STORE_FILE, never the file |
serve and the commands |
Change the password |
Keep root.key where the Bridge is not, if you can: a Bridge that only serves does not need it.
A connector's token is minted by grant from the root key. Its authority block names the game, the sources, the
signals, the players (or any player of the game), the Bridge's audience, the tenant (from 4.1.10), whether it may
confirm pairing codes (--pair), and an expiry to the second (refused from that second on). The Bridge checks each
proposal against bridge/policy/propose.datalog, and each pairing confirmation
against pair.datalog, within 200 ms of Biscuit's run time.
- A connector can attenuate its own token (fewer players, an earlier expiry) before handing it on; it can never widen it.
- Every token has revocation ids; revoking any of them refuses the token.
- The order of checks gives nothing away: the manifest answers first (it is public), then the token, before any player is named, so a caller without a valid token learns nothing of which players exist (a 401 or 403 before any 404).
- An address that fails 60 authentications in a minute has every request refused for a while (429).
- Biscuit only says who may propose. A connector checks what it claims itself: a badge's proof, an email's sender.
Guarantee ·
bridge-bad-token-before-player· referenced · scope self-checked by the author (AI), not reviewed A bad token is refused before an unknown player is named, and an address out of failed authentications waits.
The Bridge signs every accepted signal as a compact JWS (alg: EdDSA, a kid naming the key). The player verifies
the signature on the exact bytes it received before it parses them, then the size, the key's window, the game, the
player, the manifest and the expiry, with five minutes of tolerance for the device's clock. The player holds neither a
Biscuit nor a key: only a capability that reads and acknowledges its own signals.
A WorldSignalV2 also names its tenant, environment, the origin the player paired from, the link and the key, so a
signal signed for one context is refused in another (audience-mismatch), even when two tenants were (wrongly) given
one key. A Bridge serving several tenants signs V2 only, and lists its keys with their tenant; a single-tenant Bridge
signs V1 unless its configuration says signalVersion: 2 (init --signal-version=2). The player accepts both by
default. Every field: Signals and the manifest.
The demonstration webhook (POST /v1/hooks/<source>) is authenticated otherwise: an HMAC-SHA256 of the raw body
under the webhook's secret, in X-Web-Scumm-Signature: sha256=<hex>, compared in constant time.
The event key signs every signal with its kid; the player trusts the keys GET /v1/keys lists, each within its
window.
# in the engine repository (the Bridge's folder)
npm run bridge -- rotate --keep-days=30rotate makes a new key and keeps the current one in previousKeys for --keep-days days; then restart the
Bridge. From then on the Bridge delivers every signal under its current key: what was waiting for a player is signed
again at delivery (the store keeps the payload as accepted), and a player whose link was open asks for the keys once
when a signal names one it does not know. --keep-days only has to cover a player that received a signal just before
the rotation and verifies it after.
Limit ·
bridge-rotation-resets-run-quotaThe speedrun leaderboards' rate buckets are keyed by an HMAC derived from the event key: rotating it starts every client on a new bucket (at most one more minute's quota).
The Biscuit root key mints connector tokens: rotating it means granting every connector a new token.
# in the engine repository, the Bridge running
npm run bridge -- revoke --url=<bridge> --player=<p-…> # a player's link
npm run bridge -- revoke --url=<bridge> --token=<revocation id> # a connector's token (any of its revocation ids)A revoked player's streams end at once, and its proposals are refused, including one that overlaps the revocation
(the player and the token are checked again inside the per-player step). A player can revoke its own link: the pause
menu's "Unlink" (POST /v1/unlink). A capability also ends on its own: 30 days after its last acknowledgement, 180
days after its pairing at most.
An event key compromised (one tenant). rotate --dir=<tenant>, then remove the compromised key from
previousKeys in that tenant's config.json, and restart its instances. Players refuse what it signed from then on;
what waits for them is signed again under the new key at delivery. The other tenants are untouched.
A Biscuit root compromised. init --force is too much. Make a new root (init in a scratch folder, copy its
biscuitRoot into config.json and its root.key), grant every connector of the tenant a new token, restart, then
revoke the old tokens' ids (revoke --token=) for the window before the restart.
An instance or its host compromised. It held every private key of the tenants it served: rotate each tenant's
event key, make each tenant a new root, change the database password and the operator tokens, and read the store's
quarantine (doctor) and the logs since the compromise.
Rotation, routinely. Per tenant, at its own pace: rotate --dir=<tenant> --keep-days=30, then restart its
instances one by one (the others keep serving; the store is the same).
A signal crosses three hands: a connector, the Bridge, the player's browser. Each must be able to check the one before, and a token stolen at one step must not open the others. A connector's Biscuit opens nothing on the player's side; a player's capability proposes nothing; the event key signs but authorises no connector.
- COSE for the signed signal: a CBOR decoder in the player for nothing a JWS lacks here; the fallback if a supported browser drops Ed25519 (D15).
- Biscuit in the player: the player holds a narrow capability instead (D16).
- Per-tenant keys derived by construction: the player cannot check a derivation whose root it does not hold; a signal names its context instead (ADR 0010).
Two formats to keep, keys to rotate, and a Rust cross-check of Biscuit in CI (npm run reality:xcheck: the
WebAssembly build used in production and the Rust crate must agree on Biscuit's official samples). A capability in a
browser is readable by any script of the page: it is narrow (read and acknowledge one player's signals) and ends on
its own, but it is not a secret the page can keep from itself.
-
ADR 0007: Biscuit authorises a connector; a signature attests
an event (D15, D16; the measures in
docs/dev/reality-spike.md). - ADR 0010: a signed signal names the context it was signed for.
- The threat models:
docs/dev/THREAT-MODEL.md,docs/dev/threat-models/constellation.md. - The code:
bridge/src/biscuit.ts,bridge/src/policy.ts,bridge/src/sign.ts,src/engine/reality/protocol.ts.
Generated publication · publication générée — current documentation · documentation courante: quest'n'click 4.4.0 r1, documentation revision · révision de la documentation 8dc717c69acb62c4742b69c54a7e7dfb620f75d8.
Earlier versions and permalinks · versions précédentes et liens permanents: https://wanoo.github.io/quest-n-click/docs/
An edit made in this wiki is overwritten at the next publication · une modification faite dans ce wiki est écrasée à la publication suivante.
Edit the source · Modifier la source · Report an error · Signaler une erreur
Index (6)
Start (6)
Play (9)
Install (17)
- Requirements
- Install from the release archive
- Install from npm, once published
- Install from the repository to work on the engine
- doctor: checking your machine
- Image toolchain
- Audio toolchain: ffmpeg, fluidsynth, Furnace, uv
- Upgrade
- Upgrade notes: 4.4
- Upgrade notes: 4.3
- Upgrade notes: 4.2
- Upgrade notes: 4.1
- Upgrade notes: v3
- Upgrade notes: v2 to v3
- Coming from web-scumm
- Package reference
- Install troubleshooting
Create a game (55)
- Your first game
- Layout of a created project and of the engine repository
- The working loop
- Content principles and the identity contract
- Rooms
- Geometry: placement, walk zones, masks, layers, camera
- Something is visible but unreachable
- Reactions
- Game commands
- Conditions
- Flags, variables and events: which to use
- Custom code
- Characters
- Items and inventory
- World map
- Dialogues
- Scripts and events
- Moving characters: patrols and walks
- Exits
- Chapters and objectives
- State and saves: persistent or temporary, renaming an id, migrations
- Staging: wide rooms and animations
- The stage: lights, particles, floors
- Skin and fonts
- Title and credits
- Heroes: several characters and hero choice
- Built-in minigames
- A custom minigame
- Translations
- Music in stems
- Sound effects
- Voices: per language and per hero
- Images: prompts, cutting sheets, transparency, scale
- Asset provenance
- The storyboard, source of truth
- Puzzle design
- Classic mechanics
- Review pages
- DSL reference
- Checking your game
- What the solver proves
- Solver options
- Playtests
- Remix
- Speedrun for authors
- The sealed ending
- Production template
- Example games
- Working with an AI
- Build and release a game
- Publish on GitHub Pages
- The static game on Clever Cloud
- Other static hosts
- Sub-path, cache and service worker, incomplete deploys, going back
- Testing on a phone over the LAN
Local Studio (24)
- The local Studio: overview and launch
- Edit a room
- Placement and stage
- Preview, apply, undo
- Storyboard
- Assets and cutting
- Check: validator, solver, critical path, heat, health, coverage
- Before and after captures
- Semantic diff
- Play and replay a session
- Rule explainer
- Language and objectives
- Voices and the heroes × languages matrix
- Map
- Notes
- Remix in the Studio
- Music
- The Assistant: bring your own key
- Demo mode and studio-apply
- Local and LAN security
- Studio API
- Local MCP: setting up each client
- MCP tools
- Studio troubleshooting
Team Studio (21)
- What runs where
- Concepts: revision, transaction, span, lease, preview, build
- Starting as an invited dev
- Working together day to day
- Roles and actions: the full matrix
- Invitations
- Managing members
- Write refused on the hosted Studio: stale base revision (409)
- Write refused on the hosted Studio: span locked (423)
- Recovering after a lost lease, a disconnection or a stale preview
- Comments
- Map and semantic diff
- Publishing builds
- Remote MCP
- The game in Git
- Upgrading the engine of a hosted game
- Hosted assets
- The server's command line
- Health and metrics routes
- Trying it locally with compose.yml
- Known limits
Clever Cloud (23)
- Clever Cloud: overview, cost and prerequisites
- Apps and add-ons
- Domains and TLS
- Keycloak
- Generic OIDC and GitLab
- Configuration
- First deployment
- Backups
- RPO and RTO
- Restore the Studio on a fresh installation
- Redeploys
- Upgrading the server and checking state after a migration
- Limits of going back
- Monitoring
- Security
- Rotating keys
- Recovering admin access
- Changing domain or OIDC provider
- Worker, PostgreSQL or Cellar down
- Exporting the game and leaving the installation
- Retention
- Clever Cloud troubleshooting
- Costs and teardown
Reality Bridge and connectors (16)
- The Reality Bridge: what it is
- Quick start
- Guarantees
- Install and run the Bridge
- Backup and restore
- Several tenants
- Signals and the manifest
- The Bridge's command line
- Connectors overview
- Email connector
- Telnet connector
- SSH connector
- Open Badges connector
- The connector SDK
- Security: Biscuit and signatures
- Bridge and connector troubleshooting
Contribute (25)
- Welcome
- Developer setup
- The dev loop
- Before a pull request
- Conventions
- Writing documentation
- Architecture
- Code tour
- Import boundaries
- Which tests run when
- Mutation testing
- The coverage ratchet
- The quality baseline
- CI explained
- Field passes
- Benchmarks
- Releasing
- npm packages
- Decisions and ADRs
- Governance
- Bot pull requests
- Contributing with AI agents
- Security policy
- Code of conduct
- Licences and credits