Threats

Who would attack this forge, what each wants, and what stands in the way. Every protection is one bullet ending in one Enforced by: line that names the test file (test/….test.ts) or the gate (scripts/….ts) that enforces it, or says none yet plainly, with (#N) when an open issue owns the gap. Each row of the internal-calls table names its enforcer in its last cell the same way. test/threats-enforced.test.ts fails on a row with no such line or a named path that does not exist, and prints how many rows say none yet. A protection nothing enforces is a gap, not a secret: the count is the to-do list, and only editing a row lowers it.

Each section below is its own file in docs/threats/, so a change to one adversary's protections touches only that file; the Resilience page, the served document and test/threats-enforced.test.ts read the sections in this order, as one document.

A snooper on the network

Wants: session cookies, tokens and pushed code in transit, or to learn who talks to whom.

A stolen token

Wants: to act as the person or agent it was issued to, for as long as it works.

A compromised vendor

Wants: to run its code on the forge or in an app through something the forge trusts: a package, a model provider, a hosting provider, an origin it syncs from.

A hostile agent inside a run

Wants: to read what it was not given, reach what it may not, or land code no person approved.

An automated attacker at scale

Wants: accounts, spam, resources, or a way to exhaust the forge.

Internal calls

FORGE_SELF_SWAP=1 binds the web port with SO_REUSEPORT so a release can share it, which also lets any process running as the forge's user join the listener and take a share of its connections, login posts included. It assumes nothing else runs as that user on the host network (agents and apps are sandboxed or in cells). Only one swap is made per process, so two landings never leave two releases serving. The swap is refused unless net.ipv4.tcp_migrate_req=1, for without it the old listener closing resets queued connections. Enforced by: test/release-swap.test.ts

How each part proves itself to the next, today.

CallAuthenticated byEnforced by
runner → forgethe run's scoped token (FORGE_TOKEN) and a few-minute passport (FORGE_PASSPORT)test/passport-edge.test.ts
git hook → forgeper-boot secret in x-forge-hook-secret on the internal listener; a call without it is refused and countedtest/crew-sandbox.test.ts
cell → proxythe proxy's Unix socket bound into the cell's own network namespace; no credential, the namespace is the identitytest/contain.test.ts
host → cellthe relay carrying a visitor to an app dials the cell's in.sock by the inode it opened with `O_PATH \O_NOFOLLOW and checked (a socket, the cell's uid, one name), through /proc/self/fd/N, so a symlink or hard link the cell plants there reaches no host socket, and the refusal is a line in the owner's log; the uid check holds because a cell runs as the forge's own uid (--unshare-user with no --uid/--gid, cellNamespaces`) (#14752)test/cell-socket-pin.test.ts
edge → podX-Plat-Edge-Token equal to FORGE_EDGE_TOKEN, compared as fixed-width digests; without it X-Plat-User is ignored; the signin.edge setting (admin, refused for an admin with no password or passkey) turns the edge's identity off on every doortest/edge-auth.test.ts
child → parenta heartbeat and a brokered sign-in are signed (HMAC) with the key spawn gave both sides, looked up by the name inside the signed body, so the door a call arrives on says nothing about whose it is; the lent model by a bearer whose hash the parent keeps; a child's door answers those routes and nothing else. Code is pulled over public git, and the claim link (sha256 kept, 24 hours, single use) hands the child to its persontest/boundary-tenancy-cell.test.ts

Gaps: edge → pod and runner → forge ride a shared secret, not a per-call signature.

A child forge running its own code (#11144)

A cell child's owner may switch it from the parent's code to its own <org>/forge main (spawn/own_code.ts). The code is then the child's author's, so treat it as hostile code in a cell, the same as any app.

What it cannot reach: the cell's memory, CPU, disk and I/O limits, its sandbox and its egress list are the same as with the parent's code, and nothing in the child's repository is read to make them. The parent's data, home and temporary directory are hidden; only the parent's code and the one checkout (a tree, with no .git) are revealed, read-only. Its forge.json is not run by the parent: the parent finds the repository only as a directory of the child's own (never through a link), refuses a repository or tree over 256 MB or 50,000 files and any symbolic link in either, checks that src/main.ts parses and forge.json is JSON, and never executes the child's code outside the cell. What the parent records about a failed start is fixed wording: one of a list of the parent's own sentences. Nothing the child wrote or printed reaches the ledger, the rollback row or the forge.rolled_back event; its last lines go to the parent's log.

What it can reach: everything a child forge can reach, no more: its own data directory, the parent's heartbeat door and public address, the hosts the admin allowed for models, registry, payment and origins (the public git hosts and the forges its parent holds beside it), and the sign-ins its parent brokers for it. It can lie in what it serves and in its heartbeat, and can break itself: a start that fails to answer within the deadline rolls back to the last commit that came up, then to the parent's code, and the owner's /forges page shows a Rolled back row saying so. A commit that failed is not tried again until main moves. A child that comes up and breaks later is not rolled back; the owner switches it off. Hosted children run inside the parent's process and cannot turn this on.

Honeypots (later)

A kind: "honeypot" app, a decoy that records what touches it, is not built. forge.json accepts web and service only. Before one may exist:

Until then, nothing here claims one.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs