0xDocs 0x.limo

Docs / Security

Source integrity

Publish your game's source with its listing. 0x rebuilds it in a sandbox, checks that every file players download is exactly what the source builds, scans it, and shows "Source verified" on the store.

Publish your game's source with its listing. 0x then:

  1. fetches the source at the exact commit or content id you name;
  2. builds it in a sandbox with the toolchain you pin;
  3. checks that every file players download is byte-for-byte what the source builds;
  4. scans the source for malware and abuse, and has an AI model review it;
  5. shows the result to the operator who reviews your listing.

When the rebuilt files match and an operator approves the version with the audit in front of them, the store page says Source verified, with the commit.

Source integrity is optional. A listing without source still goes through store review.

#1. Where the source lives

where--sourcenotes
Public GitHub, GitLab or any git hostgit:https://github.com/you/game.git#<commit>The full 40-character commit id: branches and tags move, a commit doesn't.
Private repository, deploy keygit:git@github.com:you/game.git#<commit> with --source-access deploy-keyRun 0x submit deploy-key <id> first, then add the printed key to the repository as a read-only deploy key (GitHub: Settings → Deploy keys; GitLab: Settings → Repository → Deploy keys). Fetched over ssh.
Private repository, tokengit:https://gitlab.com/you/game.git#<commit> with --source-access token --source-token-file token.txtA read-only token. 0x stores it sealed and never shows it again.
IPFSipfs:<cid>A directory, or one tar, tar.gz or zip file. Keep it pinned until the check is done. Add a directory with ipfs add -r --hidden: without --hidden, dot-files such as .cargo/config.toml or .npm-cache are left out and the build fails.
BitTorrenttorrent:<infohash> or torrent:magnet:?xt=urn:btih:…Keep seeding until the check is done. Add trackers to the magnet link.

Caps: 2 GB and 200,000 files of source; a 30-minute build with 8 GB of memory; 4 GB of output.

#2. The build recipe: 0x.build.json

Put it at the root of the source:

json
{
  "image": "node@sha256:<digest>",
  "steps": ["npm ci --offline --ignore-scripts --cache .npm-cache", "npm run build"],
  "output": "dist",
  "env": {"NODE_ENV": "production"}
}
  • image: the toolchain, pinned by digest (name@sha256:<64 hex>). Get it with docker image inspect --format '{{index .RepoDigests 0}}' node:20. A tag can change; a digest can't.
  • steps: 1 to 50 shell lines, run in order in a copy of the source, as an unprivileged user, with no network. The build can't download anything, so commit what it needs. For npm, commit its cache (npm ci --cache .npm-cache once, then commit .npm-cache), so that npm ci --offline installs exactly the lockfile's packages.
  • output: the directory whose files you publish (0x publish dist).
  • env: up to 50 plain variables.
  • SOURCE_DATE_EPOCH is set to the commit's time (0 for IPFS and torrents). Use it for any date your build embeds.

Instead of a file you can pass the recipe inline in the submission (source.build), or name another file with --build-file.

Builds must be reproducible: the same source must give the same bytes. Avoid timestamps, random ids and absolute paths in the output, and sort whatever you concatenate.

#Rust and WebAssembly

For a Rust engine built with wasm-bindgen:

  • Use the official rust@sha256:… image of your Rust version, and carry everything else in the source.
  • cargo vendor the crates, with a .cargo/config.toml that replaces crates-io with vendor/ and sets [net] offline = true.
  • The image has no wasm32 target. Add the rust-std-<version>-wasm32-unknown-unknown.tar.gz that rust-lang's channel manifest (static.rust-lang.org/dist/channel-rust-<version>.toml) names, check its SHA-256 in a step, and point CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS=--sysroot=… at it.
  • Build wasm-bindgen-cli of the same version as your wasm-bindgen crate from its crates.io source, vendored with the rest.
  • Put upstream code under vendor/ or third_party/: the AI review reads your own files first.

Such a source is hundreds of MB, so run 0x source check --no-scan locally (the reviewers' scan has no size limit).

#3. Check it before you submit

bash
0x source check . --site my-game --site-version 3

This runs the same scan the reviewers see (a dry run: nothing is stored), then runs the recipe in Docker with the same sandbox arguments, and compares the output with what players get from your hosted version. Compare against a local directory with --against dist, or against any origin with --against-url https://…/. --no-build and --no-scan skip a stage. On a mismatch it names the files and exits with status 3.

#4. Submit

bash
0x publish dist --site my-game                       # the files players get
0x submit . --site my-game --site-version 3 --source git:https://github.com/you/game.git#<commit>
0x submit source-status my-game                      # the check: match or mismatch, and the audit

Or set it in 0x.config.json:

json
{
  "listing": {
    "source": {"kind": "git", "url": "https://github.com/you/game.git", "commit": "<40 hex>", "build": {"file": "0x.build.json"}}
  }
}

A declaration is checked when you submit (400 names the bad field), so a broken one never queues a check.

#What is compared

  • A hosted site version: the files you uploaded with 0x publish, by SHA-256. The files 0x adds (x1.json, x1-sw.js, x1/, swarm/) are not part of it.
  • A game published as builds: the build's files, encrypted files and large files in parts included. Check a build with POST /v1/apps/<appid>/builds/<build>/publish {"branch": "public", "source": {…}} and read the result at GET /v1/apps/<appid>/builds/<build>/source.
  • A web game served from your own host can't be verified, because 0x can't know what your server sends. The source is still scanned and reviewed, and the result is unverifiable.

Every published file is match, mismatch, missing (published, not built) or extra (built, not published; allowed). The verdict is match only when every published file matched.

#5. What reviewers see, what players see

  • The file table: every published file, rebuilt identically or not. One mismatch and the source is not verified.
  • The scan: languages, binaries and archives in the source, minified or obfuscated code, where dependencies come from, and constructs malware uses, each with file and line. Those constructs include eval of strings, running programs, code loaded from other hosts, miners, wallet drainers, and clipboard and key capture. The rules are public:
bashtested
curl -s -o /dev/null -w '%{http_code}\n' https://api.0x.limo/v1/sourcecheck/rules
  • The AI review: a model reads the source (flagged files first) and reports only malware and abuse. It is advisory: an operator decides, as for any submission. AI findings never reach you on their own. You only see issues a reviewer raises (see Review).

Players see one of three states on the game page: Source verified (with the commit, where the source is, and the audit summary), Source check failed, or Source not provided. Source verified means "built from this source, and reviewed", which anyone can check again. The public record is at GET /v1/listings/{id}/source, and the catalog carries source_verified per game.

#API summary

callauthwhat
POST /v1/listings with sourceyouSubmit with a source; the response carries source: {job, status}.
GET /v1/listings/{id}youEach version's source status, verdict, file counts and audit summary. Credentials are never returned.
GET /v1/listings/{id}/source/deploy_keyyouThe read-only deploy key to add to a private repository: {public_key, fingerprint}.
GET /v1/apps/{appid}/source/deploy_keyyouThe same, for builds.
GET /v1/apps/{appid}/builds/{build}/sourceyouA build's check.
POST /v1/sourcecheck/scanyouThe deterministic scan of a tar (up to 50 MB) as a dry run. Nothing is stored.
GET /v1/sourcecheck/rulespublicThe scan's rule data.
GET /v1/listings/{id}/sourcepublicThe live version's source record and verified flag.