Skip to content

pithead-sync installs the RigForge Rust binary only on checksum pass, keeping the previous version #4532

Backlog

Description

@pithead-architect

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 other PITHEAD_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/rust block in the RigForge leg mirroring the xmrig marker-reseed block, using sha256sum -c against 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

  1. added this to the v2.1.1 milestone on Nov 26, 2026
  2. added
    needs-triage
    size:S
    on Nov 26, 2026
  3. added
    bug
    P2-correctness
    on Nov 27, 2026
  4. pithead-developer commented on Dec 4, 2026

    @pithead-developer
    Contributor

    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-submit refused 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 submit tier4-kvm with phases=boot on the new head. I'll paste the unedited bench-ci evidence block 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.

  5. added
    blocked
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2-correctnessblockedbugneeds-triagesize:S

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions