From 12f7f550cbef4d2d44d643745ebfa64aac9d4336 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Wed, 28 Oct 2026 21:25:57 -0500 Subject: [PATCH 1/2] docs: complete private reporting and audit scope without response promises --- .crumb | 12 +++--- AUDIT_SCOPE.md | 111 +++++++++++++++++++++++++++++++++++++++++++++++++ SECURITY.md | 53 +++++++++++++++++++++++ 3 files changed, 170 insertions(+), 6 deletions(-) create mode 100644 AUDIT_SCOPE.md create mode 100644 SECURITY.md diff --git a/.crumb b/.crumb index c0a1de8..0fb86ea 100644 --- a/.crumb +++ b/.crumb @@ -10,20 +10,20 @@ "children": [ { "digest": "6c3edd45335d6e8685867a47323f0d2ff58043782237b9e830d7732d7f3e36d7", - "last_commit": "4935b8a", + "last_commit": "e4efbd6", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." } ], "children_root": "sha256:346c4f7cd4ea2f6e0acd661cc5d1e687ec1f7c00e7979bc4b8e97938250291d0", - "compiled_at": "2026-10-28T21:30:33Z", + "compiled_at": "2026-10-29T02:25:57Z", "compiler": "crumb-compile/1", - "digest": "sha256:1230261216d2494cc1abcf579462a783ec9bb18b5c7583797e06f84a4a1d5404", + "digest": "sha256:6346efda8de2e35cf07b8f5cbb14b37f9e5ef43af38d3813e86a44d50e6ac9b1", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 8, - "generated_at_commit": "4935b8a03ca93b4dddaf83bb9a99784dfdffcb3b", - "source_tree": "sha256:f12bd3df637c2c859c4346e9e8e3095522943ebfb2799df93f149e9f21f40f07" + "files": 10, + "generated_at_commit": "f65a67ac86451939b8e2b5e924f8f9e572b81eb9", + "source_tree": "sha256:8863ebc35944f658611114a50f04ba51d9d732aa08a622a7f0d2761436adddda" }, "owner_lane": "", "seed": { diff --git a/AUDIT_SCOPE.md b/AUDIT_SCOPE.md new file mode 100644 index 0000000..ebd22b5 --- /dev/null +++ b/AUDIT_SCOPE.md @@ -0,0 +1,111 @@ +# Audit scope + +Written for an outside, independent security audit. Revision described: +`4935b8a03ca93b4dddaf83bb9a99784dfdffcb3b` on `main`, 2026-10-26. Everything below is taken from the repository's own files at +that revision. The executable source and Cargo files are unchanged at main +`f65a67a`; the local verification below was repeated for this documentation refresh. +Items marked NOT_RUN were not executed. + +## What this repository is + +A small Rust command-line tool that reads a hand-kept list of the services a Debian or Ubuntu +systemd machine runs and why (`register.toml`), and compares it with what systemd reports. The +whole program and its unit tests are in `src/main.rs` (391 lines). The tracked `register.toml` is a +generic example with one `ssh` entry, not an inventory of a deployed machine. It is an operations +tool, not part of AienOS. Licence AGPL-3.0-or-later. + +## What to review, in priority order + +1. `health` execution (`fn health`, `src/main.rs` around line 170). Each service's `health` string + runs as `sh -c ` with the caller's privileges, with no timeout, during `status` and + `show`. Check that no other command runs health strings (README says `doc` does not), and that + the operator is warned the register file must be as trusted as a script. +2. Register lookup (`fn find_register`). `--register `, else + `/etc/pi-register/register.toml`, else `./register.toml` in the current directory. Check the + consequence of running `status` or `show` from an untrusted working directory with no `/etc` + register present. +3. systemctl wrapper (`fn systemctl`, `fn cmd_control`, `fn cmd_check`). Unit names from the + register are passed as separate arguments to `systemctl` (no shell). There is no `--` separator + before the unit; check whether a register `unit` value beginning with `-` is parsed as an option. + `start|stop|enable|disable` refuse names not in the register (`unknown_name_is_refused` test). +4. Parsing and validation (`fn parse_register`, `fn load`). Required fields `name`, `purpose`, + `unit`, `category`, `owner`, `boot`; duplicate names are a load error. `secrets` holds a path + only. +5. `fn full_unit` and the built-in ignore list (`IGNORE`, `fn is_ignored`, `fn pattern_matches`) + used by `check` to skip base-system units. Check an attacker-chosen unit name cannot hide behind + the ignore patterns. +6. `restore_sigpipe` uses an `extern` declaration of `signal`; check it for soundness. + +There is no `.github/workflows/` directory. AGENTS.md: "There is no CI workflow in this repository. +Local build and test results are the only checks." + +## Trust boundaries + +- Trusted: the register file (it contains shell commands) and the operator who runs the tool; + `systemctl` on the target machine. +- Untrusted: none at run time beyond the register, if its file permissions or location are not + controlled. README recommends mode 600 for `register.local.toml` and + `/etc/pi-register/register.toml`. +- Privilege: control commands usually need root (AGENTS.md), so the register's trust level is the + caller's privilege level. + +## Threat model summary + +- Assets: the systemd state of the machine the register describes; the privacy of real + inventories. +- Attackers considered: someone who can write a register file the tool will load; accidental + publication of a real inventory. +- Defended: unknown names refused by control commands; real inventories kept in ignored + `register.local.toml` or `/etc`; no network calls by the tool. +- Not defended / explicitly out of scope: a hostile register is equivalent to running its `health` + commands; `depends_on` and `files` are recorded and shown, not enforced; timers and other unit + types are not scanned for unregistered ones (README). + +## Build from source at a pin + +Needs a stable Rust toolchain (no `rust-toolchain.toml`; the exact version is not pinned). +Dependencies `clap` 4.6.7, `serde` 1.0.229, `toml` 1.1.6, locked by `Cargo.lock`. + +```sh +cargo build --release +``` + +The binary is `target/release/pi-register`. + +## Run every test + +The following commands were executed locally during this documentation refresh. +They do not call systemd or run configured health commands. + +```sh +cargo test # unit tests in src/main.rs, no systemd access +./target/release/pi-register --help # help for every command +./target/release/pi-register --register register.toml doc # reads the register only +``` + +The five unit tests are `parses_full_and_minimal_entries`, `rejects_missing_required_field`, +`ignore_list_filters_base_units_only`, `unit_names_get_suffix` and `unknown_name_is_refused`. +Expected: `test result: ok. 5 passed` (count taken from the `#[test]` attributes). + +`status`, `show`, `check`, `start`, `stop`, `enable`, `disable`: NOT_RUN on a plain host. AGENTS.md: +run them only on the server the register describes, never on a development host, because `status` +and `show` execute `health` commands and the control commands change systemd state. + +## Known limitations and NOT_RUN + +- No CI; local results only. +- `health` commands have no timeout in the code. +- No tests cover `health` execution or the systemctl wrappers (they need a live systemd). +- Rust toolchain version is not pinned. + +## Dependencies and provenance + +- `Cargo.lock` present (34 packages including transitive `windows-sys` and `winnow`). +- Fetched from crates.io at build time. +- No vendored code, no GitHub Actions. +- At run time the tool calls `systemctl` and `sh`; it makes no network calls itself. + +## Evidence + +There is no evidence directory. AGENTS.md asks that pull requests carry the `cargo test` result in +their body. No receipts are kept in this repository. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..4a280f5 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,53 @@ +# 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 `[pi-register] 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 and disclosure + +Reports receive best-effort review. No response deadline, fix deadline or embargo duration +is promised here. Agree on disclosure and attribution with the maintainer through the +private reporting channel before publishing sensitive details. + +## Scope + +`pi-register` is a Rust CLI (`src/main.rs`) that reads a TOML service register and compares it +with what systemd reports. + +In scope: + +- Register parsing (`toml` + `serde`) that accepts a malformed file silently, or a duplicate-name + check that can be bypassed. +- A way for `start`, `stop`, `enable` or `disable` to act on a unit that is not in the register, or + for a register value to be interpreted by `systemctl` as an option rather than a unit name. +- Register lookup that picks up a file the operator did not intend (the fallback order is + `--register `, then `/etc/pi-register/register.toml`, then `./register.toml`). `status` + and `show` run every `health` value through `sh -c` with the caller's privileges, so a register + is code. +- A network call made by `pi-register` itself (AGENTS.md says it makes none). +- Secret values, private addresses, internal hosts or real inventories in tracked files. + +Out of scope: + +- The behaviour of a `health` command written by the operator, systemd, and the host operating + system. + +## Supported versions + +Only the default branch `main`; there is no release (Cargo version `0.1.0`). Reports against older commits are welcome but fixes land on the default branch only. + +## Status + +An operations tool that supports AienOS; it is not part of AienOS itself (AGENTS.md). There is no +CI workflow in this repository; local build and test results are the only checks. No +certification, no bug bounty. See AUDIT_SCOPE.md for what to review and how to build and test it. From 7477b039491a1ecd04c8007f7c10d3c0e31e116f Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Wed, 28 Oct 2026 21:26:18 -0500 Subject: [PATCH 2/2] docs: distinguish managed CodeQL from local build checks --- .crumb | 8 ++++---- AUDIT_SCOPE.md | 6 +++--- SECURITY.md | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.crumb b/.crumb index 0fb86ea..eae728c 100644 --- a/.crumb +++ b/.crumb @@ -16,14 +16,14 @@ } ], "children_root": "sha256:346c4f7cd4ea2f6e0acd661cc5d1e687ec1f7c00e7979bc4b8e97938250291d0", - "compiled_at": "2026-10-29T02:25:57Z", + "compiled_at": "2026-10-29T02:26:18Z", "compiler": "crumb-compile/1", - "digest": "sha256:6346efda8de2e35cf07b8f5cbb14b37f9e5ef43af38d3813e86a44d50e6ac9b1", + "digest": "sha256:181dc9fa801e6d0a878022fbc68ba17df0d857f145e6c202664aa53933bcfcf2", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 10, - "generated_at_commit": "f65a67ac86451939b8e2b5e924f8f9e572b81eb9", - "source_tree": "sha256:8863ebc35944f658611114a50f04ba51d9d732aa08a622a7f0d2761436adddda" + "generated_at_commit": "12f7f550cbef4d2d44d643745ebfa64aac9d4336", + "source_tree": "sha256:4e713726f2636a2023d8e71a8c3053155e40411cdeeec03c31bcc93afdb5598e" }, "owner_lane": "", "seed": { diff --git a/AUDIT_SCOPE.md b/AUDIT_SCOPE.md index ebd22b5..e8c15f6 100644 --- a/AUDIT_SCOPE.md +++ b/AUDIT_SCOPE.md @@ -36,8 +36,8 @@ tool, not part of AienOS. Licence AGPL-3.0-or-later. the ignore patterns. 6. `restore_sigpipe` uses an `extern` declaration of `signal`; check it for soundness. -There is no `.github/workflows/` directory. AGENTS.md: "There is no CI workflow in this repository. -Local build and test results are the only checks." +There is no `.github/workflows/` directory or repository-defined build/test job. +GitHub-managed CodeQL analysis appears on pull requests; it does not execute the local tests below. ## Trust boundaries @@ -93,7 +93,7 @@ and `show` execute `health` commands and the control commands change systemd sta ## Known limitations and NOT_RUN -- No CI; local results only. +- No repository-defined build/test CI; the executable results here are local. - `health` commands have no timeout in the code. - No tests cover `health` execution or the systemctl wrappers (they need a live systemd). - Rust toolchain version is not pinned. diff --git a/SECURITY.md b/SECURITY.md index 4a280f5..347cf42 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -49,5 +49,6 @@ Only the default branch `main`; there is no release (Cargo version `0.1.0`). Rep ## Status An operations tool that supports AienOS; it is not part of AienOS itself (AGENTS.md). There is no -CI workflow in this repository; local build and test results are the only checks. No +repository-defined build/test workflow; the build and test results documented here are local. +GitHub-managed CodeQL analysis can appear on pull requests but does not run these tests. No certification, no bug bounty. See AUDIT_SCOPE.md for what to review and how to build and test it.