Security model for developers
How 0x isolates hosted games from each other and from the platform, and what each layer means for your code.
A game hosted on 0x is code from a developer, running in a player's browser next to other developers' games and next to the player's 0x account. The platform puts several layers between them. Each layer is on by default on 0x.limo. You only need to act when your game needs something from outside its own origin.
| layer | protects | what you do | page |
|---|---|---|---|
| An origin per site | Your game's storage, cookies and frames, from other games | Nothing. Use relative URLs. | Site origins |
| Cross-origin isolation (COOP, COEP, CORP) | Gives you SharedArrayBuffer and threads, and keeps other windows out of yours | Load outside resources with CORS, or as credentialless | Isolation headers |
| Content-Security-Policy per version | Players, from a compromised build that loads or sends data elsewhere | Declare outside hosts with "csp" | Content-Security-Policy |
| Permissions-Policy | Camera, microphone, location, USB, serial, HID and payments: off unless declared | Declare the permissions you use | Permissions-Policy |
| Content-addressed, immutable versions | Players, from files changed after publish, and from bad bytes off the swarm | Nothing | P2P delivery |
| Source integrity (optional) | Players, from a build that doesn't match its source | Publish your source and a build recipe | Source integrity |
| Store review | Players, from malware and abuse | Answer review issues | Review |
#What a hosted page can and can't do
A page at https://<site>-play.0x.limo/sites/<site>/<n>/ can:
- load anything from its own origin, including WebAssembly (
'wasm-unsafe-eval'), workers (also fromblob:), and images, media and fonts fromdata:andblob:; - call the platform API (
https://api.0x.limo, with CORS) and the swarm and broadcast services onplay.0x.limo, over HTTPS and WSS; - use WebRTC (peers, TURN), which CSP does not govern;
- use fullscreen, gamepads and autoplay;
- be framed by any
https:page (the store,0x.limo/embed/<id>, X player cards, blogs); - reach whatever else you declare.
It can't:
- read or write another game's storage, or script another game's frame;
- set cookies from the server: the front removes
Set-Cookiefrom every hosted response; - load scripts, styles, connections, images, media, fonts or frames from other hosts without a declaration, once the version's policy is enforced;
- use
eval/new Function, or<style>elements created at runtime, without a declaration; - use
<object>/<embed>, change<base>, or post forms to other hosts.
#Things 0x never does with your site
- It never serves a hosted site from the API's origin. The page where developers mint publish tokens
(
api.0x.limo/hosting/) and the player's session live on origins your scripts can't reach. - It never changes a published version: versions are immutable (see What you control).
- It never takes your security headers from the client: the front strips any
X-X1-*request headers before it asks the backend for your version's policy.
#Reporting a vulnerability
If you find a way around one of these layers, report it privately to the 0x team instead of publishing it. Don't test it against other developers' sites or other players.
