interplane.Get Omega
Read in your language

synapse

A component of the AienOS ecosystem.

Brought by drakestapleton

branch main Branches Tags History

synapse / AUDIT_SCOPE.md

131 lines · 7075 bytes Raw Blame History Rendered
1# Audit scope
2
3Written for an outside, independent security audit. Revision described:
4`5f9a638d6be5c271748dc740f69159422788ca81` on `main`, 2026-10-30. Everything below is taken from
5the repository's own files at that revision; items marked NOT_RUN were not executed while writing
6this document.
7
8## What this repository is
9
10Synapse is source control for AI agents. Agents submit signed changesets, inspect virtual trees and
11diffs without a working-tree checkout, attach evidence and queue integration. Accepted changesets
12materialize deterministically into standard Git objects; GitHub pull requests are only a human
13projection; canonical promotion needs a verified Radicle delegate quorum. One Rust Cargo workspace
14under `crates/`: `synapse-core`, `-store`, `-auth`, `-api`, `-git`, `-radicle`, `-bench`,
15`-crumb`, `-coord`, `-evidence`, `-wire`. The library crates read no configuration files.
16
17## What to review, in priority order
18
191. `crates/synapse-auth`: `did:key` Ed25519 extraction and signature verification, capability
20 grants (`Read`, `Propose`, `Evaluate`, `Review`, `Publish`), expiry, replay nonces, quotas,
21 self-review refusal, `PolicyEnforcer::authorize` and `authorize_chain`, the audit log.
222. `crates/synapse-radicle`: delegate threshold verification over `refs/rad/id` and
23 `refs/namespaces/<nid>/refs/rad/sigrefs`; split-brain refusal.
243. `crates/synapse-wire`: frame decoding (`docs/G1_WIRE_FRAMES.md`), the stream transport (any
25 ordered byte stream, including `UnixStream` and `TcpStream`), the shared-memory ring
26 (`docs/G3_SHM_RING.md`), connection closing after 64 refusals.
274. `crates/synapse-store`: SWAL v1 parsing and recovery, blob store, compaction and GC, torn write
28 handling; malformed corpus tests; the R1 raw block store repair after `CheckpointCorrupt`
29 (`src/blockdev/repair.rs`, `docs/R1_RAW_BLOCK_STORE.md`), which writes to the device; the G2
30 content-defined chunking and WAL v2 path (`src/chunk.rs`, `src/wal2.rs`, `src/segment.rs`,
31 `docs/G2_CONTENT_DEFINED_CHUNKING.md`), which parses committed v2 checkpoints and logs.
325. `crates/synapse-api`: bounds, pagination, cross-repository lookups; the M1 admission secret
33 scanner (`src/secret_scan.rs`: hand-written single pass, refuse by default, no allowlist).
34 With `crates/synapse-core/src/merge.rs` and both `derivation.rs` files: merge tier T1, which
35 combines changes to different parts of one file (`docs/D1_MERGE_TIER_T1.md`).
366. `crates/synapse-git`: loose object writer and reader, `ChangesetId <-> GitOid` map, ref
37 namespaces, GitHub pull request projection.
387. `crates/synapse-coord` (Unix datagram socket notifications in `src/board/notify.rs`) and
39 `crates/synapse-evidence`.
408. `tests/gates/run.sh`, `scripts/ci/portable.sh`, `.aien/always`, `.aien/unmapped-ok`,
41 `.aien/verify.pub`.
429. `.github/workflows/aien-verification.yml`: pull request and push, `contents: read`, advisory;
43 nothing on GitHub builds this repository's code (AGENTS.md).
44
45AGENTS.md: a change to `.aien/`, `tests/gates/`, `.github/workflows/` or `.forgejo/` is
46`BLOCKED_OPERATOR` and runs only when the operator starts it by hand.
47
48## Trust boundaries
49
50From `docs/THREAT_MODEL.md`:
51
52- Agent clients are untrusted until authenticated by an Ed25519 signature and authorized by an
53 unexpired, repository-scoped `AgentCapabilityGrant`.
54- Disk files and incoming payloads are treated as possibly corrupted or adversarial; digests and
55 WAL chain links are recomputed on ingest and recovery.
56- GitHub pull requests are human projections, never proof of canonical promotion.
57- Only a `RadicleCanonicalHead` backed by a verified identity document and a threshold of delegate
58 signatures marks a lineage canonical.
59- CI: the DGX Spark is the test judge, running `tests/gates/run.sh`; GitHub checks are advisory
60 (AGENTS.md, `docs/PIPELINE.md`).
61
62## Threat model summary
63
64- Assets: canonical branch authority, changeset and blob integrity, capability grants, the audit
65 log.
66- Attackers considered (T1 to T6): forged agent identity; cross-repository token or object reuse;
67 expired or replayed mutations; memory or disk exhaustion; split-brain canonical spoofing; crash
68 or torn write corruption.
69- Defended: each threat above with a deterministic `RefusalCode`; fail closed on unknown versions,
70 malformed input and conflicting `IdempotencyKey`.
71- Not defended: the audit log is in memory, not independently signed or persisted; at 4,096
72 entries authorization refuses until an operator export or restart (backpressure, not drain).
73- Explicitly out of scope: the security of Git, Radicle and GitHub.
74
75## Build from source at a pin
76
77Rust toolchain (the gates record Rust 1.98.1; there is no `rust-toolchain.toml`), `git`, and `cc`
78for the crumb qualification scripts. `Cargo.lock` is committed.
79
80```sh
81git clone https://github.com/aien-dev/synapse.git
82cd synapse
83git checkout 5f9a638d6be5c271748dc740f69159422788ca81
84cargo build --locked --workspace
85```
86
87## Run every test
88
89```sh
90bash scripts/ci/portable.sh workspace
91cargo fmt --all --check
92cargo clippy --locked --workspace --all-targets -- -D warnings
93cargo test --locked --workspace
94tests/gates/run.sh zero-disk-secrets
95tests/gates/run.sh workspace
96tests/gates/run.sh conformance
97```
98
99- `conformance` needs a sibling `../aien-architecture`; it checks out
100 `29780e56c9e6b9111d884e0d4b146737228c19f6`. The `crumb-verify` step and its CRUMB-VERIFY gate are
101 retired (DRA-97, 2026-11-07); `crumb.lock` still names `12ad0141b41ec67ef5aa51cb4e1815894c1083bb`.
102- `.aien/always`: `SYNAPSE-ZERO-DISK-SECRETS`. Expected line from the secrets
103 gate: `Zero plaintext .env files verified.`
104- `scripts/run_gate4_qualification.sh` (comparative benchmark) needs a fixture repository and
105 writes `evidence/gate4-qualification/`; `SMOKE=1` runs a small check.
106- All commands above: NOT_RUN while writing this document.
107
108## Known limitations and NOT_RUN
109
110- No toolchain pin; the recorded Rust version is 1.98.1.
111- The audit log is in memory only (above).
112- Published performance numbers come from runs on the DGX Spark, not from other machines.
113- Fuzzing: `crates/synapse-wire/src/fuzz.rs` exists; whether a fuzzing campaign has been run is
114 unknown from the repository.
115
116## Dependencies and provenance
117
118- Crates.io dependencies locked in `Cargo.lock` (57 packages).
119- Sibling aien-architecture at the two commits above for the crumb gates.
120- Licence: Apache-2.0 (`LICENSE`).
121
122## Evidence
123
124- `evidence/<item>/`, 27 items, treated as immutable; a new run writes new evidence. 17 carry a
125 top-level `SHA256SUMS` (for example `gate0-baseline`, `gate4-qualification`,
126 `f1-capability-chains`, `j3-crypto-vectors`, `d1-merge-tier-t1`); 10 do not:
127 `REPAIR-RECOVERY-L662`, `a1-binary-codec`, `a2-segment-store`, `bench-pmu-diagnostics`,
128 `g1-wire-frames`, `g2-content-defined-chunking` (one only under `x6/`), `g3-shm-ring`,
129 `j1-codec-corpus`, `r1-raw-block-store`, `swarm-board`.
130- Signed Spark bundles: `aien-dev/aien-receipts` at `synapse/<sha>/bundle.json` (workflow path).
131 Receipts are append-only and never edited.