From a0811fe3fda59c186c34cbb4013a7b0667a3abca Mon Sep 17 00:00:00 2001 From: Claude Code Bot Date: Tue, 17 Nov 2026 17:36:58 -0800 Subject: [PATCH 01/16] docs(spec): record the macOS runner Task 0 results The live checks on MIMOLETTE passed: both rule files load before the VM bridge exists, IPv4 and IPv6 LAN traffic is blocked, and df on the external disk does not hang under launchd. An IPv6 DNS pass rule did not match, so the build blocks all IPv6 LAN traffic and DNS uses the IPv4 resolver. Also fix the Undo hold value and the Tart version. --- .../plans/2026-11-17-swm-macos-tart-runner.md | 10 +++-- ...2026-11-17-swm-macos-tart-runner-design.md | 43 +++++++++++++++---- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/docs/superpowers/plans/2026-11-17-swm-macos-tart-runner.md b/docs/superpowers/plans/2026-11-17-swm-macos-tart-runner.md index 375df20..8b9575f 100644 --- a/docs/superpowers/plans/2026-11-17-swm-macos-tart-runner.md +++ b/docs/superpowers/plans/2026-11-17-swm-macos-tart-runner.md @@ -237,10 +237,12 @@ pass in quick inet proto { udp tcp } from 192.168.65.0/24 to 192.168.65.1 port 5 block drop in quick inet from 192.168.65.0/24 to ``` -`swm-tart-v6.pf` (needs `bridge101`): +`swm-tart-v6.pf` (names `bridge101`; Task 0 proved it loads while the +interface is absent and still applies to a new `bridge101`). No IPv6 DNS +pass: Task 0 showed a port-53 pass to the bridge's link-local address does +not match, and DNS works through `192.168.65.1`, which the v4 file passes. ```text -pass in quick on bridge101 inet6 proto { udp tcp } from any to (bridge101) port 53 block drop in quick on bridge101 inet6 from any to { fc00::/7, fe80::/10 } ``` @@ -248,7 +250,7 @@ block drop in quick on bridge101 inet6 from any to { fc00::/7, fe80::/10 } `tart v4 load fails → NOS ok file kept, swm ok file removed, exit 1`; `NOS load fails → swm ok files still written when swm loads`; `swm v4 anchor lists 2 pass + 1 block → swm ok written`; - `swm v6 lists 2 pass + 2 block (the destination list expands) → v6 ok written`; + `swm v6 lists 0 pass + 2 block (the destination list expands) → v6 ok written`; `swm v6 load fails → v6 ok removed, v4 ok kept, warning on stderr`; `existing NOS cases unchanged`. `install-pf` installs both new rule files `root:wheel 0644`. @@ -278,7 +280,7 @@ Andrew re-runs `sudo bash scripts/nos-runner/net/install-pf.sh` after merge **Interfaces:** -- Produces (`config.sh`): `SWM_BASE_IMAGE` (`ghcr.io/cirruslabs/macos-tahoe-base@sha256:`), +- Produces (`config.sh`): `SWM_BASE_IMAGE` (`ghcr.io/cirruslabs/macos-tahoe-base@sha256:65c3133a633fda8753cf1f71f2d55727792d534a2125b0032466563dcc8e58fd`), `SWM_RUNNER_VERSION=2.338.2`, `SWM_RUNNER_SHA256`, `SWM_IMAGE` (`swm-macos-runner--<12 hex>`, hash over `guest/` files plus the base digest, same method as NOS `_nos_image_hash`), `SWM_CPUS=4`, diff --git a/docs/superpowers/specs/2026-11-17-swm-macos-tart-runner-design.md b/docs/superpowers/specs/2026-11-17-swm-macos-tart-runner-design.md index 5573b28..89e44bc 100644 --- a/docs/superpowers/specs/2026-11-17-swm-macos-tart-runner-design.md +++ b/docs/superpowers/specs/2026-11-17-swm-macos-tart-runner-design.md @@ -110,9 +110,11 @@ As with the NOS runner, nothing connects to MIMOLETTE from outside. - Tart VMs use `bridge101`, `192.168.65.0/24`, not the container bridge (`bridge100`, `192.168.64.0/24`), so the NOS rules do not cover them. -- The VM's DNS resolver is the host's IPv6 link-local address on the bridge, - so the Linux rules' `fe80::/10` block would break DNS. The Tart rules pass - port 53 to the bridge's own addresses first. +- The VM lists three resolvers: `192.168.65.1` and two host link-local IPv6 + addresses. Build Task 0 (2026-11-17) found that a port-53 pass to the + link-local addresses does not match, so IPv6 DNS is blocked with the rest + of IPv6 LAN traffic. DNS works through `192.168.65.1`, which the IPv4 rules + pass. The spike rules below had the same effect. - Spike rules (anchor `com.apple/tart-spike`): ```text @@ -125,8 +127,9 @@ As with the NOS runner, nothing connects to MIMOLETTE from outside. - The build extends the NOS root pf guard (`scripts/nos-runner/net/`) to load a Tart anchor at boot and every 300 s. The NOS rules avoid naming the interface because `bridge100` may not exist before the first container; the - same applies to `bridge101`, so the plan rewrites these rules by source - address where it can. The IPv6 DNS pass needs a test. + same applies to `bridge101`, so the IPv4 rules match by source address. + The IPv6 block names `bridge101`; Task 0 proved it loads while the + interface is absent and applies to each new `bridge101`. ### 5. Storage @@ -213,8 +216,10 @@ the backup and the live keychain; 66 after). ## Undo -Set `SWM_MACOS_RUNNER=macos-latest`, or delete the variable. Every job is back -on GitHub-hosted runners at once. +Set `SWM_MACOS_RUNNER=macos-26`. Every job is back on GitHub-hosted runners at +once. Once the watchdog runs, unset and `macos-latest` are not holds: the +watchdog switches back to `mimolette-macos` when the runner is healthy. Any +other value is a hold the watchdog leaves alone. ## Spike results (2026-11-17) @@ -223,7 +228,8 @@ Scratch files: `~andrewrich/.local/state/tart-spike/` on MIMOLETTE. ### Step 1: pull — PASS `macos-tahoe-base` (macOS 26.6.2, Homebrew 7.0.12): 27 GB download, 33 GB on -disk, sparse 50 GB VM disk. Tart 2.41.1; licence FSL-1.1-ALv2 (read from the +disk, sparse 50 GB VM disk. Tart 2.42.0 (installed 11:59 on 2026-11-17, +before the TCC Allow; an earlier draft said 2.41.1); licence FSL-1.1-ALv2 (read from the copy on MIMOLETTE), which permits internal use with no size limit. ### Step 2: boot under launchd — PASS @@ -274,3 +280,24 @@ Min free 34%, swap 4.9 to 6.6 GB, no critical pressure. The suite did not run: and run all worked under launchd with no further prompt. - The image is now on both disks (33 GB internal, 30 GB external); the plan removes the copy it does not use. + +## Build Task 0 results (2026-11-17, live on MIMOLETTE) + +- The spike anchor `com.apple/tart-spike` is flushed and its pf enable + reference released. +- Both rule files load into probe anchors while `bridge101` does not exist. +- Two VMs in turn (`probe-1`, `probe-2`): GitHub, npm and DNS work; every + IPv4 LAN probe from the spike table is blocked; host ssh over IPv6 + link-local is blocked. The IPv6 rules apply to the second VM's new + `bridge101` with no reload. +- Baseline with the IPv6 rules removed (`probe-3`): host ssh over IPv6 + link-local is open, so the blocked result above comes from the rules. +- IPv6 DNS: a pass for port 53, written as `to (bridge101)` or as + `from fe80::/10 to fe80::/10`, did not let DNS through (`probe-4`, + `probe-5`). DNS works through `192.168.65.1`. The build drops the IPv6 DNS + pass and blocks all IPv6 LAN traffic. +- `df -Pk /Volumes/extra-vieille/Caches/tart` under a launchd `/bin/bash` + job returns at once (1.7 TB free); no TCC hang. +- Base image digest: + `sha256:65c3133a633fda8753cf1f71f2d55727792d534a2125b0032466563dcc8e58fd`. +- No spike LaunchAgent is loaded. From 23119e181489b85a1e13c4c7b9abf9c571ef8cca Mon Sep 17 00:00:00 2001 From: Claude Code Bot Date: Tue, 17 Nov 2026 17:43:59 -0800 Subject: [PATCH 02/16] feat(nos-runner): let github-app.sh read any Keychain key item app_jwt reads GH_APP_KEY_SERVICE and GH_APP_KEY_ACCOUNT, defaulting to the NOS runner item, so the smartwatermelon macOS runner can reuse the helper. --- scripts/nos-runner/github-app.sh | 3 ++- scripts/nos-runner/tests/test-github-app.sh | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/nos-runner/github-app.sh b/scripts/nos-runner/github-app.sh index ae121eb..7e53e8b 100755 --- a/scripts/nos-runner/github-app.sh +++ b/scripts/nos-runner/github-app.sh @@ -22,9 +22,10 @@ _sign() { # app_jwt APP_ID: print an RS256 JWT (iat = now - 60, exp = now + 540). # The key is Keychain base64 text and never touches a file. +# GH_APP_KEY_SERVICE and GH_APP_KEY_ACCOUNT pick the Keychain item; defaults are the NOS runner's. app_jwt() { local app_id="$1" now hdr pl sig keyb64 - keyb64="$("${SECURITY_BIN:-security}" find-generic-password -s nos-runner-app-key -a nightowlstudiollc -w)" || return 1 + keyb64="$("${SECURITY_BIN:-security}" find-generic-password -s "${GH_APP_KEY_SERVICE:-nos-runner-app-key}" -a "${GH_APP_KEY_ACCOUNT:-nightowlstudiollc}" -w)" || return 1 now="$("${DATE_BIN:-date}" +%s)" || return 1 hdr="$(printf '%s' '{"alg":"RS256","typ":"JWT"}' | _b64url)" || return 1 pl="$(printf '{"iat":%s,"exp":%s,"iss":"%s"}' "$((now - 60))" "$((now + 540))" "${app_id}" | _b64url)" || return 1 diff --git a/scripts/nos-runner/tests/test-github-app.sh b/scripts/nos-runner/tests/test-github-app.sh index 69b4e53..bdad433 100755 --- a/scripts/nos-runner/tests/test-github-app.sh +++ b/scripts/nos-runner/tests/test-github-app.sh @@ -96,6 +96,11 @@ is_regular=0 grep -q regular "${WORK}/openssl.keykind" && is_regular=1 check "key_arg_not_regular_file" test "${is_regular}" -eq 0 +check "key_item_default" grep -qx 'find-generic-password -s nos-runner-app-key -a nightowlstudiollc -w' "${WORK}/security.argv" +rm -f "${WORK}/security.argv" +GH_APP_KEY_SERVICE=swm-runner-app-key GH_APP_KEY_ACCOUNT=smartwatermelon app_jwt 12345 >/dev/null +check "key item override" grep -qx 'find-generic-password -s swm-runner-app-key -a smartwatermelon -w' "${WORK}/security.argv" + tok="$(app_token 12345 678)" check "token_value_parsed" test "${tok}" = ghs_installtok check "token_request_is_post" grep -q -- '-X POST' "${WORK}/curl.argv" From 0e9dbbac4bef957834d691af9e398a9470d3188f Mon Sep 17 00:00:00 2001 From: Claude Code Bot Date: Tue, 17 Nov 2026 17:46:40 -0800 Subject: [PATCH 03/16] feat(swm-macos-runner): add the fork-guard job-started hook The guest runs this hook before any workflow step and denies every event that does not provably come from a branch of the same repository in an allowed owner. Tests use crafted payloads, and a control run against an allow-all hook must fail exactly 16 deny cases, so the cases are proven able to fail. CI runs the suite in tests.yml. --- .github/workflows/tests.yml | 3 + CLAUDE.md | 3 +- scripts/swm-macos-runner/guest/job-started.sh | 48 +++++++++++ .../swm-macos-runner/tests/hook-allow-all.sh | 3 + scripts/swm-macos-runner/tests/run-tests.sh | 11 +++ .../tests/test-job-started.sh | 83 +++++++++++++++++++ 6 files changed, 150 insertions(+), 1 deletion(-) create mode 100755 scripts/swm-macos-runner/guest/job-started.sh create mode 100755 scripts/swm-macos-runner/tests/hook-allow-all.sh create mode 100755 scripts/swm-macos-runner/tests/run-tests.sh create mode 100755 scripts/swm-macos-runner/tests/test-job-started.sh diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 93b8723..94b9409 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,6 +33,9 @@ jobs: - name: Run agent-ro tests run: bash scripts/agent-ro/tests/run-tests.sh + - name: Run swm-macos-runner tests + run: bash scripts/swm-macos-runner/tests/run-tests.sh + - name: Run watchdog tests run: npm --prefix workers/nos-runner-watchdog test diff --git a/CLAUDE.md b/CLAUDE.md index 78f2423..4ab3ce7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co This repo is the **dev-env infrastructure repository** — it contains documentation, design plans, templates, and hook extensions for Andrew's Claude Code development environment. It is not an application codebase and there is no build step, but it is not command-free either: -- **Tests**: `bash scripts/org-migration/tests/run-tests.sh` runs the hermetic stub-`gh` suite for the org-migration tooling. Run it after any change under `scripts/org-migration/`. `bash scripts/dependabot-digest/tests/run-tests.sh` covers the Dependabot digest classifier and renderer; run it after any change under `scripts/dependabot-digest/`. `bash scripts/site-monitor/tests/run-tests.sh` covers the production-site monitor's alert transitions; run it after any change under `scripts/site-monitor/`. `bash scripts/nos-runner/tests/run-tests.sh` covers the NOS self-hosted runner supervisor, installer and pf guard; run it after any change under `scripts/nos-runner/`. `bash scripts/agent-ro/tests/run-tests.sh` covers the agent read-only ssh account (gate, sweep, installer); run it after any change under `scripts/agent-ro/`. `npm --prefix workers/nos-runner-watchdog test` covers the runner watchdog Worker; run it after any change under `workers/nos-runner-watchdog/`. +- **Tests**: `bash scripts/org-migration/tests/run-tests.sh` runs the hermetic stub-`gh` suite for the org-migration tooling. Run it after any change under `scripts/org-migration/`. `bash scripts/dependabot-digest/tests/run-tests.sh` covers the Dependabot digest classifier and renderer; run it after any change under `scripts/dependabot-digest/`. `bash scripts/site-monitor/tests/run-tests.sh` covers the production-site monitor's alert transitions; run it after any change under `scripts/site-monitor/`. `bash scripts/nos-runner/tests/run-tests.sh` covers the NOS self-hosted runner supervisor, installer and pf guard; run it after any change under `scripts/nos-runner/`. `bash scripts/agent-ro/tests/run-tests.sh` covers the agent read-only ssh account (gate, sweep, installer); run it after any change under `scripts/agent-ro/`. `bash scripts/swm-macos-runner/tests/run-tests.sh` covers the smartwatermelon macOS runner's fork-guard hook; run it after any change under `scripts/swm-macos-runner/`. `npm --prefix workers/nos-runner-watchdog test` covers the runner watchdog Worker; run it after any change under `workers/nos-runner-watchdog/`. - **Lint**: `shellcheck -S info