aegis-runtime-mv
Native Rust agent runtime: Axum WebSocket/SSE/REST gateway, heartbeat scheduler, dependency-aware task workflow, SQLite storage. Attachment of AienOS. Pre-alpha.
Brought by drakestapleton
aegis-runtime-mv / AUDIT_SCOPE.md
| 1 | # Audit scope |
| 2 | |
| 3 | Written for an outside, independent security audit. Revision described: |
| 4 | `a39788b0eaaabc694dfa17652420e35b7dc3eda5` on `main`, 2026-10-26. Everything below is taken from |
| 5 | the repository's own files at that revision; items marked NOT_RUN were not executed while writing |
| 6 | this document. |
| 7 | |
| 8 | ## What this repository is |
| 9 | |
| 10 | aegis-runtime is an agent runtime in Rust that builds one program, `aegis`. It runs a local |
| 11 | gateway (WebSocket, server-sent events and REST, default port 18096), a heartbeat loop that claims |
| 12 | and runs queued tasks, a dependency-aware task workflow, and SQLite storage in WAL mode. With |
| 13 | `--inference http` it sends model calls to a local OpenAI-compatible server; the default |
| 14 | `--inference embedded` is a mock that loads no model. Status (README): pre-alpha, version 0.2.0, |
| 15 | not part of the WHOLE-SYSTEM-E2E v1 release; the production runtime is aien-sovereign-core. |
| 16 | |
| 17 | ## What to review, in priority order |
| 18 | |
| 19 | 1. `src/auth.rs` and `src/gateway.rs`. Operator token (`AEGIS_OPERATOR_TOKEN` or |
| 20 | `--operator-token-file`, at least 32 printable characters) required on every route except a |
| 21 | short list of read-only `GET` routes; with no token configured, protected routes refuse every |
| 22 | request. Loopback bind by default (`auth::resolve_bind_addr`). Check header parsing, comparison, |
| 23 | the WebSocket path (which can run shell and skills) and the open route list. |
| 24 | 2. `src/skills.rs`, `src/execution/`, `src/policy_guard.rs`, `src/enforcement.rs`. Shell allowlist |
| 25 | (exactly `git status`, `git diff`, `git log -1 --oneline`, `ls`), registered skill names, |
| 26 | probe gating on every call (`AIEN_PROBE_ENFORCE` can only raise the 0.5 threshold), and |
| 27 | `write_file` containment under a held directory descriptor. |
| 28 | 3. `src/vault.rs`. `VaultResolver` asks `atlas-vault`, keeps values in memory, redacts output with |
| 29 | `[REDACTED_BY_ATLAS_VAULT]`, reads the environment only with `AIEN_DEV_SECRET_FALLBACK=1`. |
| 30 | 4. `src/agent.rs`, `src/heartbeat.rs`, `src/orchestration/`. Multi-turn tool calling on model |
| 31 | output; task claiming; failure and retry rules (`docs/FAILURE-PROVENANCE.md`, |
| 32 | `docs/WORKFLOW-DAG.md`, `docs/DELEGATED-DAG.md`); the grant gate for effectful workflow tasks |
| 33 | (`src/orchestration/grant_gate.rs`) and restart recovery (`src/orchestration/recovery.rs`). |
| 34 | 5. `src/persistence/`, `src/sessions/`, `src/events/`, `src/defense/`, `src/security.rs`. |
| 35 | 6. `install.sh`. |
| 36 | 7. `.github/workflows/aien-verification.yml` (advisory checks, Alpha bundle verification, |
| 37 | `contents: read`) and `release.yml` (tag `v*` or manual; publish job has `contents: write`). |
| 38 | 8. `tests/gates/run.sh` and the gate manifests. |
| 39 | |
| 40 | ## Trust boundaries |
| 41 | |
| 42 | - Untrusted: any network client of the gateway; model output driving `aegis agent` tool calls; |
| 43 | task payloads; inference server responses. |
| 44 | - Trusted: the holder of the operator token; `atlas-vault`; the shared protocol crates in the |
| 45 | sibling `aien-protocols` checkout. |
| 46 | - The gateway listens on loopback unless `--bind <ip> --allow-non-loopback-bind` is given. |
| 47 | |
| 48 | ## Threat model summary |
| 49 | |
| 50 | - Assets: the host shell and filesystem reachable through skills and `write_file`; secrets from |
| 51 | `atlas-vault`; task records (which carry command text and output). |
| 52 | - Attackers considered: a local or network client without the token; a prompt-injected model; |
| 53 | a crafted path or symlink in a write request. |
| 54 | - Defended: token on protected routes, loopback default, shell and skill allowlists, probe |
| 55 | gating, descriptor-relative writes, no plaintext secret files, redaction. |
| 56 | - Not defended / explicitly out of scope: containment applies to `write_file`, not to arbitrary |
| 57 | shell commands (README); the mandatory capability checks, approval desk and effect |
| 58 | authorization live in aien-sovereign-core, not here (README). |
| 59 | |
| 60 | ## Build from source at a pin |
| 61 | |
| 62 | No `rust-toolchain.toml`; the README asks for a stable Rust toolchain, edition 2021, so the exact |
| 63 | version is unknown from the repository. `Cargo.toml` has six path dependencies on a sibling |
| 64 | `../aien-protocols` checkout, which is not pinned to a commit by this repository. |
| 65 | |
| 66 | ```sh |
| 67 | git clone https://github.com/aien-dev/aegis-runtime-mv aegis-runtime |
| 68 | git clone https://github.com/aien-dev/aien-protocols-mv aien-protocols |
| 69 | cd aegis-runtime |
| 70 | cargo build --release |
| 71 | ``` |
| 72 | |
| 73 | ## Run every test |
| 74 | |
| 75 | ```sh |
| 76 | cargo test -- --test-threads=1 |
| 77 | ./scripts/agent-preflight.sh |
| 78 | tests/gates/run.sh fmt |
| 79 | tests/gates/run.sh check |
| 80 | tests/gates/run.sh clippy |
| 81 | tests/gates/run.sh test |
| 82 | tests/gates/run.sh zero-disk-secrets |
| 83 | tests/gates/run.sh anti-slop |
| 84 | ``` |
| 85 | |
| 86 | - README: on 2026-10-19 the test suite passed 158 tests on the Spark at commit `08ea496` (55 |
| 87 | library tests plus 103 in `tests/*.rs`). |
| 88 | - `zero-disk-secrets` prints `Zero plaintext .env files verified.` |
| 89 | - The DGX Spark is the test judge (`docs/PIPELINE.md`); GitHub checks are advisory. The signed |
| 90 | Spark run: NOT_RUN here. All commands above: NOT_RUN while writing this document. |
| 91 | |
| 92 | ## Known limitations and NOT_RUN |
| 93 | |
| 94 | - The default inference backend is a mock; `aegis status` output naming "NativeTransformer" refers |
| 95 | to the mock. |
| 96 | - The delegated task workflow work G1 to G6: at `main` `8c961fc44592208f3221342229884022416b1abc` |
| 97 | (2026-10-31) G2 to G6 are merged (#61 to #65), with the design note `docs/DELEGATED-DAG.md`; |
| 98 | G1 (#60) was closed as superseded by #61. |
| 99 | - The sibling `aien-protocols` revision used by a build is whatever is checked out beside it. |
| 100 | |
| 101 | ## Dependencies and provenance |
| 102 | |
| 103 | - `Cargo.lock`; crates.io dependencies including axum, tokio, SQLite bindings and rustls (updated |
| 104 | to 0.23.46 for four advisories, #66). |
| 105 | - Path dependencies on `aien-protocols` (unpinned). |
| 106 | - External services at runtime: `atlas-vault`; optional local model server. |
| 107 | - Licence: see `LICENSE`. |
| 108 | |
| 109 | ## Evidence |
| 110 | |
| 111 | - No `evidence/` directory in this repository. |
| 112 | - Signed Spark bundles: `aien-dev/aien-receipts` at `aegis-runtime/<sha>/bundle.json` (workflow |
| 113 | path). Receipts are append-only and never edited. |