Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/spark-rsi-mv/blob/main/AUDIT_SCOPE.md # spark-rsi-mv Native Rust recursive self-improvement engine with paired bootstrap evaluation and cryptographic ledger Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `spark-rsi-mv / AUDIT_SCOPE.md` 125 lines ยท 7004 bytes Raw Blame History Rendered 1 # Audit scope 2 3 Written for an outside, independent security audit. Revision described: 4 ``fc13d3f77e6cfec789fce1b0e15125df8feac3d8`` on `main`, 2026-10-26. Everything below is taken from the repository's own files at 5 that revision; items marked NOT_RUN were not executed while writing this document. 6 7 ## What this repository is 8 9 A Rust crate `spark-rsi` 0.1.0 (AGPL-3.0-or-later) that runs a five-phase cycle against a target 10 repository: observe, propose (model proposals applied in a sandbox copy), verify (unslop check, 11 secret refusal, `cargo check`, `cargo test`), balance (`src/balance.rs`), ratify (review branch 12 `rsi/` plus a patch; a human merges). Binaries: `spark-rsi` (`src/main.rs`), 13 `spark-rsi-supervisor` (`src/bin/supervisor.rs`) and `spark-rsi-judge` (`src/actor/judge.rs`). It depends on 14 `aien-protocols-mv` crates by path, so it is not a standalone checkout. 15 16 ## What to review, in priority order 17 18 1. `src/isolation/cargo_sandbox.rs`, `src/isolation/container.rs`, `src/isolation/rollback.rs`: 19 the bubblewrap build jail, environment clearing, toolchain binding (`CARGO_HOME`, `RUSTUP_HOME` 20 and the `PATH` directory are bound read-only; a directory that is or holds the judge's home is 21 never exposed, per README), and the cgroup limits. `rollback.rs` holds 12 `Command::new` calls. 22 2. `src/supervisor/` (`canary_exec.rs`, `daemon.rs`, `ipc.rs`) and `src/canary/`: canary worker 23 namespaces, the one IPC socket, the worker environment allowlist, and how supervisor evidence 24 stays outside the jail. Contract: `docs/CANARY-CONTRACT.md`. 25 3. `src/ratify.rs` and `src/diff_gate.rs`: protected-file checks on the real git diff. 26 4. `src/promotion_gate.rs`, `src/actor/judge.rs`, `src/verifier.rs`: version 2 receipts 27 (`docs/RECEIPT-V2.md`), judge policy and public key pins (`--judge-policy-file`, 28 `--judge-public-key` and the `RSI_JUDGE_*` environment variables); malformed pins are meant to be 29 refused at startup. 30 5. `src/ledger/` (`merkle.rs`, `db.rs`, `record.rs`): the improvement ledger and its signing keys 31 (README: kept off the command line). 32 6. `src/propose/` (`model_seat.rs`, `cortex.rs`): model replies are untrusted input that becomes 33 a candidate patch. 34 7. `src/observe.rs`, `src/measure/profile.rs`, `src/propose/kernel_autotune.rs`, 35 `src/soak/runner.rs`: other process launches. 36 37 ## Trust boundaries 38 39 - Untrusted: model output and every candidate patch, candidate build scripts and tests, canary 40 worker output. 41 - Trusted: the supervisor and judge binaries, the judge policy file and public key, the ledger 42 signing key, the host toolchain, bubblewrap and systemd. 43 - The promotion gate trusts only a receipt from a separate judge (README, `docs/RECEIPT-V2.md`). 44 - Defaults in `src/main.rs` point at loopback model and memory services on the reference host. 45 46 ## Threat model summary 47 48 - Assets: the target repository's default branch, the host outside the jail, judge keys, 49 ledger integrity, the honesty of evaluation receipts. 50 - Attackers considered: a hostile or wrong candidate patch, including one whose build script or 51 tests try to read host files, inherit the service environment, write outside its output, or 52 reach the network. 53 - Defended: bubblewrap jail with cleared environment and no network, cgroup limits, canary 54 namespaces, branch-only ratification, separate judge receipts, `.env` refusal gate. 55 - Not defended / explicitly out of scope: kernel or bubblewrap escapes; a compromised judge key; 56 hosts where unprivileged user namespaces are restricted (the gate only observes AppArmor and 57 setuid settings, it does not change them). 58 59 ## Build from source at a pin 60 61 Needs Rust/Cargo, bubblewrap, and `aien-protocols-mv` cloned next to this repository as 62 `aien-protocols`. README asks for the sibling at ``28bc49ec57a89398fcb463cf71c0add7fcd2ef6c`` 63 until aien-protocols-mv#59 merges; #59 merged as ``f3785177fcaaab7c0f2ce1126616e9fecb4e47b4``, so 64 the default branch of aien-protocols-mv carries it. `Cargo.lock` committed (265 packages). 65 66 ```sh 67 git clone https://github.com/aien-dev/spark-rsi-mv spark-rsi 68 git clone https://github.com/aien-dev/aien-protocols-mv aien-protocols 69 cd spark-rsi 70 cargo build --locked 71 ``` 72 73 ## Run every test 74 75 NOT_RUN while writing this document. From README and `tests/gates/run.sh`: 76 77 ```sh 78 cargo test --locked -- --test-threads=1 79 tests/gates/run.sh zero-disk-secrets 80 tests/gates/run.sh fmt 81 tests/gates/run.sh check # cargo check --offline --locked -j2 --all-targets 82 tests/gates/run.sh test # release build, then cargo test --offline --locked 83 sh scripts/check-no-python.sh 84 ``` 85 86 The tree has 21 top-level test files under `tests/` and 340 `#[test]` or `#[tokio::test]` attributes in 87 `src/` and `tests/`. The jail tests need bubblewrap and a systemd user manager with cgroup v2. 88 89 ## Known limitations and NOT_RUN 90 91 - README: pre-alpha, not part of the WHOLE-SYSTEM-E2E v1 release; no unattended 92 self-modification and no automatic promotion. 93 - `evidence/rsi-cut-2026-10-12/REPORT.md` qualifies the canary mechanism only, not 94 self-improvement (README). 95 - Open issues named in README: #54 (qualify one independent version 2 evaluation and review 96 branch cycle) and #57. 97 - Receipts and plan digests produced before the aien-protocols#59 cutover do not verify (README). 98 - The tracked workflow's header comment says nothing on GitHub gates a merge, while README calls 99 `AIEN Verification` the one required check. Branch protection is not visible from the 100 repository. 101 102 ## Dependencies and provenance 103 104 - `Cargo.toml` lists 22 direct dependencies, including clap, tokio, reqwest 0.12, sha2, uuid, 105 libc, and the path crates `spark-crumbs` and `crumb-spec`. README: rustls moved to 0.23.46 for 106 four security advisories (#60). 107 - The tracked workflow `.github/workflows/aien-verification.yml` builds only pinned verifier 108 tools: `aien-test` from `aien-spark/aien-sovereign-core` at 109 ``a51042b61b87355c0850ef82ba409a46e153a1ff`` (the crumb tool build and `crumb verify` step were 110 removed when Crumbs were retired, DRA-97, 2026-11-07). On `main` the actions are referenced by tag 111 (`@v4`, `@stable`); the separate workflow commit of this change pins each one by commit sha and 112 adds `.github/workflows/sbom.yml`. 113 - AGENTS.md asks for `cargo audit`; no audit output is committed. 114 115 ## Evidence 116 117 - `evidence/security-`20261026`-before.log`: security regression tests failing on the earlier 118 `main` ``f72209e6`` (for example "environment crossed build boundary", "candidate test wrote a 119 host-only file"). 120 - `evidence/security-`20261026`-after.log`: the same suite after the fix, 33 passed, 0 failed. 121 - `evidence/security-`20261026`-s3.json` and `-fixture-compile.log`: workflow before, after and 122 negative cases. 123 - `evidence/rsi-cut-2026-10-12/`: two real cycles against the fixture target, with raw files. 124 - `evidence/protocol-receipt-v1-superseded-2026-10-26/`: superseded receipt pins, kept unedited. 125 - Signed Spark bundles are published in aien-dev/aien-receipts, not here.