From 7de554e954ee6afc00d67d24c324b726aee4f93e Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Sat, 24 Oct 2026 13:36:27 +0200 Subject: [PATCH] box_walk: HDD_PATH is the drive itself (R-839) The deploy API refuses an HDD_PATH that is a folder inside a registered drive; the walk sent DRIVE/ and got 409 on 9202 (2026-10-24, felhom.eu R-1250 live proof). --- CHANGELOG.md | 8 ++++++++ REPORT.md | 22 +++++++++------------- scripts/box_walk.py | 9 +++++++-- scripts/test_upgrade_bench.py | 17 +++++++++++++++++ 4 files changed, 41 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e30c61b..efbdbd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 2026-10-24 (attended) — the box walk sends the drive itself as HDD_PATH (R-839) + +- `scripts/box_walk.py` `deploy_values`: an `HDD_PATH` field now gets the registered drive (`DRIVE_ROOT`, + `/mnt/felhom-drives/scratch_hdd`) and no folder is made for it. Since controller R-839 the deploy API refuses an + HDD_PATH that is a folder inside a drive; the walk still sent `DRIVE/` and got 409 (measured on 9202 while + installing a throwaway qBittorrent for felhom.eu R-1250's live proof; the empty folder it made was removed). Other + `path` fields keep their own folder. `test_hdd_path_is_the_drive_itself` (seen failing with the rule off). + ## 2026-10-23 (day, after the release) — the box walk reads Tester 1's address from the guest - `scripts/box_walk.py`: Tester 1's guest moved `192.168.0.101` → `.148` (DHCP), and the walk had the address typed, so diff --git a/REPORT.md b/REPORT.md index 53162b7..1f24e11 100644 --- a/REPORT.md +++ b/REPORT.md @@ -1,14 +1,10 @@ -# REPORT — D39 = B: the security-fix lane (2026-10-23 day, `09` §3 decision 255, R-1239) +# REPORT — the box walk sends the drive itself as HDD_PATH (2026-10-24, attended) -- New step kind `"verdict": "security_fix"`: box walk required, bench optional, a CVE/GHSA notice as its authority. - Reader/checker `scripts/ladder.py` (`check_security`); gates `check-test-record-move.py` (accepts it like proven) and - `check-test-record.py` (WARN while a head has no bench); writer `upgrade-test.py --write-ladder --security`; box venue - `box_walk.py --security`. Command lines: `CLAUDE.md`, the ladder section. -- Tests: writer 18/18 (8 new, each refusal); decoys all OK, the 7 security decoys seen failing with the rules off; - `test_upgrade_bench.py` 40/40 and `test_catalog_gates.py` 12/12 after two stale tests were fixed (red on `main` before). -- Gates: `catalog_gates.py --fast` OK. -- Live (9202, drill catalog, controller 0.340.0): the negative control `failed` and was refused by the writer; the Plex - 1.43.4 → 1.43.5 walk `proven`; the drill step written; the old controller's night leg skipped it (`not_proven`); a hand - press took it. Evidence: felhom.eu `documentation/audits/security-lane-2026-10-23/`. -- The live catalog's templates are unchanged; drill entries stay in the drill. -- After the release: the box walk reads Tester 1's guest address (DHCP, `.148` today) instead of a typed `.101`. +- **What:** `scripts/box_walk.py` gave an app's `HDD_PATH` a folder inside the scratch drive (`…/userdata/`). The + controller's deploy API refuses that since R-839 (the data place is a drive, not a folder in one): 409, measured on + 9202 while installing a throwaway qBittorrent for felhom.eu R-1250. Now `HDD_PATH` is the drive root and no folder is + made for it; other path fields are unchanged. +- **Test:** `scripts/test_upgrade_bench.py` `BoxWalkTargets.test_hdd_path_is_the_drive_itself` — seen failing with the + rule switched off; the bench suite green after. +- **Live:** the same install went through with the drive root (202, running). The stray empty folder was removed. +- No template changed; no catalog version moved. diff --git a/scripts/box_walk.py b/scripts/box_walk.py index f0b9cd1..3669327 100644 --- a/scripts/box_walk.py +++ b/scripts/box_walk.py @@ -270,7 +270,8 @@ def wait_app(sub, path="/", want=("200", "302", "303", "401", "403"), tries=60, # ------------------------------------------------------------------ the walk -DRIVE = "/mnt/felhom-drives/scratch_hdd/userdata" +DRIVE_ROOT = "/mnt/felhom-drives/scratch_hdd" # the registered drive: what an HDD_PATH must name (R-839) +DRIVE = DRIVE_ROOT + "/userdata" # What THIS run generated for a deploy, per app. Deploy secrets are ENCRYPTED AT REST in # `app.yaml` (`ENC:…`), which is right and which means a fixture cannot read an app's admin @@ -309,7 +310,11 @@ def deploy_values(name, sub, given=None): # caller that trusts the contract gets a 400. Measured tonight on grafana; filed. if not f.get("required") and ty != "password": continue # the controller generates the optional secrets itself - if ty == "path": + if ty == "path" and ev == "HDD_PATH": + # R-839 (controller): the deploy API refuses an HDD_PATH that is a folder INSIDE a registered drive — + # the app's data place is the drive itself. Measured 2026-10-24: DRIVE/ came back 409. + values[ev] = DRIVE_ROOT + elif ty == "path": p = f"{DRIVE}/{name}" values[ev] = p made.append(p) diff --git a/scripts/test_upgrade_bench.py b/scripts/test_upgrade_bench.py index d8fd7a5..6295228 100644 --- a/scripts/test_upgrade_bench.py +++ b/scripts/test_upgrade_bench.py @@ -437,6 +437,23 @@ class BoxWalkTargets(unittest.TestCase): self.assertEqual(a[-1], "root@192.168.0.154") self.assertIn(("tester-1", "9201"), fxbox.BOX_ADMIN_SEED_GUESTS) + def test_hdd_path_is_the_drive_itself(self): + """R-839: the deploy API refuses an HDD_PATH that is a folder inside a registered drive (409, measured + 2026-10-24 on 9202 with DRIVE/qbittorrent). The walk sends the drive and makes no folder for it; another + path field still gets its own folder. RED-PROOF: send DRIVE/ for HDD_PATH again → fails.""" + bw = self.load({"BASE": "https://192.0.2.1"}) + fields = [{"env_var": "HDD_PATH", "type": "path", "required": True}, + {"env_var": "MEDIA_DIR", "type": "path", "required": True}] + made = [] + with mock.patch.object(bw, "ctl", return_value=("200", {"data": {"metadata": {"deploy_fields": fields}}})), \ + mock.patch.object(bw, "guest", side_effect=lambda script, timeout=600: made.append(script) or ""), \ + mock.patch.object(bw, "say"): + v = bw.deploy_values("qbittorrent", "x") + self.assertEqual(v["HDD_PATH"], "/mnt/felhom-drives/scratch_hdd") + self.assertEqual(v["MEDIA_DIR"], bw.DRIVE + "/qbittorrent") + self.assertEqual(len(made), 1) + self.assertNotIn("scratch_hdd ", made[0] + " ") # the drive root itself is never mkdir-ed + def test_an_unknown_target_is_refused(self): with self.assertRaises(SystemExit): self.load({"TARGET": "ep0"})