interplane.Get Omega
Read in your language

omnet

aien-dev/omnet

Brought by drakestapleton

branch main Branches Tags History

omnet / AUDIT_SCOPE.md

169 lines · 10400 bytes Raw Blame History Rendered
1# Audit scope
2
3Written for an outside, independent security audit. Revision described:
4`83f605b147205bd912b085afdcf24402df24b5e5` on `main`, 2026-10-26. 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
10omnet rewrites security-critical network code in Omega (`.om`), a language from
11`aien-dev/omega-mv` whose compiler emits AArch64 Linux programs. The first project is the
12server side of Tailscale Tailnet Lock (TKA) for self-hosted Headscale control servers. All TKA
13logic, cryptography, parsing and durable state ship as Omega: the `om/` libraries and the `tkad`
14daemon in `cmd/tkad/`. The Headscale adapter is a Go patch (`integration/headscale/`) that the
15README describes as transport and authentication glue. Go and Python under `test/` directories
16and `integration/e2e/` are test oracles and drivers and never ship. Status per README and
17`docs/design/tailnet-lock.md`: implemented and verified in isolation; not deployed, not
18production-qualified, not a production security audit.
19
20## What to review, in priority order
21
221. `cmd/tkad/socket.om`, `cmd/tkad/rpc.om`, `cmd/tkad/adapter.om`, `cmd/tkad/main.om`. The
23 AF_UNIX IPC service: a 20-byte request header, a JSON body of 0..65536 bytes, 3-second
24 per-phase deadlines, the admin assertion byte (exactly 0 or 1) and the NodeID. Check that
25 bad or oversized headers close without a reply, that every RPC binds JSON `NodeKey` to the
26 registered key of the header NodeID, that RPCs 1, 2 and 6 and registry/map commands require
27 admin, and that error bodies never echo request details or secrets.
282. `om/tka/tka.om`, `om/tka/tkastate.om`, `om/tka/tkapool.om`, `om/tkasig/tkasig.om`. The
29 authority chain and node-key signature checks. Check fail-closed behaviour (design rule 3):
30 parse and signature failures reject; unknown signed AUM kinds advance the hash chain as
31 no-ops and never bypass authorization.
323. `om/ed25519/`, `om/sha512/`, `om/blake2s/`, `om/blake2b/`, `om/argon2/` (with
33 `argon2pool.om`). Signature verification and hashing used for authority and the disablement
34 secret. Check correctness against the committed vectors and the bounds on inputs. No
35 constant-time claim is made.
364. `om/cbor/`, `om/codec/`, `om/json/`. Parsers of attacker-controlled bytes (CBOR AUMs and
37 signatures, base64/hex, JSON RPC bodies). Check that every read has a capacity and that
38 size limits are checked before parsing (design rule 1).
395. `om/store/store.om`, `om/store/storepool.om`, `cmd/tkad/state.om`. Durable snapshots,
40 record framing and capacity charges (65536 records, 33554432 bytes). Check descriptor-based
41 operation (design rule 2), recovery refusing missing or corrupt snapshots, and the
42 charges described in `qualification/security3-store/README.md`.
436. `om/quantity/quantity.om`. Checked arithmetic used by the store charges.
447. `integration/headscale/headscale.patch`. Go glue added to Headscale v0.29.6: Noise identity
45 resolution, the admin user ID setting, reconciliation, SQL migrations, publication barrier,
46 bounded admission slots. Check that a caller's identity is resolved before daemon work, that
47 startup refuses when adapter state exists but settings are missing, and that pending
48 signatures are never treated as trusted map signatures.
498. `tools/omc.sh`, `tools/build-tkad.sh`, `integration/headscale/build.sh`. Supply chain: the
50 compiler is cloned from GitHub at the pinned commit, built by its seed chain and checked
51 against the pinned digest; the Headscale build verifies the pinned commit.
529. Test suite integrity: `tools/test.sh`, `om/*/test/run.sh`, `cmd/tkad/test/run.sh`,
53 `cmd/tkad/test/mutant.py`. AGENTS.md requires a mutant check per unit that counts only when
54 the driver completes and a result differs.
55
56`.github/workflows/ci.yml` (added by the audit-readiness change) builds the pinned omc through
57`tools/omc.sh` and runs `sh tools/test.sh` on a GitHub-hosted arm64 runner with Go installed for
58the oracles; a second job publishes an SPDX SBOM artifact. Every action is pinned by commit sha
59and the token is read-only.
60
61## Trust boundaries
62
63- Untrusted input: TKA RPC JSON bodies from Tailscale clients (relayed by the adapter), CBOR
64 AUMs and node-key signatures inside them, Noise clients reaching Headscale, and on-disk
65 snapshots at recovery time (validated, not trusted).
66- Trusted: the local adapter. `cmd/tkad/README.md` states the 0700 directory and 0600 socket
67 give a same-UID/root boundary only; there is no SO_PEERCRED check, and same-UID or root
68 processes can act as the adapter, read secrets and change storage. The adapter must derive
69 NodeIDs and admin assertions from its own identity model, never from remote JSON.
70- Trusted: the Omega compiler at the commit and digest in `omega.pin`; the Headscale commit in
71 `integration/headscale/headscale.pin`.
72- Isolated: the end-to-end test runs in a new network/PID namespace with loopback and a
73 dummy link, no egress, and drops privileges before starting daemons (`integration/e2e/run.sh`).
74
75## Threat model summary
76
77- Assets: the tailnet authority (trusted keys), accepted node-key signatures, the disablement
78 secret, durable snapshot integrity, and the availability of map publication.
79- Attackers considered: a remote Tailscale client or Noise peer sending malformed or hostile
80 RPCs, CBOR or signatures; an ordinary registered client trying to forge or pad signatures; a
81 non-owner trying to disable TKA; crashes, short writes and ENOSPC during storage.
82- Defended: memory-safety bug classes are runtime traps in Omega (README table); bounded input
83 sizes; fail-closed parsing and signature checks; canonical storage of accepted signatures
84 with a 413 refusal when the registry would not fit a map response; 401 before daemon work for
85 unknown identities; 503 instead of queueing under saturation.
86- Not defended / explicitly out of scope: timing side channels ("not constant-time-audited");
87 same-UID or root attackers; logic and protocol errors beyond tests and review; service-level
88 resource exhaustion (reduced, not eliminated); a reachable trap is still denial of service;
89 the durable revision floor is not authenticated rollback protection; power-loss durability,
90 cross-namespace writer exclusion and packet delivery are not established.
91
92## Build from source at a pin
93
94Requirements from README: Linux on ARM64, `git`, POSIX `sh`, Python 3, and Go >= 1.26.5 for the
95TKA differential oracle. The Headscale adapter build uses go1.27.3.
96
97Compiler pin, from `omega.pin`:
98
99- omega-mv commit `acb3f15cdc691b1b046b48b0dad0f9255a12ba4b`
100- omc sha256 `734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61`
101
102`tools/omc.sh` clones `https://github.com/aien-dev/omega-mv.git` into `build/omega-mv`, checks
103out the pinned commit, runs `seed/omega-from-seed.sh`, and exits non-zero if the result's
104sha256 differs from the pin. It checks the pin, not `seed/out/omc.sha256`.
105
106```sh
107tools/omc.sh # prints the path of a verified omc
108sh tools/build-tkad.sh # builds build/tkad from the om/ and cmd/tkad/ sources
109GO=/path/to/go sh integration/headscale/build.sh # optional adapter, output build/headscale
110```
111
112The Omega build needs an AArch64 Linux host. The Headscale and client builds need network access
113to GitHub and the Go module proxy.
114
115## Run every test
116
117```sh
118tools/test.sh
119GO=/path/to/go GOTOOLCHAIN=auto sh integration/e2e/build-clients.sh
120GO=/path/to/go GOTOOLCHAIN=auto sh integration/headscale/build.sh
121sh tools/build-tkad.sh
122sh integration/e2e/run.sh
123```
124
125- `tools/test.sh` runs every `om/*/test/run.sh` and `cmd/*/test/run.sh` with the pinned
126 compiler and prints `PASS <unit>` or `FAIL <unit>` per suite; exit 0 only if all pass.
127 `docs/design/tailnet-lock.md` records twelve suites passing at stage six. NOT_RUN here.
128- `integration/e2e/run.sh` needs unprivileged user and network namespaces, `unshare`, `ip` and
129 `python3`; otherwise it prints `NOT_RUN` and exits 77. `--sudo-netns` uses `sudo -n` to create
130 the namespace and drops privileges before any daemon starts. The design document records 13
131 PASS records. NOT_RUN here.
132- Foreign-UID ownership fixtures in the store suite need root and were skipped in the recorded
133 stage-four run.
134
135## Known limitations and NOT_RUN
136
137- Profile limits: one tailnet, 64 nodes, 128 authority updates, 64-KiB JSON messages. Large
138 checkpoints and long histories can exceed this profile.
139- The daemon does not authenticate remote Tailscale clients; the adapter does, and shares the
140 daemon UID.
141- One committed node without an NLKey blocks publication for the whole tailnet; SQLite cannot be
142 downgraded in place; disablement is permanent for that database
143 (`docs/design/tailnet-lock.md`, stage six).
144- No constant-time claim; no claim of absence of vulnerabilities.
145- All recorded verification is host and isolated-namespace evidence. No deployment, data-plane
146 or power-loss testing.
147- `qualification/security3-store/README.md` notes that absence of migration to checked
148 quantities is not evidence of a bug in modules it did not touch.
149
150## Dependencies and provenance
151
152- No lockfile at the repository root. Go oracles carry their own `go.mod`/`go.sum` under
153 `om/*/test/gen/oracle/`, `om/json/test/oracle/` and `om/codec/test/gen/tsoracle/`.
154- Committed test vectors carry upstream notices next to them (RFC 7693, 8032, 8949, 9106,
155 4648; Wycheproof, ZIP-215, BLAKE2 KAT licences). Tailscale and Headscale licences ship
156 beside derived material (`om/tka/tailscale.LICENSE`, `integration/headscale/*.LICENSE`).
157- Oracles in Go and Python do not ship.
158- External services at build/test time: GitHub (omega-mv clone in `tools/omc.sh`; Headscale
159 and Tailscale clones) and the Go module proxy.
160- No GitHub Actions.
161
162## Evidence
163
164There is no `evidence/` directory. Verification results are recorded in prose in
165`docs/design/tailnet-lock.md` (stages three to six, including controller SHA-256
166`71ffcb5e6aed6bd6b2ec441b718220e2ad1d70d3fa767c728d104447f8668807` for the rebuilt Headscale
167binary) and in `qualification/security3-store/README.md`. Receipts for this repository, where
168filed, belong under `aien-dev/aien-receipts` `omnet/<sha>/`; whether any exist is unknown from
169the repository. Receipts are append-only and never edited.