interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / SANDBOX-NEEDS.md

451 lines · 33888 bytes Raw Blame History Rendered
1# forged sandbox needs
2
3Baseline: `c0f108e7fcd854edbda3e64f260af58c47c86d30`. This is a candidate,
4not a deployment. The wrapper is existing-host shell infrastructure as explicitly
5requested by L1058. The server remains seeded Omega. No dependency was downloaded.
6
7## Source inventory
8
9| Access | Source | Purpose and policy |
10| --- | --- | --- |
11| Executable | `run.sh`, `infra/spark/forged-service.sh` | The selected forged binary only, mounted read-only at `/app/forged`. No source worktree. |
12| Static assets | `server/pages.om`, `server/route.om` | CSS and page text are embedded in the binary. No asset directory is needed. |
13| Repository list | `server/repos.om:5` | `~/handoffs/radicle/RIDS.md`, first table. Read-only file inside the dedicated directory export. |
14| Repository objects, refs, config, packed refs | `server/util.om:101`, `server/repos.om`, `browse/`, `dl/`, `collab/` | Individual public bare repos under `~/.radicle/storage/<RID>`. Read-only. Denied repos and unrelated working trees are absent. |
15| Download caches | `dl/dl.om` | `<data>/archives`, temporary archive files, final archives, hashes, eviction and locks. Writable. |
16| Collaboration caches | `collab/co8cache.om`, `collab/co4pat.om` | `<data>/collab`, cached COB views and generated diffs, temporary files and locks. Writable. |
17| Social state | `social/05decl.om`, `social/20crypt.om`, `social/30store.om`, `social/40auth.om` | `<data>/social.key`, `social.log`, `social.head`, `social.head.tmp`, `tmp/` signature verification inputs. Writable. The session key belongs to this service and is necessarily visible to it. |
18| Reload | `server/main.om` | `<data>/reload` is read and unlinked. RIDS modification time is checked. |
19| Published review metadata | `collab/co2cob.om:68,1156` | Export copies of `*.verdict.txt` and `*.receipt.txt` files from `~/handoffs/hive/manager/reviews` and `~/handoffs/hive/forge/receipts`. Read-only. Other handoff contents are absent. Synthetic parent directories replace the real home and handoffs directories. |
20| Node health snapshot | `nodes/stat.om:8` | `~/.local/state/aien-factory/nodes.txt`, read-only individual file if present. No node databases, keys, control sockets or other factory state. |
21| Logging | `server/main.om`, service wrapper | The server writes its inherited stderr. The supervisor owns `<data>/logs` and `<data>/forged-supervisor.pid`. These are mounted read-only inside the child so it cannot plant symlinks or falsify the pid that the supervisor trusts. The reload writer uses an atomic replacement, not touch on a child-controlled path. |
22| Programs | `server/util.om:102,560`, `social/20crypt.om`, `dl/dl.om` | `/usr/bin/git`, `/usr/bin/ssh-keygen`. The installed Git compresses tar.gz internally. Only these binaries and the dependencies reported by their local `ldd` are mounted read-only. No shell or gzip executable is mounted. The probe replaces the main executable with dash and reads its script on stdin; it gets the same filesystem profile. |
23| System data | signature verifier, loader, Git archive | Synthetic one-user `/etc/passwd`; no host account database. Read-only `/etc/localtime` is required for byte-identical ZIP date fields. `/dev/null`, `/dev/urandom`. Private read-only `/proc`, not the host process view. |
24
25Git may consult its repository's config and attributes. The sandbox hides the host
26Git configuration, SSH keys, SSH agent, vault, home dotfiles, other repositories
27and executables. Repository symlinks cannot lead back to a hidden host path.
28
29`nodes/snap.om` is a separate producer, not a forged child. Its sqlite3, rad,
30node databases and network access are not needed inside the web server.
31
32## Network and processes
33
34Unsandboxed, `server/main.om` calls `hlisten` on IPv4 loopback, port 18480, then accepts
35HTTP connections. The private build changes only the port to 19830 and home path
36constants to its fixture. Runtime tracing is retained by the test runner.
37The composed server has no outbound connect call or Unix socket dependency: the seed
38library's `hdial` is compiled in but never called. Git and ssh-keygen are started with
39explicit arguments and an empty environment, and only read local files.
40
41Since r5 Part B the sandboxed server has no network (`bwrap --unshare-net`). Its private
42namespace holds only `lo`, with no listener and no route out. The 127.0.0.1:18480 listener
43is made outside the sandbox by `infra/spark/forged-listen.om`, a seeded-Omega helper that
44binds, listens, puts the listener on descriptor 0 without close-on-exec, and execs the next
45program with a fixed environment.
46
47Since netns r2 the service supervisor owns the listener for its whole life. `forged-service.sh
48_loop` takes the port once through forged-listen (exit 3, and no service, when the port is
49taken), checks that descriptor 0 is the listener on its port, keeps it on a descriptor of its
50own, and hands it on descriptor 0 to every forged it starts. The port is never unbound while
51the supervisor runs: connections that arrive during a restart wait in the queue (backlog 64)
52for the next forged, and no other local process can bind the port in between, provided the child
53cannot give the listener away (the listener guard below). A restart for
54a new repository set is a drain: the supervisor writes the flag file `<data>/restart`
55(atomic replacement, like the reload flag), forged removes it and exits 0 after the connection
56it is serving, and after 10 s without an exit the supervisor sends TERM. A direct wrapper start
57with `FORGED_LISTEN_PORT` still makes its own listener through forged-listen.
58
59With a listening socket on descriptor 0 the wrapper adds `--inherited-listener` in every mode
60(network cut on or off, sandbox on or off). forged checks that descriptor 0 is the IPv4
61listener on 127.0.0.1 and its compiled port, moves it to a close-on-exec descriptor, and puts
62/dev/null on descriptor 0, so git and ssh-keygen never inherit it. Without
63`--inherited-listener`, forged binds its own listener exactly as before.
64
65The listener, and every connection forged accepts from it, belongs to the host network
66namespace, so interface questions asked through them are answered about the host: SIOCGIFCONF,
67SIOCGIFNAME, SIOCGIFADDR, SIOCGIFHWADDR, SIOCGIFNETMASK, and SO_BINDTOIFINDEX followed by
68SO_BINDTODEVICE (the review found the first; r2 found the others). No namespace setting changes
69that, because the namespace belongs to the socket. The socket filter closes it: a classic BPF
70seccomp program written by the seeded-Omega generator `infra/spark/forged-seccomp.om`, built by
71`run.sh` into `forged-seccomp.bpf` beside forged and installed by bwrap (`--seccomp`) just
72before it executes forged. It allows ioctl only for FIOCLEX, FIONCLEX, FIONBIO, FIONREAD, TCGETS
73and TIOCGWINSZ; socket and socketpair only for AF_UNIX (no netlink, inet or packet socket);
74setsockopt only for TCP_NODELAY and SO_REUSEADDR, SO_SNDBUF, SO_RCVBUF, SO_KEEPALIVE; it refuses
75connect, shutdown and io_uring; everything refused fails with EPERM. A system call from any
76architecture other than AArch64 kills the process. The wrapper refuses a filter that is
77missing, inside data or export, or not a whole number of 8-byte instructions.
78`FORGED_SECCOMP` names another location (tests use it for host tools). bwrap installs the filter
79in its last step, after it has brought up lo in the new namespace (one SIOCGIFINDEX and a netlink
80socket of bwrap's own, outside the filter), so it covers forged from its first instruction and
81every process forged starts. The gate makes three traces with process tracking: the server serving
82the smoke and download routes (forged starts git many times there), and git and ssh-keygen each run
83directly as the wrapper's program (bwrap starts that program as /app/forged). It requires no EPERM
84(the filter must not change what forged does) and checks with `infra/test/seccomp-order.py` that
85each of the three programs starts under the filter (by its arguments: `--inherited-listener`,
86`log`, `-Y`), that forged's git runs under it, and that no process under the filter opens a
87netlink or inet socket or gets an answer from an ioctl outside the allowlist. A filter that allows
88everything must fail that check. The only refusal the work meets is glibc's name-cache lookup in
89git and ssh-keygen (connect to /var/run/nscd/socket, ENOENT before the listener guard); glibc
90then reads the files, as before; the gate allows exactly that refusal and counts it.
91
92**Listener guard** (netns r2 review of 8f6b4a29, findings 1 and 2). The listener is shared: the
93supervisor and the child hold the same socket. Three calls on the child's copy give the port
94away: shutdown (SHUT_RD or SHUT_RDWR) and connect with an AF_UNSPEC address both disconnect a
95listening socket, after which a local process with SO_REUSEADDR binds 127.0.0.1 on the port and
96receives the connections (the supervisor's copy is the same disconnected socket); and SO_REUSEPORT
97lets a local process with SO_REUSEPORT bind the same address and take a share of new connections
98(6 of 8 in the review). The filter refuses connect, shutdown and SO_REUSEPORT. forged calls none
99of them (it never connects; the listener is bound outside). Gate steps: `seccomp-table`
100(`infra/test/seccomp-table.py` runs the filter bytes over a table of 45 calls, without trusting the
101generator's notes), `netns-poison` (`infra/test/listener-poison.py`, under the real forged-listen:
102the sandboxed leakprobe makes each call on the inherited listener, a rival with SO_REUSEADDR and
103SO_REUSEPORT tries the port, the successor forged starts on the held listener, 8 connections show
104who answers), and controls that must reproduce each case: `seccomp-table-control` and
105`netns-poison-control` (the 8f6b4a29 filter), `netns-poison-mutants` (this filter with one rule
106removed each). Measured on the host (not a gate step): listen() again on the same socket, shutdown
107SHUT_WR, connect to an inet address and sendto with MSG_FASTOPEN do not free the port. A listener
108made without SO_REUSEADDR would also keep a rival out after a disconnect, but then the next start
109after a stop cannot bind while the port's TIME_WAIT sockets last (62.5 s measured after three
110server-closed connections), so the supervisor keeps SO_REUSEADDR and the guard is the filter.
111
112The only thing inside the sandbox that needs a socket is the listener. Signature checks
113(ssh-keygen -Y) and git (log, show, cat-file, archive on local storage) need none, and the
114gate traces both under the private namespace. Connections that remain outside the sandbox:
115the counts collector (`forged --counts-snapshot` with `rad node routing` and `getent`) and
116`public-read` run in the supervisor's account, as before. `FORGED_NETNS=off` returns to the
117shared host network with no socket filter, with a loud warning on every start.
118
119Abstract Unix sockets belong to the network namespace, so the private namespace also hides
120the host's abstract sockets. Filesystem Unix sockets were already hidden.
121
122Descriptors: the wrapper closes every descriptor above 2 that its starter left open, first,
123on every path (service, direct, `FORGED_NETNS=off`, `FORGED_SANDBOX=off`). Descriptor 0 stays
124(the listener or /dev/null). The only descriptors opened afterwards are the passwd entry and the
125socket filter, which bwrap reads and closes itself. The counts collector closes the same way.
126
127Processes have no_new_privs, no capabilities, a private PID namespace, a private
128IPC namespace and a new session. Further user namespaces are disabled. With the network cut on,
129the socket filter above applies. Only FORGE_DATA is a writable host filesystem mount.
130Its supervisor log directory and pid file are protected read-only submounts.
131Direct launches must create these real paths first; the supervisor already does.
132
133## Dependencies and host prerequisite
134
135The host's installed bubblewrap is 0.9.0. The unprivileged `bwrap --ro-bind / / true`
136probe succeeded. The stronger user/PID/IPC/UTS namespace probe also succeeded.
137`/etc/apparmor.d/bwrap` already grants `userns` to `/usr/bin/bwrap` with
138`flags=(unconfined)`. No root change is needed here. The wrapper fails closed on
139setup errors. It never changes AppArmor or silently selects a weaker mechanism.
140Exact installed package versions and binary hashes belong in the run evidence.
141
142Host dependencies are Bash, bubblewrap, setpriv, coreutils (including `env`, which starts
143bubblewrap with an empty environment), awk and ldd for setup, util-linux `prlimit` for the
144resource limits (r5), and Git, OpenSSH ssh-keygen and their resolved libraries for service
145execution. The listener helper and the socket filter generator are seeded Omega, built by
146`run.sh` beside forged as `server/forged-listen` and `server/forged-seccomp.bpf`. The gate's
147interface-leak probe `infra/test/leakprobe.c` is a test instrument built with the host gcc:
148seeded Omega has no ioctl word and only six socket options. The long-term Omega replacement is a native namespace/mount launcher
149and native repository/archive/signature operations. This candidate does not
150claim to have replaced those host tools.
151
152## Public metadata refresh (r2)
153
154The trusted supervisor owns `FORGED_PUBLIC_DIR`, default `$FORGE_DATA/../forge-public`.
155It runs `forged-public.sh` before launch and each supervisor pass. The default interval
156is two seconds (`FORGED_MIRROR_INTERVAL`, whole seconds from 1 to 99). No systemd unit
157or timer is installed. This is the supervisor loop requested by the r2 brief.
158
159`public-read.om`, compiled by the pinned compiler, opens each path component with
160NOFOLLOW, enters directory descriptors, and accepts only regular files. It reads at
161most the cap plus a detection byte and emits nothing unless the whole file fits.
162The per-file cap is 1048576 bytes. No Python is in the runtime or build path.
163The test and timing oracles use Python outside the service.
164
165The export contains `RIDS.md`, `nodes.txt`, the selected `*.verdict.txt` files from
166`handoffs/hive/manager/reviews`, and selected `*.receipt.txt` from
167`handoffs/hive/forge/receipts`. Sources stay untouched. Changed bytes go through a
168new temporary file inside the export and an atomic rename. Missing, unsafe or
169over-cap sources revoke the old export. Equal bytes retain their inode and time.
170The export is mounted read-only at each of the four expected metadata directories.
171Only synthetic ancestors are visible, never the owner's containing directories.
172The export must be disjoint from writable data and the source metadata trees.
173
174Whole-file copying still reveals more than the public page needs:
175- RIDS includes later tables, source working-directory paths, timestamps and notes.
176 The application parses only the first allow-list table.
177- The node snapshot includes every repository known to the producer, not only
178 public repositories. `nodes/snap.om` explicitly records this fact.
179- Verdicts include the whole review, although some consumers show only its verdict.
180- Receipts include reviewer, author, clone and command/evidence information beyond
181 the public result. The exact excess depends on the producer's file contents.
182
183Repository binds remain individual and read-only. A digest covers sorted allowed
184RIDs, resolved directory paths and directory identities. A changed mount set sends
185TERM to the child, waits for its exit and starts a new child without crash backoff.
186TERM drops in-flight connections; this is not graceful request draining. One log
187line names the set change. Content pushed into the existing directory leaves its
188identity unchanged and needs no restart. RIDS content changes with the same mount
189set are handled by the application's normal metadata reload.
190
191`run.sh build` now also builds `public-read` beside the selected forged output.
192`run.sh deploy` stages and records it with the binary, but deployment is not part
193of these private checks. The supervisor fails closed if its reader is missing.
194The wrapper never launches a compiler or downloads a dependency.
195
196The forward-fit check uses an isolated local clone at the specified integrated
197head. Its newer counts reader needs two nginx logs and their rotations,
198`/usr/bin/getent`, `/usr/bin/env`, the Radicle command, and node routing state.
199These are outside the r2 metadata export. The acceptance test redirects them to
200controlled fixtures, exercises positive inputs outside the sandbox, and compares
201the sandbox's result. Missing data must not be silently called compatible.
202Galaxy files and quiet state already live under service data. The visits program
203is a separate owner-side reader of the supervisor log, not a forged child.
204
205The pinned baseline has no `infra/RUNBOOK.md`. The coordinator's later copy at
206`../wt/infra/RUNBOOK.md` was read as context only. It names `infra/smoke.sh local`
207as the direct forged check. Its public smoke, nginx edge tests and backup drills
208do not target a private forged instance. The latter drill is absent at this pin.
209The candidate makes the existing smoke suite accept `FORGE_TEST_PORT` and runs
210it unchanged otherwise. The existing download HTTP suite accepts fixture storage
211and an evidence destination so it does not rewrite historical transcripts.
212The JSON route at this pin is `/status.json`; newer repository JSON APIs are absent.
213
214## Reproduce
215
216Run `bash infra/test/sandbox.sh` from this checkout. It acquires pool-12-14,
217pins cores 12,13, creates fixtures under the worktree's parent, compiles with the
218exact run.sh compiler pin, traces the unrestricted private baseline, compares
219HTTP bodies with cmp, runs existing smoke/download tests and isolation probes,
220and challenges the probe with a writable-repository mutation. It tests both a
221valid and an invalid SSH signature using a throwaway private key outside the
222sandbox. Every check writes its command, exit status, log and log SHA-256.
223Evidence is under `../sandbox-evidence`; `latest` names the run directory.
224
225Rollback is explicit: `FORGED_SANDBOX=off` runs the selected binary directly and
226prints `OWNER ACCOUNT EXPOSED; SANDBOX DISABLED` to the service log.
227
228## Historical r2 forward fit on the integrated head
229
230The r2 integrated gate is BLOCKED by count parity. Its private run is
231`../sandbox-evidence/r2-on-one/run.XClz1X`. All original isolation controls,
232metadata replacement, source refusal controls, live push and five automatic
233repository-set restarts passed. Quiet pages with a real fixture sign-in, filter
234writes, `.receipt`, galaxy files and public JSON byte comparisons passed.
235The existing JSON walker visited 164 pages, covered 22 schemas and reported no
236failures. The visits suite passed. These facts do not make the full gate pass.
237
238The positive count fixture has one git fetch, one upload-pack request and three
239seed announcements outside the sandbox. All become null inside it. Even the
240service-log count becomes null because its visitor filter needs the unavailable
241address lookup. `integrated-counts-comparison.json` retains both responses.
242The installed Radicle command, traced against an empty private home, exits 1
243and says its profile is missing. No owner identity or node was borrowed.
244
245Additional inputs in `3edf9201`, relative to the original sandbox base:
246
247| Path/program | Use | Present in this profile? |
248| --- | --- | --- |
249| `/var/log/nginx/aienos-dl.log` and `.1` | Clone/fetch requests and rotation tail | No |
250| `/var/log/nginx/aienos.access.log` and `.1` | Upload-pack requests and rotation tail | No |
251| `/usr/bin/getent hosts www.aienos.com` | Exclude the owner's address from visitor counts | No. Its resolver/configuration dependencies are not granted. |
252| `/usr/bin/env` and `~/.radicle/bin/rad node routing` | Read routing announcements under an explicit HOME | No |
253| `~/.radicle/node/node.db-wal` | Trigger routing refresh when node state changes | No |
254| Radicle profile and routing database | Prerequisites of the command above | No. Empty-home trace stops at the profile requirement. Later prerequisites are not qualified. |
255| `<data>/counts.log` | Counts and source positions | Writable application data |
256| `<data>/growth/seeds.log` | Growth history; other growth JSON caches share this directory | Writable application data |
257| `<data>/quiet/events`, `quiet/subs`, `quiet/out/<subscriber>` | Notification events, filters and digests | Writable application data |
258| `<data>/galaxy/index.html`, `galaxy.css`, `tokens.css` | Prebuilt galaxy page and styles | Application data. The outside producer is not a child. |
259| `<data>/owner/visits.html`, `visits.tsv`, styles | Separate owner analytics | Application data, if populated. Its renderer and private HTTP server are outside this profile. |
260
261No additional socket was used by the successfully exercised forged routes.
262The galaxy producer's factory stream and the visits owner's private listener are
263separate processes, not required child sockets. The real routing command beyond
264its missing-profile refusal was not qualified. This is not a claim of complete
265network isolation or a working Radicle command inside the sandbox.
266
267The r2 export contract named only RIDS, node snapshots, verdicts and receipts.
268Adding raw request logs, owner profile files or a node control socket would widen
269that contract and the privacy boundary. The r3 brief approved the following change: a
270public count snapshot written outside the sandbox, with the web reader consuming
271only that snapshot. Reusing node snapshot copy counts as routing announcements
272would change the meaning of the result and is not an equivalent fix.
273
274## Historical r1 result (superseded by the r2 report)
275
276The final run is `../sandbox-evidence/run.fGiVwY`. The full gate exits 4, BLOCKED,
277because the FIFO-synchronized atomic RIDS replacement check exits 1 and reports
278that the sandbox still reads the old inode. This is an observed failure, not a
279prediction. Fixing it needs a public input publication layout outside the private
280handoff directories, plus a mount refresh policy when the allowed repo set changes.
281Those producers are outside this brief's permitted worktree. They were not changed.
282
283HTTP body comparisons passed for the root, explore, CSS, project, blob, raw file,
284ZIP, tar.gz and populated status JSON. The JSON uses an explicitly future-dated
285fixture to keep its age field stable; it is not a measurement of the real node.
286The existing smoke and download HTTP suites passed. The private supervisor started
287the sandbox, accepted HUP and stopped. Its reload operation did not follow a
288planted symlink; a symlinked log directory was refused before writing.
289
290The probe could write application data, but could not read the owner SSH keys,
291Radicle keys, vault, private handoffs or shadow file, or write outside the allowed
292application state. It could not change the supervisor log directory or pid file.
293NoNewPrivs was 1 and effective capabilities were zero. Sudo was unavailable inside
294the profile. Removing a repository's read-only mount made its write control fail,
295as required. The real SSH verifier accepted a valid signature and rejected a
296changed message. Explicit sandbox-off rollback printed the required warning.
297
298The baseline trace records a loopback bind and Git execution. No outbound connect
299was observed on those requests. Signature verification was exercised separately.
300Git's read of `/etc/localtime` explained the earlier ZIP byte mismatch; the final
301comparison passed with that file mounted read-only. Trace, commands, exit codes,
302compiler/source/binary hashes and log hashes are in the evidence directory.
303
304Installed versions recorded there: bubblewrap 0.9.0-1ubuntu0.3; util-linux
3052.39.3-9ubuntu6.6; Bash 5.2.21-2ubuntu4; coreutils 9.4-3ubuntu6.3; mawk
3061.3.4.20240123-1build1; libc6 2.39-0ubuntu8.9; Git 1:2.43.0-1ubuntu7.3;
307OpenSSH client 1:9.6p1-3ubuntu13.19. Dash and gzip are test-oracle tools only.
308No shared Omega guide was changed: no language, compiler pin or seed procedure changed.
309The service-specific reader build is documented here and in run.sh. This candidate was not pushed, merged, published or deployed.
310
311## Public aggregate counts (r3)
312
313The existing forged executable has an owner-side `--counts-snapshot JOURNAL` mode.
314It calls the existing allow-list loader, journal replay, log readers and Radicle
315routing reader. It does not listen on a port or load social state in this mode.
316The journal argument is mandatory and absolute. The supervisor places that
317journal in `FORGED_COUNTS_STATE`, default `$FORGE_DATA/../forge-counts-state`.
318That directory must be outside writable application data and the public export.
319It is not mounted in the child. Preserve this journal across service restarts.
320At a cutover from an unrestricted count-enabled version, stop the old writer and
321copy its committed `counts.log` into the owner state directory before collection.
322This preserves counts whose original log files have already rotated away.
323
324`forged-counts.sh` starts collection outside the sandbox, pinned to the same cores.
325It publishes `counts.snapshot` by writing a unique temporary file in the export
326and renaming it after successful collection. A failed collector removes the old
327snapshot. Collection runs alongside the supervisor so it does not block HTTP,
328metadata refresh, restart or stop handling. The supervisor starts it at launch,
329on an allowed repository set change and every `FORGED_COUNTS_INTERVAL` seconds
330(default 900, permitted 1 through 1800). Runs never overlap within one supervisor.
331A collection is stopped after 300 seconds. No scheduler or systemd unit is added.
332
333The wrapper sets `FORGED_COUNTS_SNAPSHOT=1` in its otherwise cleared environment.
334Only this mode switches the count reader. Unrestricted behavior is unchanged.
335The sandbox reads the file at the existing public-export mount under
336`handoffs/radicle/counts.snapshot` before each project HTML or JSON count response.
337It opens a regular file without following its final symlink (aarch64 open flags
338O_CLOEXEC, O_NOFOLLOW 0100000 and O_NONBLOCK, value 559104). Directory mounts
339make atomic replacements visible immediately, with no restart or cached inode.
340
341Format is ASCII, version 1. Header: `1 COLLECTION_EPOCH` followed by LF.
342Each subsequent line is `RID GIT UPLOAD ARCHIVES ASSETS SINCE0 SINCE1 SINCE2 SEEDS STATUS SEED_EPOCH`
343followed by LF. Fields have exactly one separating space. RID omits `rad:` and
344contains only ASCII letters and digits. All other fields are unsigned decimal
345integers. They have at most 20 digits and must fit in an unsigned 64-bit integer.
346Leading zeroes are accepted. STATUS is 0, 1 or 2; 1 means seeding was measured.
347SINCE values and SEED_EPOCH are Unix seconds. Zero means unavailable where the
348existing renderer uses it. Archives plus assets must not overflow. The file
349contains only public project identifiers, aggregate figures and collection times.
350It contains no client address, user agent, raw request line or key material.
351
352Limits: 65536 file bytes, 257 LF-terminated lines including the header, 256 bytes
353per line excluding LF, 11 row fields, 64 bytes per field, 256 project rows (FAMAX,
354server/util.om; 16384 bytes, 65 lines and 64 rows before 2026-11-14, when the
355allow-list table grew for the native store).
356Duplicate project identifiers, incomplete lines, wrong field counts, invalid
357numbers, future collection time or source times after collection are rejected.
358Files older than 3600 seconds are rejected. A missing, rejected or stale snapshot
359clears all count availability. Existing HTML says `not measured`; JSON uses null.
360A project absent from an otherwise valid snapshot is also unavailable. Reads
361are capped with an extra detection byte. Every parsing loop is guarded before
362its bound, including malformed input. No private source is opened in this mode.
363
364Additional child permissions: only read access to counts.snapshot in the existing
365export. No nginx log, resolver, Radicle executable, database, owner profile, key
366or node socket is added. Additional owner-side utility: installed GNU timeout,
367used to bound the collection process. Its version is recorded in evidence. The
368future native Omega supervisor should provide the equivalent process deadline.
369
370R3 private acceptance ran in `../sandbox-evidence/r3/gate/run.IAtnd2` and exited 0.
371Positive HTML and JSON count parity passed for git fetches, upload-pack requests,
372archives, release assets and routing announcements. Exact valid read limits and
373limit-plus-one/far-beyond refusals passed. Every malformed case left the server
374answering requests. Removing the freshness guard caused the stale assertion to
375fail. Fixture addresses and user agents were present in the source log and absent
376from the producer output. The supervisor changed a published count without a child
377restart. R1/r2 isolation, mutations, metadata refresh, repository-set restarts,
378existing-repository push visibility, integrated routes and visits also passed.
379See the r3 READY report for pinned rebuild hashes and real-log collection cost.
380
381The owner collection mode persists read positions even for batches with no counted
382events. This prevents repeated full-log scans across separate collections. The
383unrestricted in-process reader retains its existing journal behavior. A fixture
384asserts cursor advancement, unchanged counts and no write on unchanged recollection.
385
386R4 review fixes. The r3 reader passed 657408, which on aarch64 is O_LARGEFILE,
387not O_NOFOLLOW, so it followed a symlink named counts.snapshot. Its symlink test
388pointed outside the export, so it passed only because the target was not mounted.
389The test now also links to a valid snapshot inside the export. Several refusal
390cases used all-zero rows, which render as unavailable even when accepted. Every
391refusal case now has an accepted twin with positive figures that is shown
392available first. New cases: header version, since or seed time after collection,
393non-alphanumeric RID, 400 lines under the file cap and a well-formed 16385-byte file.
394
395## Clean environment, resource limits, guards and umask (r5)
396
397**Clean environment.** Bubblewrap stays process 1 inside the sandbox, and the child can read
398`/proc/1/environ`. The wrapper therefore starts it as
399`exec env -i /usr/bin/setpriv --no-new-privs /usr/bin/bwrap ...`; setpriv and bwrap read no
400environment variables. The systemd unit `infra/spark/interplane-forged.service` and, without it,
401`forged-service.sh start` (tmux) start the supervisor through `env -i HOME=... PATH=/usr/bin:/bin
402FORGED_...=...`, so the service manager's or tmux server's own environment and the operator's
403shell never reach the supervisor, its children or the sandbox. Gate steps
404`env-clean` and `service-env` plant a canary in the starter; `env-mutant` (the r4 final line)
405and `service-env-old` (the r4 service script) are the controls that must leak it.
406
407**Resource limits.** `/usr/bin/prlimit` runs inside the sandbox, after bubblewrap has created
408the user namespace, and execs forged. RLIMIT_NPROC counts every task of the real user id, and the
409owner runs about 450 processes on the Spark; set before bubblewrap, `--nproc=256` made bwrap fail
410with "Creating new namespace failed: Resource temporarily unavailable". Inside, the namespace
411starts with only bwrap's own tasks, so the limit bounds the sandbox.
412
413| Limit | Value | Measured need | Margin (Wolfram) |
414|---|---|---|---|
415| nproc | 256 | forged is one thread; `git pack-objects` uses about 20 threads; with bwrap and children about 30 tasks | 256/30 = 8.5 |
416| address space | 4 GiB | `git pack-objects` on the largest public repository (159 MB) fails at 1024 MiB ("unable to create thread") and passes at 1280 MiB; live forged VmPeak 56704 kB | 4 GiB / 1280 MiB = 3.2; 4 GiB / 56704 kB = 74 |
417| file size | 1 GiB | dl caps one archive at 512 MiB (536870912 bytes); the largest live data file is a 96.5 MB tar.gz | 1 GiB / 96.5 MB = 11.1 |
418| open files | 1024 | live forged holds 4 descriptors | 1024/4 = 256 |
419| core | 0 | none | |
420
421Wolfram: `{N[4*2^30/(1280*2^20)], N[4*2^30/(56704*1024)], N[2^30/(96.5*10^6)], N[256/30]}`
422-> `{3.2, 73.97, 11.13, 8.53}`.
423
424The service log is not subject to the file-size limit: the supervisor gives the child a pipe and
425an unsandboxed `cat` appends to `forged.log`. The live log is 258819608 bytes and grows about
42694 MB a day; with the file itself as stderr, forged would die with SIGXFSZ after
4272^30 / 94 MB = 11.4 days (Wolfram `N[2^30/(94*10^6)]` -> 11.42). Gate steps `log-fsize` (this
428supervisor keeps serving with a 2 GiB log) and `log-fsize-old` (the r4 supervisor's forged dies
429with exit 153) cover it.
430
431**Growth of FORGE_DATA.** No quota exists. `/` is ext4 without quota options, with 425 GiB free.
432The bounds that do exist: the archive cache is capped at 5 GiB by dl (`dlrunf`), one archive at
433512 MiB, one file at 1 GiB by RLIMIT_FSIZE. The log has no cap: at 94 MB a day, 425 GiB lasts
434about 4855 days (Wolfram `N[425*2^30/(94*10^6)]` -> 4854.7). The collab, search and visits stores
435have no cap of their own; FORGE_DATA totals 537 MB today. A per-directory cap needs either a
436dedicated filesystem (a loop-mounted image of fixed size, root needed) or project quotas; this
437round adds neither.
438
439**Omega gap.** The pinned omc has no setrlimit or prlimit64 host word, so util-linux prlimit
4402.39.3 (sha256 26600e1c720c29d7b7a87eac6beb13f5bc497925349d6c36a5c03751df879fd1) stays a
441recorded host binary. Proposed replacement: a host word `rlimit resource soft hard` (prlimit64 on
442the calling process) used by a seeded-Omega launcher that sets the limits and then `execprog`s
443forged.
444
445**Binary guards.** The wrapper refuses a forged binary that resolves inside the data directory or
446the export directory. The count collector (`counts_bin_ok`, at init and before every collection)
447and the public reader (`public_init`) refuse the same, because both run as the owner, unsandboxed.
448
449**umask.** The wrapper sets `umask 0077`, so every file and directory forged creates in
450FORGE_DATA is owner-only. The mirror (`public_sync`, run by the owner) and the count producer
451(run by the owner) read them as the same user.