interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / docs / SALVAGE.md

148 lines · 14607 bytes Raw Blame History Source

Interplane salvage release candidate

This candidate turns the welcome page into a bounded, working journey: a builder signs in with a Radicle key, shares unfinished source, derives a native Omega part, verifies a declared example, explicitly publishes it, and downloads a reproduction bundle. It is isolated from the live Interplane service.

Supported public surface

Intake is UTF-8 text, at most 16 KiB per source, with explicit original source, attribution, description and one of four supported permissive licenses. The author affirms permission; the hub does not establish legal ownership. CRLF and CR form newlines become LF before hashing. The existing HTTP layer also caps the complete encoded request body at 64 KiB. No URL is fetched. No archive is unpacked. Source is inert until a builder explicitly derives and verifies a self-contained Omega program.

Parts have one declared stdin/expected-stdout example, at most 4 KiB each. Repair is human-assisted. Model-assisted conversion, arbitrary project builds, weights, hardware orchestration and universal correctness are outside this release. Existing model/agent/system repositories remain linked from the hub. The existing aien-train weight-patching tool is not duplicated.

Implementation and trust boundary

All new application behavior, storage, collector, replay and behavioral tests are native .om. HTML/CSS are emitted presentation data. The existing run.sh build glue composes the modules and invokes native tests; it is not a replacement runtime. The explicitly requested formal predicate proof is Lean 4.

The application requires the existing seeded compiler pin:

The compiler was independently rebuilt through seed/omega-from-seed.sh. The rebuilt and pinned compilers produce identical application bytes for identical composed source. This is a reproducibility check, not a formal proof of the entire compiler.

The collector copies and hashes the compiler into private scratch space. It compiles in an empty bwrap --unshare-all namespace with only the pinned compiler mounted read-only. prlimit bounds address space, CPU and file output. The completed compiler output is copied into a separate sealed inode before execution, because Linux was observed refusing the original output with ETXTBSY, meaning an outstanding writer still held that inode. The exact natural writer was not identified; the new inode removes that lifetime dependency. A native held-writer control reproduces ETXTBSY on the original output and verifies the separate inode executes while that writer remains open. Generated programs run exclusively through Omega's existing execpure: Landlock ABI 3, seccomp, strict stdio, no network/files/process creation, fixed resource limits. Missing isolation refuses verification; there is no weaker fallback. External Linux isolation tools remain dependencies.

Each compile and execution has a three-second wall deadline, plus bounded kill/reap handling. The run must exit zero and produce exactly the declared bytes. The negative control changes the expected bytes and must be rejected by the same comparator. This is a comparator negative control, not a second proof of arbitrary program behavior. The sandbox tests separately exercise wrong output, invalid source, denied file access, CPU exhaustion and a nonzero exit.

One collector holds an independent kernel lock through verification, receipt creation and cleanup. A new server instance cannot run a conflicting collector while an old one survives. There are no cron jobs, timers for work discovery, directory scans or background model calls. A verification POST starts the bounded child directly. If the server stops before accepting a job, the saved draft can be retried.

The root must be a private 0700 directory at an absolute configured path ending in slash. Files are 0600, final path opens refuse symlinks, writes loop for partial output, fsync precedes atomic rename, and affected directories are synced. An exclusive writer lock prevents multiple web processes sharing a store. Startup rebuilds owner quotas from hash-checked indexed records. A corrupt record, missing key in a nonempty store, or failed required initialization disables the store.

There are at most 4096 immutable records and 64 per DID, including drafts and withdrawals. Per-IP and per-DID request limits use the existing forge gate; salvage charges its own accepted write attempts to the DID counter. The short-window counter is process state, while the per-author storage allocation survives restart. This is a small public release, not an unbounded storage service. A hostile population with many identities can still consume the total allocation. Operators must monitor capacity and moderate public submissions.

Trusted boundaries remain the host operator, kernel, pinned compiler and signed-session authentication. The implementation does not defend against the host owner modifying code or keys.

Record and receipt format

record.ip is exactly:

  1. ASCII IPSLV001 (8 bytes).
  2. Kind byte (1 source, 2 part), then seven zero bytes.
  3. Twelve unsigned 32-bit little-endian field lengths.
  4. The twelve field payloads, in order, with no trailing data.

Fields: author DID, title, original source, license, description, source bytes, parent source ID, stdin, expected stdout, attribution, language, schema marker. The record's SHA-256 is its revision ID. It binds both the program and its declared example.

The collector receipt is 353 bytes: record ID (64 lowercase hex), result byte (1 pass, 2 refusal), binary SHA-256 (64), stdout SHA-256 (64), compiler SHA-256 (64), policy SHA-256 (64), then HMAC-SHA256 over the first 321 bytes. For refusal receipts, bytes 65..67 carry phase, exit status and signal status; artifact hash slots otherwise remain zero. Publication accepts only an authenticated passing receipt for the exact record and current compiler/policy.

The HMAC authenticates the collector to this hub. It is not a publicly verifiable digital signature. Public verification is independent replay, including comparison of the rebuilt binary and output hashes. A receipt by itself proves neither authorship nor safety.

state/<ID> contains ID (64), action (1 published, 2 withdrawn), then HMAC-SHA256 (32). A missing state is private; a malformed state is refused.

Reproduce without trusting the hub

Use Linux AArch64 with the compiler pin above, bwrap, prlimit, Landlock ABI 3 and seccomp. Acquire and verify the pinned Omega source through the existing harness/seed workflow. In this checkout:

OMV="$HOME/work/flux/omega-mv"
{ printf 'om2\n'; cat "$OMV/om/tls/sha2.om" salvage/00core.om salvage/10verify.om salvage/replay.om; } > /tmp/interplane-replay.om
"$OMV/seed/out/omc" < /tmp/interplane-replay.om > /tmp/interplane-replay
chmod 700 /tmp/interplane-replay
scratch=$(mktemp -d /tmp/interplane-replay.XXXXXX)
OMEGA_COMPILER="$OMV/seed/out/omc" /tmp/interplane-replay /absolute/path/record.ip EXPECTED_RECORD_SHA256 "$scratch/" /absolute/path/receipt.ip

Obtain EXPECTED_RECORD_SHA256 independently from the revision you intend to reproduce, rather than trusting an unverified bundle's label. The compiler location is supplied privately through OMEGA_COMPILER, an absolute path to the actual verified file. The application, tests and replay retain the same mandatory compiler hash; an absent, symlinked or wrong compiler is refused.

The deterministic tar contains only fixed regular filenames: record.ip, receipt.ip, source.om, stdin, expected, README.txt. No executable flags, links or paths are emitted. docs/salvage/example.tar is the synthetic public test bundle.

The replay tool checks the record ID and receipt policy/compiler/record fields, recompiles in the sandbox, replays the example, checks the negative control, and compares the rebuilt binary/output hashes. A modified record or binary digest is refused. Replay does not know or need the hub's HMAC secret.

Verification and operational boundary

Run the targeted native checks on the runner or Spark, not a heavy suite on the interactive Mac:

FORGED_CPUS=6 ./run.sh check-salvage
lean docs/salvage/Visibility.lean

The checks cover immutable records and tampering, durable owner quotas, writer exclusion, sandbox refusal paths, real asynchronous collection, draft/public ownership, withdrawal, malformed form escapes, the visibility truth table, and existing Observatory routes.

Visibility.lean proves four properties of the exact three-Boolean publication predicate: a public part requires a passing receipt; withdrawing the parent hides a part; a draft is not public; all requirements suffice. Lean 4.35.0 reports no axioms for these theorems. This is a predicate proof, not end-to-end formal verification. Native tests exercise all eight truth assignments and the real route transitions.

The isolated browser/HTTP qualification uses disposable signed identities. See EVIDENCE.md for hashes, replay results and scope. Test keys, cookies, collector keys and private host data are not in the repository.

The candidate is opt-in through INTERPLANE_SALVAGE_DIR, with OMEGA_COMPILER required for verification. Without it, salvage routes return 503 with an explicit configuration message. Configure a dedicated private store only for the intended candidate instance. Do not point the isolated candidate at live social or salvage data.

Production deployment, DNS, proxy settings, service restarts and migrations are not performed by this source release. Keep the existing HTTPS and trusted-proxy boundary: the server listens on loopback, authentication cookies are Secure/HttpOnly, and POST Origin is checked against the configured public origins. The development browser fixture changes the allowed origin only in its disposable composed source.

Running it beside the sandboxed server

The live forged runs in a namespace with no network, no compiler, no bwrap and nested namespaces disabled (infra/spark/forged-sandbox.sh). A verifier inside that process could never compile or run a submission, so verification is its own program:

PartWhere it runsWhat it does
forged, salvage/ sliceinside the forged sandboxpages, sign-in checks, drafts, records, publication state; on "verify" it creates the one job file <store>job holding the record id
salvage/collector.om (./run.sh collector)its own service, outside that sandboxpolls the job file about three times a second, verifies in its own empty namespace with the pinned compiler, writes <store>receipts/<id>, removes the job

They share only the store. One job at a time: while the job file exists, another "verify" answers 503 "The verifier is busy". If the collector is not running the job stays queued and the page keeps saying that verification is in progress; nothing is published without a receipt.

The collector's scratch folder (INTERPLANE_SALVAGE_WORK) must be outside the store, and the program refuses to start otherwise. The sandboxed server can write everything in the store, and scratch files are compiled and executed, so a scratch folder in the store would let a compromised server swap a file between its check and its use. The collector treats the store as input from a less trusted process: fixed names, the job must be a record id, the record must hash to that id, every read is bounded and refuses a symlink as the file. Known limit: the server holds the receipt key (it checks receipts with it), so a compromised server could write a passing receipt itself. That was already true when the verifier was a child of the server. Outside verification stays independent replay, as above. The store's folders themselves are not re-checked for symlinks on every pass; the worst a swapped folder gives is a 353-byte receipt file, named by a record id, written to another folder of the owner.

Install on the Spark (after review; nothing here is done by the source release):

C=$(git rev-parse --short=8 HEAD); D=$HOME/.local/lib/interplane-salvage/$C
mkdir -p "$D" "$HOME/forge-salvage-work" && chmod 700 "$HOME/forge-salvage-work"
COLLECTOR_OUT="$D/salvage-collector" ./run.sh collector
cp "$HOME/work/flux/omega-mv/seed/out/omc" "$D/omc"      # the collector refuses any digest but the pin
ln -sfn "$D" "$HOME/.local/lib/interplane-salvage/current"
cp infra/spark/interplane-salvage.service ~/.config/systemd/user/
systemctl --user daemon-reload && systemctl --user enable --now interplane-salvage.service
# then switch the server on: add FORGED_SALVAGE=on to the env list of interplane-forged.service
# (ExecStart) and restart it. The server creates <data>/salvage/ (0700) and its key on first use.

Check: curl -s -o /dev/null -w '%{http_code}\n' https://interplane.io/salvage/ answers 200 (503 "not configured" while the switch is off, 404 on a build without the slice). Undo: remove FORGED_SALVAGE=on and restart forged; `systemctl --user disable --now interplane-salvage.service`. The store stays where it is; nothing is deleted.

Gate: ./run.sh check-salvage ends with SALVAGE_COLLECTOR PASS 10. It runs the collector program against the store the journey test left: no store, no scratch folder, a scratch folder inside the store (refused), a store without a key (waits, creates none), nothing queued, a damaged job file (removed), a wrong compiler (refusal receipt, never a pass), a queued job (receipt, job removed), and the scratch folder left empty.