Repository navigation
Description
What's the problem
Part of #4212 acceptance criteria 2 and 3: an update that moves the RigForge pin must deliver the matching binary through the existing signed, Tor-only update path, and a binary that fails its checksum must never be installed — the appliance keeps its previous RigForge version. os/overlay/pithead-sync runs every boot and copies the whole baked tree to /data/rigforge wholesale by top-level name, skipping prebuilt/, which it reseeds by marker (xmrig pattern). A baked Rust binary has no install step and no checksum gate, so today an unverified or half-consistent binary could reach the place root units exec from.
What it impacts
Every boot of rigs and miner-capable appliances (pithead-sync's RigForge leg), every RAUC update that moves RIGFORGE_REF (the bundle already carries /opt, so the bake child is the carrier; this is the install-and-enforce half), and pithead local-miner setup (lib/pithead/14-local-miner.sh), which runs against the synced tree.
How I found it
Required by pithead#4212. Read 2026-11-25: os/overlay/pithead-sync (tree sync and xmrig prebuilt reseed block), lib/pithead/14-local-miner.sh, and the sandboxed pithead-sync cases under tests/stack/appliance/ that drive it through the PITHEAD_SYNC_* env overrides.
How important is it
The enforcement piece of pithead#4212. Root units will exec this binary and rigforge#709 treats a writable or unverified one as a privilege-escalation risk; a botched install that strands the miner is an appliance incident, so refusal must be surgical and loud.
Acceptance criteria
- pithead-sync's RigForge leg treats the baked Rust seed (
prebuilt/rust/plus its recorded.sha256) like the xmrig seed: verify the sha256 before installing; install only to a root-owned, non-writable-by-others location outside the synced tree, path env-overridable like the otherPITHEAD_SYNC_*knobs (default e.g. under/data/pithead/), mode 0755 root:root. - On checksum mismatch: a clear single refusal line naming the failure, the installed binary and the tree sync left untouched, and sync still completes for everything else (an unused binary must never brick boot).
- On checksum pass with a different recorded version than installed (the update case): the new binary is installed — a pin move through the updater delivers the matching binary on the first boot of the new slot.
- Seed absent (every release today): no-op, byte-identical sync behavior to now.
- A tier-1 tests/stack case in the appliance-domain fragment that already sandboxes pithead-sync, RED without the fix and GREEN with, covering: good seed installs; tampered seed keeps the previous installed binary and prints the refusal; absent seed changes nothing; a replaced seed with a valid new checksum installs the new version on the next sync.
Possible solutions
- A
prebuilt/rustblock in the RigForge leg mirroring the xmrig marker-reseed block, usingsha256sum -cagainst the seed's recorded file; refuse-and-continue on mismatch. - Align the install path with the rigforge#707 ADR / rigforge#709 install-location ruling when they land; until then pithead defines it and the battery gate child reads it from there.
Parent: #4212
Worker brief: Test tier: tier1 — a case in the appliance-domain tests/stack fragment that already sandboxes pithead-sync via PITHEAD_SYNC_* env overrides (see tests/stack/appliance/); tiers 1-3 are GitHub's: push early, open the draft PR, read gh pr checks; no bench job is required if the change is confined to pithead-sync and the stack fragment (say so in the PR body). If you also touch os/overlay beyond pithead-sync, add the cheapest tier4-kvm phase via bench-submit --base develop-v2.1.0.
Read first: os/overlay/pithead-sync (full file — the xmrig prebuilt reseed block is the pattern to mirror), tests/stack/appliance/ fragments that drive pithead-sync in a sandbox, lib/pithead/14-local-miner.sh (consumer context only). Parent: pithead#4212 (its AC2 and AC3). Conforming contract: rigforge#709 — the installed binary must be root-owned and not writable by any non-root user; keep the location outside the synced tree.
Behavior spec: verify the prebuilt/rust seed against its recorded .sha256 before installing; install 0755 root:root to a root-owned path outside the tree, env-overridable (new PITHEAD_SYNC_* knob); reseed when the recorded checksum/version differs from what is installed (this is the update-delivery case); on mismatch print one loud refusal line and change nothing (installed binary and tree sync untouched, sync still succeeds); absent seed is a no-op. Tests must be RED without the fix: good seed installs, tampered seed keeps the previous version and prints the refusal, absent seed no-ops, replaced valid seed installs the new version. Shell gates on this Mac need Homebrew bash + GNU grep/sed on PATH. No comments in code. Before the PR run make lint-file-budget and make lint-pithead-build. Reference pithead#4212 and rigforge#709 fully qualified.
Activity
pithead-sync: bind the checksum to the seed file, refuse symlinks, re…
tests: source the sync-binary fragment from the baked-images fragment…
tests: put the sync-binary cases in the baked-images fragment so run.…
tests: shfmt the baked-images fragment (#4532)
pithead-developer commentedon Dec 4, 2026
Blocked on #4676. The tier4-kvm job on head 8d7abac cannot be submitted yet, so no bench evidence has been added to the PR.
bench-submitrefused with "held: tier1/tier2 not passed for the head" because three checks are not green. Build image (tor) fails Trivy on busybox CVE-2026-140044, tracked in pithead#4676. Build image (dashboard) fails Trivy on libzstd1 CVE-2026-124851, tracked in pithead#4644. The macOS soak self-test was cancelled by GitHub and is not a test failure. None of the three touches this diff. Done so far: the code, 31 tier-1 cases, docs and the security review. The shell suite blocks and shell lint pass on this head. To unblock, pithead#4676 and #4644 must land on develop-v2.1.0. Then I merge the base in and submittier4-kvmwithphases=booton the new head. I'll paste the uneditedbench-ci evidenceblock into the PR body. The image has no Rust seed yet, so that job proves the absent-seed no-op on a real boot. The seed paths are proved by the tier-1 cases. I posted this explanation on PR #4685.The runner resumes this issue when that one closes.