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/omnet/patches/fffd08d86565d4cd # omnet aien-dev/omnet Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/omnet#20 (code only) closed derived `fffd08d86565d4cd` #20 Imported from GitHub aien-dev/omnet#20 (code only) GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed). Base `f35dcace0f03a23b254a31f5353d74c2ede1434c` · Head `4df982e54c2b522175917dc1082941735dbb634f` ### Fetch it A git bundle of the pull request's head, 9402 bytes. ``` curl -fsSL https://interplane.io/drakestapleton/omnet/patches/fffd08d86565d4cd.bundle -o fffd08d86565d4cd.bundle git fetch fffd08d86565d4cd.bundle refs/pull/20/head ``` Raw bundle · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/omnet 20 4df982e54c2b522175917dc1082941735dbb634f ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"omnet","number":20,"url":"https://github.com/aien-dev/omnet/pull/20","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:40:43Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..54dc308 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +# Dependabot: monthly version updates for the pinned GitHub Actions. +# Pull requests only; nothing merges itself. Security advisories are handled by GitHub +# Dependabot security updates on the repository settings. +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..651669d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +# CI for omnet: builds the pinned seed-born Omega compiler (omega.pin) and runs every unit +# suite through tools/test.sh on a GitHub-hosted arm64 runner. Go is installed only for the +# differential oracles (om/json, cmd/tka); oracles never ship. A second job writes an SPDX +# SBOM of the tree so auditors can diff what the repository contains at a given commit. +name: CI +on: + pull_request: + push: + branches: [main] +permissions: + contents: read +jobs: + test: + runs-on: ubuntu-24.04-arm + timeout-minutes: 45 + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version: '1.26.8' + cache: false + - name: Toolchain record + run: | + cat omega.pin + go version + python3 --version + - name: Build the pinned omc and run every suite + run: sh tools/test.sh + sbom: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false + - uses: anchore/sbom-action@66cbf4bc1f1c0d2edc94016e65bc221b6bb0ad6c # v0.24.3 + with: + path: . + format: spdx-json + artifact-name: sbom-${{ github.sha }}.spdx.json diff --git a/AUDIT_SCOPE.md b/AUDIT_SCOPE.md new file mode 100644 index 0000000..5e8d8ad --- /dev/null +++ b/AUDIT_SCOPE.md @@ -0,0 +1,169 @@ +# Audit scope + +Written for an outside, independent security audit. Revision described: +`83f605b147205bd912b085afdcf24402df24b5e5` on `main`, 2026-10-26. Everything below is taken from +the repository's own files at that revision; items marked NOT_RUN were not executed while writing +this document. + +## What this repository is + +omnet rewrites security-critical network code in Omega (`.om`), a language from +`aien-dev/omega-mv` whose compiler emits AArch64 Linux programs. The first project is the +server side of Tailscale Tailnet Lock (TKA) for self-hosted Headscale control servers. All TKA +logic, cryptography, parsing and durable state ship as Omega: the `om/` libraries and the `tkad` +daemon in `cmd/tkad/`. The Headscale adapter is a Go patch (`integration/headscale/`) that the +README describes as transport and authentication glue. Go and Python under `test/` directories +and `integration/e2e/` are test oracles and drivers and never ship. Status per README and +`docs/design/tailnet-lock.md`: implemented and verified in isolation; not deployed, not +production-qualified, not a production security audit. + +## What to review, in priority order + +1. `cmd/tkad/socket.om`, `cmd/tkad/rpc.om`, `cmd/tkad/adapter.om`, `cmd/tkad/main.om`. The + AF_UNIX IPC service: a 20-byte request header, a JSON body of 0..65536 bytes, 3-second + per-phase deadlines, the admin assertion byte (exactly 0 or 1) and the NodeID. Check that + bad or oversized headers close without a reply, that every RPC binds JSON `NodeKey` to the + registered key of the header NodeID, that RPCs 1, 2 and 6 and registry/map commands require + admin, and that error bodies never echo request details or secrets. +2. `om/tka/tka.om`, `om/tka/tkastate.om`, `om/tka/tkapool.om`, `om/tkasig/tkasig.om`. The + authority chain and node-key signature checks. Check fail-closed behaviour (design rule 3): + parse and signature failures reject; unknown signed AUM kinds advance the hash chain as + no-ops and never bypass authorization. +3. `om/ed25519/`, `om/sha512/`, `om/blake2s/`, `om/blake2b/`, `om/argon2/` (with + `argon2pool.om`). Signature verification and hashing used for authority and the disablement + secret. Check correctness against the committed vectors and the bounds on inputs. No + constant-time claim is made. +4. `om/cbor/`, `om/codec/`, `om/json/`. Parsers of attacker-controlled bytes (CBOR AUMs and + signatures, base64/hex, JSON RPC bodies). Check that every read has a capacity and that + size limits are checked before parsing (design rule 1). +5. `om/store/store.om`, `om/store/storepool.om`, `cmd/tkad/state.om`. Durable snapshots, + record framing and capacity charges (65536 records, 33554432 bytes). Check descriptor-based + operation (design rule 2), recovery refusing missing or corrupt snapshots, and the + charges described in `qualification/security3-store/README.md`. +6. `om/quantity/quantity.om`. Checked arithmetic used by the store charges. +7. `integration/headscale/headscale.patch`. Go glue added to Headscale v0.29.6: Noise identity + resolution, the admin user ID setting, reconciliation, SQL migrations, publication barrier, + bounded admission slots. Check that a caller's identity is resolved before daemon work, that + startup refuses when adapter state exists but settings are missing, and that pending + signatures are never treated as trusted map signatures. +8. `tools/omc.sh`, `tools/build-tkad.sh`, `integration/headscale/build.sh`. Supply chain: the + compiler is cloned from GitHub at the pinned commit, built by its seed chain and checked + against the pinned digest; the Headscale build verifies the pinned commit. +9. Test suite integrity: `tools/test.sh`, `om/*/test/run.sh`, `cmd/tkad/test/run.sh`, + `cmd/tkad/test/mutant.py`. AGENTS.md requires a mutant check per unit that counts only when + the driver completes and a result differs. + +`.github/workflows/ci.yml` (added by the audit-readiness change) builds the pinned omc through +`tools/omc.sh` and runs `sh tools/test.sh` on a GitHub-hosted arm64 runner with Go installed for +the oracles; a second job publishes an SPDX SBOM artifact. Every action is pinned by commit sha +and the token is read-only. + +## Trust boundaries + +- Untrusted input: TKA RPC JSON bodies from Tailscale clients (relayed by the adapter), CBOR + AUMs and node-key signatures inside them, Noise clients reaching Headscale, and on-disk + snapshots at recovery time (validated, not trusted). +- Trusted: the local adapter. `cmd/tkad/README.md` states the 0700 directory and 0600 socket + give a same-UID/root boundary only; there is no SO_PEERCRED check, and same-UID or root + processes can act as the adapter, read secrets and change storage. The adapter must derive + NodeIDs and admin assertions from its own identity model, never from remote JSON. +- Trusted: the Omega compiler at the commit and digest in `omega.pin`; the Headscale commit in + `integration/headscale/headscale.pin`. +- Isolated: the end-to-end test runs in a new network/PID namespace with loopback and a + dummy link, no egress, and drops privileges before starting daemons (`integration/e2e/run.sh`). + +## Threat model summary + +- Assets: the tailnet authority (trusted keys), accepted node-key signatures, the disablement + secret, durable snapshot integrity, and the availability of map publication. +- Attackers considered: a remote Tailscale client or Noise peer sending malformed or hostile + RPCs, CBOR or signatures; an ordinary registered client trying to forge or pad signatures; a + non-owner trying to disable TKA; crashes, short writes and ENOSPC during storage. +- Defended: memory-safety bug classes are runtime traps in Omega (README table); bounded input + sizes; fail-closed parsing and signature checks; canonical storage of accepted signatures + with a 413 refusal when the registry would not fit a map response; 401 before daemon work for + unknown identities; 503 instead of queueing under saturation. +- Not defended / explicitly out of scope: timing side channels ("not constant-time-audited"); + same-UID or root attackers; logic and protocol errors beyond tests and review; service-level + resource exhaustion (reduced, not eliminated); a reachable trap is still denial of service; + the durable revision floor is not authenticated rollback protection; power-loss durability, + cross-namespace writer exclusion and packet delivery are not established. + +## Build from source at a pin + +Requirements from README: Linux on ARM64, `git`, POSIX `sh`, Python 3, and Go >= 1.26.5 for the +TKA differential oracle. The Headscale adapter build uses go1.27.3. + +Compiler pin, from `omega.pin`: + +- omega-mv commit `acb3f15cdc691b1b046b48b0dad0f9255a12ba4b` +- omc sha256 `734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61` + +`tools/omc.sh` clones `https://github.com/aien-dev/omega-mv.git` into `build/omega-mv`, checks +out the pinned commit, runs `seed/omega-from-seed.sh`, and exits non-zero if the result's +sha256 differs from the pin. It checks the pin, not `seed/out/omc.sha256`. + +```sh +tools/omc.sh # prints the path of a verified omc +sh tools/build-tkad.sh # builds build/tkad from the om/ and cmd/tkad/ sources +GO=/path/to/go sh integration/headscale/build.sh # optional adapter, output build/headscale +``` + +The Omega build needs an AArch64 Linux host. The Headscale and client builds need network access +to GitHub and the Go module proxy. + +## Run every test + +```sh +tools/test.sh +GO=/path/to/go GOTOOLCHAIN=auto sh integration/e2e/build-clients.sh +GO=/path/to/go GOTOOLCHAIN=auto sh integration/headscale/build.sh +sh tools/build-tkad.sh +sh integration/e2e/run.sh +``` + +- `tools/test.sh` runs every `om/*/test/run.sh` and `cmd/*/test/run.sh` with the pinned + compiler and prints `PASS ` or `FAIL ` per suite; exit 0 only if all pass. + `docs/design/tailnet-lock.md` records twelve suites passing at stage six. NOT_RUN here. +- `integration/e2e/run.sh` needs unprivileged user and network namespaces, `unshare`, `ip` and + `python3`; otherwise it prints `NOT_RUN` and exits 77. `--sudo-netns` uses `sudo -n` to create + the namespace and drops privileges before any daemon starts. The design document records 13 + PASS records. NOT_RUN here. +- Foreign-UID ownership fixtures in the store suite need root and were skipped in the recorded + stage-four run. + +## Known limitations and NOT_RUN + +- Profile limits: one tailnet, 64 nodes, 128 authority updates, 64-KiB JSON messages. Large + checkpoints and long histories can exceed this profile. +- The daemon does not authenticate remote Tailscale clients; the adapter does, and shares the + daemon UID. +- One committed node without an NLKey blocks publication for the whole tailnet; SQLite cannot be + downgraded in place; disablement is permanent for that database + (`docs/design/tailnet-lock.md`, stage six). +- No constant-time claim; no claim of absence of vulnerabilities. +- All recorded verification is host and isolated-namespace evidence. No deployment, data-plane + or power-loss testing. +- `qualification/security3-store/README.md` notes that absence of migration to checked + quantities is not evidence of a bug in modules it did not touch. + +## Dependencies and provenance + +- No lockfile at the repository root. Go oracles carry their own `go.mod`/`go.sum` under + `om/*/test/gen/oracle/`, `om/json/test/oracle/` and `om/codec/test/gen/tsoracle/`. +- Committed test vectors carry upstream notices next to them (RFC 7693, 8032, 8949, 9106, + 4648; Wycheproof, ZIP-215, BLAKE2 KAT licences). Tailscale and Headscale licences ship + beside derived material (`om/tka/tailscale.LICENSE`, `integration/headscale/*.LICENSE`). +- Oracles in Go and Python do not ship. +- External services at build/test time: GitHub (omega-mv clone in `tools/omc.sh`; Headscale + and Tailscale clones) and the Go module proxy. +- No GitHub Actions. + +## Evidence + +There is no `evidence/` directory. Verification results are recorded in prose in +`docs/design/tailnet-lock.md` (stages three to six, including controller SHA-256 +`71ffcb5e6aed6bd6b2ec441b718220e2ad1d70d3fa767c728d104447f8668807` for the rebuilt Headscale +binary) and in `qualification/security3-store/README.md`. Receipts for this repository, where +filed, belong under `aien-dev/aien-receipts` `omnet//`; whether any exist is unknown from +the repository. Receipts are append-only and never edited. diff --git a/README.md b/README.md index c9bb6d1..54413b1 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,8 @@ commit in [`omega.pin`](omega.pin). An unsized `view T *` / `edit T *` parameter is a pointer plus a count. Every index into it is checked at run time and the count travels with it, so the bounds rule above holds for slices as well -([OM-2 guarantee matrix](docs/one_layer/OM2-TUTORIAL.md) lives in the Omega repository, at the pinned -commit). +([OM-2 guarantee matrix](https://github.com/aien-dev/omega-mv/blob/2d6ea129b5fc12c29472e79b20c3e225a1cedef4/docs/one_layer/OM2-TUTORIAL.md) +lives in the Omega repository; it was added after the omega-mv commit pinned in `omega.pin`). A trap stops the program. That turns memory corruption into a crash, so a reachable trap is still a denial-of-service bug. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..dbfcacc --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,66 @@ +# Security policy + +## Reporting a vulnerability + +Report privately. Do not open a public issue, pull request or discussion about it. + +1. GitHub: open this repository's Security tab and choose "Report a vulnerability". This + creates a private advisory that only the maintainers can see. If that option is not shown, + private vulnerability reporting has not been enabled for this repository yet; use email. +2. Email: drake@aienos.com with the subject `[omnet] security report`. + +Include the commit or release you tested, the component (path), steps to reproduce, and what an +attacker gains. If the report involves a secret, say where it was exposed and do not send the +secret itself. Encrypted mail is not required; do not post proof-of-concept payloads publicly. + +## Response targets + +This project has one maintainer; the targets below are best effort and stated honestly. + +- Acknowledgement: within 3 working days. +- Triage and severity: within 7 days of acknowledgement. +- Fix or mitigation for confirmed issues: aim for 30 days for high and critical, 90 days + otherwise, with a status update at least every 14 days until closed. +- Disclosure: coordinated. An advisory is published with credit (unless you ask otherwise) + once the fix is on the default branch. Default embargo 90 days, negotiable. + +## Scope + +In scope: + +- An Omega unit under `om/` (BLAKE2s, BLAKE2b, SHA-512, Ed25519, Argon2, codec, CBOR, JSON, + TKA, tkasig, store, quantity) that accepts a forged signature, rejects a valid one, reads or + writes out of bounds, or traps on attacker-supplied input (a reachable trap is a + denial-of-service bug). +- A wrong authorization decision in the Tailnet Lock (TKA) model, `om/tka/`, `om/tkasig/`, or + in the `tkad` daemon RPC handlers under `cmd/tkad/`. +- The `tkad` IPC framing in `cmd/tkad/socket.om`: oversized or malformed headers or bodies, + missing deadlines, or a way to bypass the admin assertion or NodeKey binding. +- Durable state in `om/store/` and `cmd/tkad/state.om`: a crash, rename or short write that + leaves a snapshot that recovery accepts but should refuse, or a check-then-use on a path. +- The Headscale adapter patch in `integration/headscale/headscale.patch`: an unauthenticated + client reaching daemon work, a map published without TKA state, or identity taken from + remote JSON. +- `tools/omc.sh` accepting a compiler whose digest does not equal `omega.pin`. + +Out of scope: + +- Test oracles and vector generators (Go and Python under `*/test/`, `integration/e2e/`); they + never ship. Upstream Headscale, Tailscale and Go code outside the committed patch. +- Timing side channels: the code is not constant-time audited and makes no such claim. +- Attacks by a process running as the same UID as `tkad`, or as root. The README and + `cmd/tkad/README.md` state that this local boundary is trusted. +- The Omega compiler itself; report it to `aien-dev/omega-mv`. + +## Supported versions + +Only the default branch `main`; there is no release. Reports against older commits are welcome +but fixes land on the default branch only. + +## Status + +The daemon implements all eight TKA RPCs and has passed isolated end-to-end verification with +stock Tailscale clients. The README states this is not deployed tailnet protection, data-plane +qualification or a production security audit, and no live deployment is approved. There is no +certification and no bug bounty. See AUDIT_SCOPE.md for what to review and how to build and +test it. ```