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/pi-register/blob/main/AUDIT_SCOPE.md # pi-register aien-dev/pi-register 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 `pi-register / AUDIT_SCOPE.md` 111 lines ยท 5840 bytes Raw Blame History Rendered 1 # Audit scope 2 3 Written for an outside, independent security audit. Revision described: 4 ``4935b8a03ca93b4dddaf83bb9a99784dfdffcb3b`` on `main`, 2026-10-26. Everything below is taken from the repository's own files at 5 that revision. The executable source and Cargo files are unchanged at main 6 ``f65a67a``; the local verification below was repeated for this documentation refresh. 7 Items marked NOT_RUN were not executed. 8 9 ## What this repository is 10 11 A small Rust command-line tool that reads a hand-kept list of the services a Debian or Ubuntu 12 systemd machine runs and why (`register.toml`), and compares it with what systemd reports. The 13 whole program and its unit tests are in `src/main.rs` (391 lines). The tracked `register.toml` is a 14 generic example with one `ssh` entry, not an inventory of a deployed machine. It is an operations 15 tool, not part of Sovereign Intelligence (SI). Licence AGPL-3.0-or-later. 16 17 ## What to review, in priority order 18 19 1. `health` execution (`fn health`, `src/main.rs` around line 170). Each service's `health` string 20 runs as `sh -c ` with the caller's privileges, with no timeout, during `status` and 21 `show`. Check that no other command runs health strings (README says `doc` does not), and that 22 the operator is warned the register file must be as trusted as a script. 23 2. Register lookup (`fn find_register`). `--register `, else 24 `/etc/pi-register/register.toml`, else `./register.toml` in the current directory. Check the 25 consequence of running `status` or `show` from an untrusted working directory with no `/etc` 26 register present. 27 3. systemctl wrapper (`fn systemctl`, `fn cmd_control`, `fn cmd_check`). Unit names from the 28 register are passed as separate arguments to `systemctl` (no shell). There is no `--` separator 29 before the unit; check whether a register `unit` value beginning with `-` is parsed as an option. 30 `start|stop|enable|disable` refuse names not in the register (`unknown_name_is_refused` test). 31 4. Parsing and validation (`fn parse_register`, `fn load`). Required fields `name`, `purpose`, 32 `unit`, `category`, `owner`, `boot`; duplicate names are a load error. `secrets` holds a path 33 only. 34 5. `fn full_unit` and the built-in ignore list (`IGNORE`, `fn is_ignored`, `fn pattern_matches`) 35 used by `check` to skip base-system units. Check an attacker-chosen unit name cannot hide behind 36 the ignore patterns. 37 6. `restore_sigpipe` uses an `extern` declaration of `signal`; check it for soundness. 38 39 There is no `.github/workflows/` directory or repository-defined build/test job. 40 GitHub-managed CodeQL analysis appears on pull requests; it does not execute the local tests below. 41 42 ## Trust boundaries 43 44 - Trusted: the register file (it contains shell commands) and the operator who runs the tool; 45 `systemctl` on the target machine. 46 - Untrusted: none at run time beyond the register, if its file permissions or location are not 47 controlled. README recommends mode 600 for `register.local.toml` and 48 `/etc/pi-register/register.toml`. 49 - Privilege: control commands usually need root (AGENTS.md), so the register's trust level is the 50 caller's privilege level. 51 52 ## Threat model summary 53 54 - Assets: the systemd state of the machine the register describes; the privacy of real 55 inventories. 56 - Attackers considered: someone who can write a register file the tool will load; accidental 57 publication of a real inventory. 58 - Defended: unknown names refused by control commands; real inventories kept in ignored 59 `register.local.toml` or `/etc`; no network calls by the tool. 60 - Not defended / explicitly out of scope: a hostile register is equivalent to running its `health` 61 commands; `depends_on` and `files` are recorded and shown, not enforced; timers and other unit 62 types are not scanned for unregistered ones (README). 63 64 ## Build from source at a pin 65 66 Needs a stable Rust toolchain (no `rust-toolchain.toml`; the exact version is not pinned). 67 Dependencies `clap` 4.6.7, `serde` 1.0.229, `toml` 1.1.6, locked by `Cargo.lock`. 68 69 ```sh 70 cargo build --release 71 ``` 72 73 The binary is `target/release/pi-register`. 74 75 ## Run every test 76 77 The following commands were executed locally during this documentation refresh. 78 They do not call systemd or run configured health commands. 79 80 ```sh 81 cargo test # unit tests in src/main.rs, no systemd access 82 ./target/release/pi-register --help # help for every command 83 ./target/release/pi-register --register register.toml doc # reads the register only 84 ``` 85 86 The five unit tests are `parses_full_and_minimal_entries`, `rejects_missing_required_field`, 87 `ignore_list_filters_base_units_only`, `unit_names_get_suffix` and `unknown_name_is_refused`. 88 Expected: `test result: ok. 5 passed` (count taken from the `#[test]` attributes). 89 90 `status`, `show`, `check`, `start`, `stop`, `enable`, `disable`: NOT_RUN on a plain host. AGENTS.md: 91 run them only on the server the register describes, never on a development host, because `status` 92 and `show` execute `health` commands and the control commands change systemd state. 93 94 ## Known limitations and NOT_RUN 95 96 - No repository-defined build/test CI; the executable results here are local. 97 - `health` commands have no timeout in the code. 98 - No tests cover `health` execution or the systemctl wrappers (they need a live systemd). 99 - Rust toolchain version is not pinned. 100 101 ## Dependencies and provenance 102 103 - `Cargo.lock` present (34 packages including transitive `windows-sys` and `winnow`). 104 - Fetched from crates.io at build time. 105 - No vendored code, no GitHub Actions. 106 - At run time the tool calls `systemctl` and `sh`; it makes no network calls itself. 107 108 ## Evidence 109 110 There is no evidence directory. AGENTS.md asks that pull requests carry the `cargo test` result in 111 their body. No receipts are kept in this repository.