toolchain: priming hardening — the answered-at-the-bound window, and the toplevel-less payload cost #341

Closed
opened 2026-08-08 15:04:39 +00:00 by ben · 3 comments
Owner

Two follow-ups from the Finding N/O reviews (arc ledger 2026-08-08):

  1. Answered-at-the-bound: pkexec is setuid-root — once the operator authenticates, the unprivileged app can no longer signal it (EPERM), CombinedOutput's Wait blocks on pipe EOF until the ROOT copy finishes (so Prime returns late, not at the 90s bound), and if that root copy then FAILS the timeout branch misreports it as "the elevation prompt went unanswered". Narrow window, real misreport. Hardening: cmd.WaitDelay on the elevation leg + a Detail that distinguishes "answered, then the import itself failed" — with a seam test in prime_test.go's existing style.

  2. Toplevel-less payloads keep drive 19's pathology: a release staged WITHOUT gateway-warm.toplevel falls back to --all, which can never detect presence (Finding O), draws the daemon refusal, and now burns the full 90s elevation window at a prompt on EVERY drive. Deliberate per the Finding O brief, but scripts/assemble-payload.sh's NOTE understates the cost — amend the NOTE to say exactly this, and have the primer's --all branch comment name it too.

Also worth carrying: prime.go's operator-facing Detail renders the bound as "1m30s" (Duration.String()); "90 seconds" reads better in an operator line (cosmetic, ride-along only).

Two follow-ups from the Finding N/O reviews (arc ledger 2026-08-08): 1. **Answered-at-the-bound**: pkexec is setuid-root — once the operator authenticates, the unprivileged app can no longer signal it (`EPERM`), `CombinedOutput`'s Wait blocks on pipe EOF until the ROOT copy finishes (so `Prime` returns late, not at the 90s bound), and if that root copy then FAILS the timeout branch misreports it as "the elevation prompt went unanswered". Narrow window, real misreport. Hardening: `cmd.WaitDelay` on the elevation leg + a Detail that distinguishes "answered, then the import itself failed" — with a seam test in `prime_test.go`'s existing style. 2. **Toplevel-less payloads keep drive 19's pathology**: a release staged WITHOUT `gateway-warm.toplevel` falls back to `--all`, which can never detect presence (Finding O), draws the daemon refusal, and now burns the full 90s elevation window at a prompt on EVERY drive. Deliberate per the Finding O brief, but `scripts/assemble-payload.sh`'s NOTE understates the cost — amend the NOTE to say exactly this, and have the primer's `--all` branch comment name it too. Also worth carrying: prime.go's operator-facing Detail renders the bound as "1m30s" (`Duration.String()`); "90 seconds" reads better in an operator line (cosmetic, ride-along only).
Author
Owner

Blocked — not an implementable slice against this repo (needs a human ruling).

This issue is framed as a hardening follow-up that amends existing code, but every artifact it names is absent from Matou/ourcloud (checked on main and across all history):

  • No priming subsystem. There is no prime.go / prime_test.go, no elevatedPrime, no Prime function, no cmd.WaitDelay elevation leg, and no --all / gateway-warm.toplevel presence-detection branch anywhere in the tree (grep -rn over all *.go and all history returns nothing for elevatedPrime, gateway-warm, priming, answered-at-the-bound).
  • scripts/assemble-payload.sh has no toplevel NOTE to amend. Its only NOTE line is payload is INCOMPLETE (QEMU pending #230); the script stages agent/guest-image/QEMU only — no gateway-warm.toplevel, no --all fallback.
  • The predicates don't exist here either. No "Finding N/O reviews", no arc ledger 2026-08-08, and commit 9fcaf22 (cited as the Finding M fix) is Not a valid object name in this repo.

The pkexec/elevation code that does exist is internal/toolchain/installer.go (the supervised nix install — the subject of the sibling issue #340), which is a different surface from the "primer" this issue describes.

So there is nothing to harden here. This looks like it was scoped against a different fork/context, or the priming subsystem was never merged into main (in which case a prerequisite issue that builds the primer is missing from depends_on).

A human must decide: (a) does the priming subsystem belong in Matou/ourcloud, and if so which prerequisite issue creates prime.go first — re-arm this with that depends_on; or (b) this issue belongs elsewhere / is obsolete — close or move it. I have not guessed. Swapping ready-for-agent → ready-for-human.

**Blocked — not an implementable slice against this repo (needs a human ruling).** This issue is framed as a *hardening follow-up* that amends existing code, but every artifact it names is absent from `Matou/ourcloud` (checked on `main` and across all history): - **No priming subsystem.** There is no `prime.go` / `prime_test.go`, no `elevatedPrime`, no `Prime` function, no `cmd.WaitDelay` elevation leg, and no `--all` / `gateway-warm.toplevel` presence-detection branch anywhere in the tree (`grep -rn` over all `*.go` and all history returns nothing for `elevatedPrime`, `gateway-warm`, `priming`, `answered-at-the-bound`). - **`scripts/assemble-payload.sh` has no toplevel NOTE to amend.** Its only `NOTE` line is `payload is INCOMPLETE (QEMU pending #230)`; the script stages agent/guest-image/QEMU only — no `gateway-warm.toplevel`, no `--all` fallback. - **The predicates don't exist here either.** No "Finding N/O reviews", no `arc ledger 2026-08-08`, and commit `9fcaf22` (cited as the Finding M fix) is `Not a valid object name` in this repo. The pkexec/elevation code that *does* exist is `internal/toolchain/installer.go` (the supervised nix install — the subject of the sibling issue #340), which is a different surface from the "primer" this issue describes. So there is nothing to harden here. This looks like it was scoped against a different fork/context, or the priming subsystem was never merged into `main` (in which case a prerequisite issue that *builds* the primer is missing from `depends_on`). **A human must decide:** (a) does the priming subsystem belong in `Matou/ourcloud`, and if so which prerequisite issue creates `prime.go` first — re-arm this with that `depends_on`; or (b) this issue belongs elsewhere / is obsolete — close or move it. I have not guessed. Swapping `ready-for-agent` → `ready-for-human`.
Author
Owner

Approved by Ben 2026-08-08 (decision sweep) as scoped: cmd.WaitDelay on the elevation leg + a Detail that distinguishes "answered, then the import itself failed" from an unanswered prompt (seam tests in prime_test.go's style); amend assemble-payload.sh's NOTE and the primer's --all branch comment to state the toplevel-less cost plainly; "90 seconds" over "1m30s" rides along. → ready-for-agent.

Approved by Ben 2026-08-08 (decision sweep) as scoped: `cmd.WaitDelay` on the elevation leg + a Detail that distinguishes "answered, then the import itself failed" from an unanswered prompt (seam tests in `prime_test.go`'s style); amend `assemble-payload.sh`'s NOTE and the primer's `--all` branch comment to state the toplevel-less cost plainly; "90 seconds" over "1m30s" rides along. → `ready-for-agent`.
Author
Owner

Done in 14a7bbe (on origin/main).

1. Answered-at-the-bound. runCombined (internal/toolchain/installer.go) now sets cmd.WaitDelay (elevationWaitGrace, 5s), so CombinedOutput's Wait returns AT the 90s bound with whatever the setuid-root pkexec copy wrote so far, instead of blocking on the pipe until the unkillable (EPERM) root copy reaches EOF. Prime's deadline branch reads that captured output to distinguish "the elevation prompt was answered, but the import itself did not finish" (real evidence present) from "the prompt went unanswered" (nothing left behind) — closing the misreport. New seam test TestPrime_DistinguishesAnAnsweredPromptWhoseImportFailedAtTheBound in prime_test.go's style; the existing unanswered / caller-deadline tests still pass (empty output takes the old branches).

2. Toplevel-less --all cost. scripts/assemble-payload.sh's missing-toplevel NOTE and the primer's --all branch comment (primeCommand) now state plainly that a toplevel-less payload falls back to nix copy --all, which never detects presence (Finding O), draws the daemon refusal, and burns the full 90-second elevation prompt on EVERY drive.

Ride-along: operator-facing Detail renders the bound as "90 seconds", not Duration.String()'s "1m30s" (new humanBound helper + TestHumanBound_RendersSecondsForTheOperatorLine).

Toolchain package tests + go vet + golangci-lint + gofmt clean; full pre-push gate green (internal/vm assemble-payload test passes with CI set). STATUS.md milestone log updated in the same commit.

Done in 14a7bbe (on origin/main). **1. Answered-at-the-bound.** `runCombined` (internal/toolchain/installer.go) now sets `cmd.WaitDelay` (elevationWaitGrace, 5s), so `CombinedOutput`'s Wait returns AT the 90s bound with whatever the setuid-root pkexec copy wrote so far, instead of blocking on the pipe until the unkillable (EPERM) root copy reaches EOF. `Prime`'s deadline branch reads that captured output to distinguish "the elevation prompt was answered, but the import itself did not finish" (real evidence present) from "the prompt went unanswered" (nothing left behind) — closing the misreport. New seam test `TestPrime_DistinguishesAnAnsweredPromptWhoseImportFailedAtTheBound` in prime_test.go's style; the existing unanswered / caller-deadline tests still pass (empty output takes the old branches). **2. Toplevel-less --all cost.** scripts/assemble-payload.sh's missing-toplevel NOTE and the primer's `--all` branch comment (primeCommand) now state plainly that a toplevel-less payload falls back to `nix copy --all`, which never detects presence (Finding O), draws the daemon refusal, and burns the full 90-second elevation prompt on EVERY drive. **Ride-along:** operator-facing Detail renders the bound as "90 seconds", not `Duration.String()`'s "1m30s" (new `humanBound` helper + `TestHumanBound_RendersSecondsForTheOperatorLine`). Toolchain package tests + go vet + golangci-lint + gofmt clean; full pre-push gate green (`internal/vm` assemble-payload test passes with CI set). STATUS.md milestone log updated in the same commit.
ben closed this issue 2026-08-08 19:37:39 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#341
No description provided.