Repository navigation
1bit-update --latest: install only the release it asked for, newer than this one - read from the VERIFIED image (rollback protection, security) - #3454
Conversation
…t-update; /data/updates must be root-only (security) Security review (cl-npuconc via the orchestrator, 24 Nov): the root-run updater used a FIXED, world-writable-parent path, /tmp/1bit-update, for releases.json, check.err, the ESP mount, the image's data-partition mount and sums. A directory or symlink planted there in advance decides where root writes, mounts and reads back. - work_dir: one directory per run from mktemp -d (a fresh random name, created atomically with mode 0700; nothing pre-existing is followed): under /run for root (root's own tmpfs; /tmp is world-writable and on Puppy a symlink), under $TMPDIR for a person's --check. Every former /tmp/1bit-update path is $WORK/.... - work_done removes it at exit, AFTER the image and ESP are unmounted, and never while a mount is left inside it (the ESP is mounted there: rm -rf over a live mount would empty the ESP). - safe_dir for /data/updates and each /data/updates/<tag>: created 0700; an existing one is accepted only as a real directory (not a symlink) owned by root and not group/other-writable - /data is shared with people's files. tests/update_workdir_test.sh (new, ctest update_workdir): a symlink planted at the old path receives nothing, the work dir is gone after the run, it is new/0700/random (under /run as root, $TMPDIR otherwise) and never shared; safe_dir refuses a symlink (target untouched), a non-root owner, a file. Passes as a user AND as root (CI's container), dash + busybox ash; update_check/latest/shadow and one_bit_update_slots: ok as user and root. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…an this one - read from the VERIFIED image (rollback protection, security) Security review (cl-kernel via the orchestrator, 24 Nov): --latest trusted GitHub's tag_name, which is not signed. An old, genuinely signed image re-published under a newer tag would pass verify-image and install - a rollback to a release with known holes. - update_latest records what it asked for (tag, channel, running release); expect_tag starts empty in every run, so the environment can never set it. - After the image's own files are verified and BEFORE a byte is written to the other slot, the install reads the tag the image carries (etc/1bit/release-identity inside its puppy_*.sfs, unsquashfs -cat) and update_identity_check refuses: no identity; a tag other than the one asked for (the re-published image); not STRICTLY newer than the running release (vYYYY.WW[-rcN], a final after its own rcs: update_ver_gt); an -rc on the stable channel; no running identity to compare with. 1bit-update <image> and --rollback stay deliberate, manual downgrades. tests/update_identity_test.sh (new, ctest update_identity): every refusal, the two installs, version order, the tag read out of a real puppy_*.sfs, expect_tag initialised: 11/11 under dash (env -i), busybox ash and as root. update_check / update_latest / update_workdir: ok. Stacked on #3451 (private work dir). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
LGTM (cl-kernel, the reviewer of record for the rollback finding; reviewed at head This closes the rollback hole I raised on #3442/#3447. I tested the function and the wiring: the PR's own tests source the script as a library, so they don't exercise the install path. End to end, on a loop-mounted installed disk (ryzen, as root, my
Ordering (read): the image is loop-mounted read-only (~681-687), then the set's files are hash-checked against the image's own Also checked:
Nits, not blocking (a follow-up is fine):
🤖 Generated with Claude Code |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
…eftover work dir, and say so (follow-up to #3454) (#3461) cl-kernel on #3457: /run on 1bit OS is a directory on the root overlay, whose upper is the persistent save layer in PUPMODE 12, not a tmpfs. The private work dir (#3451, merged in #3454) is removed by work_done at exit, but a run that dies before that (power cut, kill -9) leaves /run/1bit-update.XXXXXX in the save layer for good. - work_sweep, at the start of every run, removes such leftovers in the same base: only 1bit-update.* entries that are real directories (never a symlink), owned by this uid, older than a day, and with no mount left inside them (a crashed run's ESP mount would otherwise be emptied). - The work-dir comment no longer calls /run a tmpfs; it is chosen because it is root-only. tests/update_workdir_test.sh +1: a day-old leftover is removed, a fresh dir is kept, a symlink is never followed (its target untouched). ok under dash (env -i), busybox ash and as root; update_check/latest/identity: ok. Co-authored-by: bong-water-water-bong <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…o, and draft the freeze RFC (engine#3448) Security review (cl-flm lane, 24 Nov). Issue #3448 has two halves. The rollback half is fixed by #3454 (69bb03f): --latest reads the release identity from inside the verified image and refuses anything that is not the tag asked for and strictly newer. The freeze half is open, and it is a release-trust decision (CONTRIBUTING.md: anything touching security is an RFC), so this commit does NOT invent a fix for it: it stops the tool from claiming the freshness it cannot prove, and puts the decision on record. Rebased onto origin/main a95beca (after #3465/#3466/#3467); the line references below are that tree's. The mechanism, as it stands (os/v3/puppy/embed/usr/local/bin/1bit-update): - update_pick decides which release is the channel's newest and whether it is newer than the running one, from GitHub's release list (:257-302). That list is not signed; the first signature is checked at :453-455, after the "is it newer" decision, and the early exit says "up to date" without checking any signature (:430-438). So a release host that keeps serving the current release also keeps the machine answering "up to date" (freeze). What changed: - update_pick prints ahead=yes when the RUNNING release is newer than the channel's newest (a final against its own -rcs, or a channel that has not caught up), which used to be folded into newer=no (:291-295). - update_check and update_latest answer that case "up to date: running X is newer than the CHANNEL's newest Y" and print one note that the answer is the unsigned release list's word, so a host that hides a newer release is not detectable (:328-336, :430-438). A plain "up to date" line is kept for the same-tag case, so the console, the notice and the board rows keep reading it. - docs/update-trust.md (new): what the signature covers today (tools/release_sign.py), the exact order --latest decides in with file:line, what #3454 closed and what it leaves open, the freeze threat model (adversaries, in/out of scope, P1-P3), and the draft RFC body: options A (signed, expiring latest per channel reusing release_sign.py), B (TUF-style metadata), C (signed tag -> commit), D (tag+channel in the signed SHA256SUMS), E (accept the risk), each with its trust assumptions and cost, the test plan and the NOTICE impact, and the open owner questions. - docs/os-v3.md, "In-system updates": a paragraph after the trust order saying what the order does not prove - freeze, with the release-list/commit/rollback facts - and pointing at the draft. - tests/update_check_test.sh: two arms (the ahead wording, the note), and the existing "a final release sorts after its own release candidates" arm now asserts the ahead wording, which is what the tool says there now. os/mini/release-check.sh --self-test gains that same output as a PASS fixture, so the update-check row still recognises the answer on the board. What remains open, and is the RFC's first question: is a compromised release host (freeze) in the threat model? If yes, option A is the recommendation; if no, record that in docs/os-v3.md and close #3448. No code in this commit closes it - the honest wording says exactly that. Evidence: - Control (new test, PRE-FIX updater from origin/main a95beca): c=~/.cache/scratch-3448/control; mkdir -p $c/tests $c/os/v3/puppy/embed/usr/local/bin git show origin/main:os/v3/puppy/embed/usr/local/bin/1bit-update > $c/os/v3/puppy/embed/usr/local/bin/1bit-update cp tests/update_check_test.sh $c/tests/ (cd $c && sh tests/update_check_test.sh) FAIL a final release sorts after its own release candidates (v2026.49 > v2026.49-rc1) FAIL a running release newer than the channel's newest is said as ahead, not as a flat 'up to date' FAIL the up-to-date answer names the unsigned release list it rests on, and what that cannot detect update_check_test: FAIL - Branch: sh tests/update_check_test.sh -> "update_check_test: ok" (12 arms). - Sanity: the same control tree with origin/main's own test and updater -> "update_check_test: ok" (only the arms this change adds or re-words differ). - ctest --test-dir build -R 'update|release_check_selftest|release_sign' --output-on-failure --timeout 600: "100% tests passed, 0 tests failed out of 12" (update_e2e_loop skipped: needs root/loop, unchanged). - scripts/pre-pr-checks.sh --tree-only --base origin/main: "pre-pr-checks: all 15 check(s) green, 3 skipped, 0 could not be told, 2 open-PR row(s) not run (--tree-only)"; skips: submodule_pin (0 submodules initialised), hip_f16_audit and kernel_id_selftest (no gpu-kernels tree). Refs #3448.
…o, and draft the freeze RFC (engine#3448) (#3474) Security review (cl-flm lane, 24 Nov). Issue #3448 has two halves. The rollback half is fixed by #3454 (69bb03f): --latest reads the release identity from inside the verified image and refuses anything that is not the tag asked for and strictly newer. The freeze half is open, and it is a release-trust decision (CONTRIBUTING.md: anything touching security is an RFC), so this commit does NOT invent a fix for it: it stops the tool from claiming the freshness it cannot prove, and puts the decision on record. Rebased onto origin/main a95beca (after #3465/#3466/#3467); the line references below are that tree's. The mechanism, as it stands (os/v3/puppy/embed/usr/local/bin/1bit-update): - update_pick decides which release is the channel's newest and whether it is newer than the running one, from GitHub's release list (:257-302). That list is not signed; the first signature is checked at :453-455, after the "is it newer" decision, and the early exit says "up to date" without checking any signature (:430-438). So a release host that keeps serving the current release also keeps the machine answering "up to date" (freeze). What changed: - update_pick prints ahead=yes when the RUNNING release is newer than the channel's newest (a final against its own -rcs, or a channel that has not caught up), which used to be folded into newer=no (:291-295). - update_check and update_latest answer that case "up to date: running X is newer than the CHANNEL's newest Y" and print one note that the answer is the unsigned release list's word, so a host that hides a newer release is not detectable (:328-336, :430-438). A plain "up to date" line is kept for the same-tag case, so the console, the notice and the board rows keep reading it. - docs/update-trust.md (new): what the signature covers today (tools/release_sign.py), the exact order --latest decides in with file:line, what #3454 closed and what it leaves open, the freeze threat model (adversaries, in/out of scope, P1-P3), and the draft RFC body: options A (signed, expiring latest per channel reusing release_sign.py), B (TUF-style metadata), C (signed tag -> commit), D (tag+channel in the signed SHA256SUMS), E (accept the risk), each with its trust assumptions and cost, the test plan and the NOTICE impact, and the open owner questions. - docs/os-v3.md, "In-system updates": a paragraph after the trust order saying what the order does not prove - freeze, with the release-list/commit/rollback facts - and pointing at the draft. - tests/update_check_test.sh: two arms (the ahead wording, the note), and the existing "a final release sorts after its own release candidates" arm now asserts the ahead wording, which is what the tool says there now. os/mini/release-check.sh --self-test gains that same output as a PASS fixture, so the update-check row still recognises the answer on the board. What remains open, and is the RFC's first question: is a compromised release host (freeze) in the threat model? If yes, option A is the recommendation; if no, record that in docs/os-v3.md and close #3448. No code in this commit closes it - the honest wording says exactly that. Evidence: - Control (new test, PRE-FIX updater from origin/main a95beca): c=~/.cache/scratch-3448/control; mkdir -p $c/tests $c/os/v3/puppy/embed/usr/local/bin git show origin/main:os/v3/puppy/embed/usr/local/bin/1bit-update > $c/os/v3/puppy/embed/usr/local/bin/1bit-update cp tests/update_check_test.sh $c/tests/ (cd $c && sh tests/update_check_test.sh) FAIL a final release sorts after its own release candidates (v2026.49 > v2026.49-rc1) FAIL a running release newer than the channel's newest is said as ahead, not as a flat 'up to date' FAIL the up-to-date answer names the unsigned release list it rests on, and what that cannot detect update_check_test: FAIL - Branch: sh tests/update_check_test.sh -> "update_check_test: ok" (12 arms). - Sanity: the same control tree with origin/main's own test and updater -> "update_check_test: ok" (only the arms this change adds or re-words differ). - ctest --test-dir build -R 'update|release_check_selftest|release_sign' --output-on-failure --timeout 600: "100% tests passed, 0 tests failed out of 12" (update_e2e_loop skipped: needs root/loop, unchanged). - scripts/pre-pr-checks.sh --tree-only --base origin/main: "pre-pr-checks: all 15 check(s) green, 3 skipped, 0 could not be told, 2 open-PR row(s) not run (--tree-only)"; skips: submodule_pin (0 submodules initialised), hip_f16_audit and kernel_id_selftest (no gpu-kernels tree). Refs #3448. Co-authored-by: bong-water-water-bong <[email protected]>
Security fix 1 of 2 that must land before any image ships the updater (orchestrator, from cl-kernel's review). Stacked on #3451, the private work dir: this branch contains #3451's commit, so merge #3451 first and this diff shrinks to its own commit.
The problem:
--latesttrusted GitHub'stag_name, which is not signed. An old, genuinely signed image re-published under a newer tag passesverify-image(its signature and digest are real) and would install: a rollback to a release with known holes.The fix:
update_latestrecords what it asked for (tag, channel, running release).expect_tagis initialised empty in every run, so the environment can never set it.etc/1bit/release-identityinside itspuppy_*.sfs, viaunsquashfs -cat, the same way the shadow code already reads it.update_identity_checkrefuses:vYYYY.WW[-rcN], a final after its own rcs (update_ver_gt);-rcon the stable channel;1bit-update <image>and--rollbackstay deliberate, manual downgrades.Measured:
tests/update_identity_test.sh(new, ctestupdate_identity) covers every refusal above, the two cases that install (newer stable, rc on test), the version order, the tag read out of a realpuppy_*.sfsbuilt withmksquashfs, andexpect_taginitialised. 11/11 under dash (env -i), busybox ash and as root.update_check,update_latestandupdate_workdir: ok. Pre-PR checks after committing: 17 green, 3 skipped.🤖 Generated with Claude Code