From 94654f45e9f5a65659a5b578433568fe28fc4116 Mon Sep 17 00:00:00 2001 From: pi-os3 Date: Sun, 8 Nov 2026 20:35:17 -0400 Subject: [PATCH 1/4] os/mini: the release check gains the class-4 row - a builder path delivered as the FILESYSTEM LAYOUT The first three leak classes are about content: a path in a map or a debug string, a build tree packaged as bytes, a symbol table. The fourth is the path delivered as the layout. The mini image shipped `bin/1bit` as an ABSOLUTE symlink to /home//wt/issue-709-build/1bit, so the image carried the builder's home as a directory and every content check passed. Nothing in the shipped gate could see it: release-check.sh had rows for the launcher hash, the RUNPATH, the payload modes and the base-layer modes, and none of them looks at what a symlink points at. The row reports "PASS/FAIL payload-home-layout", in the same shape as the payload-runpath row beside it, over the same unpacked payload ($PAYLOAD_DIR, default /opt/1bit-package). The discriminator is measured rather than assumed, on the shipped c33 SFS and on the leaking mini image: an absolute symlink whose target RESOLVES TO A FILE under home|Users|root - 0 in the c33 payload, 1 in the leaking image. Two neighbouring shapes are named and NOT failed, because both are legitimate and either would be a permanent red: * a target that is a DIRECTORY - `root/spot -> /home/spot` is a home on /data; * a target that is ABSENT - a payload scanned on a build host resolves links against that host, so an image directory that lives at /data looks missing here. Failing that would red on the wrong machine, and it is why the FAIL set is "resolves to a FILE" and not "is absolute". A vacuous PASS was the other failure mode to close: the row sits inside the existing `[ -d "$RUNDIR" ]` else-branch, so a host without the payload SKIPs (as the runpath row does) instead of reporting a green over nothing. Verification, all on this branch: os/mini/release-check.sh --self-test rc=0, 127 assertions (main: 123) - the four new ones are three verdict cases and the scanner on a synthetic tree synthetic payload trees, end to end relative `../opt/1bit/1bit` -> scanner silent; absolute -> /home/...FILE -> files=1 (FAIL); absolute -> /home/spot (absent here) -> others=1 (PASS, named) tools/copyright.py --check rc=0 Known gap, not introduced here: no test in tests/ or .github/ runs release-check.sh --self-test, so the 127 assertions are run by hand and at cut time rather than in CI. Worth a one-line test; it is not this PR's subject. --- os/mini/release-check.sh | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/os/mini/release-check.sh b/os/mini/release-check.sh index 3857b409c..6f018a43d 100755 --- a/os/mini/release-check.sh +++ b/os/mini/release-check.sh @@ -780,6 +780,48 @@ payload_runpath_verdict() { fi } +# ── the payload's home-path LAYOUT (engine#1543, the fourth leak class) ───────────────────────────────────────── +# The first three classes are about CONTENT - a path compiled into a map or a debug string, a build tree packaged as +# bytes, a symbol table. The fourth is the path delivered as the FILESYSTEM LAYOUT: `bin/1bit` was an ABSOLUTE symlink +# to /home//wt/issue-709-build/1bit, so the image shipped the builder's home as a directory and every content +# check passed. Discriminator measured on the shipped c33 SFS and on the leaking mini image: an absolute symlink whose +# target RESOLVES TO A FILE under home|Users|root (0 in c33, 1 in the leaking image). Targets that are a directory or +# absent are named but not failed - `root/spot -> /home/spot` is legitimate, and a payload scanned on a build host +# cannot tell an image directory from a missing one. +payload_home_layout_bad() { # -> "relpath|TARGET|file|dir|dangling" per absolute home-targeting link + python3 - "$1" 2>/dev/null <<'PYSCAN' +import os, sys +root = sys.argv[1] +HOMES = ('/home/', '/Users/', '/root/') +for dp, dns, fns in os.walk(root): + for n in sorted(dns + fns): + p = os.path.join(dp, n) + if not os.path.islink(p): + continue + t = os.readlink(p) + if not t.startswith('/') or not t.startswith(HOMES): + continue + kind = 'file' if os.path.isfile(p) else ('dir' if os.path.isdir(p) else 'dangling') + print('%s|%s|%s' % (os.path.relpath(p, root), t, kind)) +PYSCAN +} + +payload_home_layout_verdict() { # [] + _bad=${1:-} _other=${2:-} _s=${3:-} + case "${_bad}:${_other}" in + *[!0-9:]*) printf 'FAIL the home-path links in the payload could not be counted (%s:%s)' "${_bad:-empty}" "${_other:-empty}"; return 0 ;; + esac + if [ "$_bad" != 0 ]; then + printf 'FAIL %s absolute symlink(s) in the payload point into a home directory at a FILE%s - the image ships the build tree as its layout and no content check can see it' \ + "$_bad" "${_s:+: $_s}" + elif [ "$_other" != 0 ]; then + printf 'PASS no payload symlink resolves to a builder FILE (0); %s name a home directory or an absent target%s - not this class, named so the count travels' \ + "$_other" "${_s:+: $_s}" + else + printf "PASS no absolute symlink in the payload points into a home directory: the payload's layout carries no builder path" + fi +} + # --self-test: assert the lemonade verdict on the cases that matter (tests/release_check_row.sh runs # this in CI). The unprepared-stick case is the one that used to false-PASS: 200 with the key, an empty # body and no status without it. @@ -820,6 +862,16 @@ if [ "${1:-}" = --self-test ]; then check FAIL "$(followup_verdict '{"choices":[{"finish_reason":"length"}]}' '{"choices":[{"message":{"content":"1BIT"}}]}' 0 0)" check PASS "$(followup_verdict '{"choices":[{"finish_reason":"length"}]}' '{"choices":[{"message":{"content":"1BIT OK"},"finish_reason":"length"}]}' '' '')" # the RUNPATH rule (2026-11-08 incident): $ORIGIN only, and RPATH is always a fail. + check PASS "$(payload_home_layout_verdict 0 0 '')" + check FAIL "$(payload_home_layout_verdict 1 0 'bin/1bit|/home/x/wt/issue-709-build/1bit|file')" + check PASS "$(payload_home_layout_verdict 0 1 'root/spot|/home/spot|dangling')" + _hl_st=$(mktemp -d) + mkdir -p "$_hl_st/bin" "$_hl_st/opt" + ln -s /home/nonexistent-xyz/wt/build/1bit "$_hl_st/bin/leak" # the class: absolute, target absent + ln -s ../opt/1bit/1bit "$_hl_st/bin/rel" # relative: not this class + ln -s /home/nonexistent-xyz "$_hl_st/opt/home" # a home directory target: named, not failed + check "bin/leak|/home/nonexistent-xyz/wt/build/1bit|dangling" "$(payload_home_layout_bad "$_hl_st" | grep '^bin/leak|')" + rm -rf "$_hl_st" check PASS "$(payload_runpath_verdict 0)" check FAIL "$(payload_runpath_verdict 3 '/opt/1bit-package/1bit/1bit runs /home/x/wt/release-rc/work/build')" check FAIL "$(payload_runpath_verdict 1)" @@ -2136,6 +2188,20 @@ else PASS*) pass payload-runpath "${RP#PASS }" ;; *) fail payload-runpath "${RP#FAIL }" ;; esac + # the layout class runs on the same unpacked payload, right after the content classes + _hl_bad=$(payload_home_layout_bad "$RUNDIR" 2>/dev/null); _hl_rc=$? + if [ "$_hl_rc" = 2 ]; then + skip payload-home-layout "the payload's symlinks could not be read here - that is not evidence" + else + _hl_nf=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | awk -F'|' '$3 == "file"' | wc -l) + _hl_no=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | awk -F'|' '$3 != "file"' | wc -l) + _hl_s=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | head -3 | tr '\n' ' ') + HL=$(payload_home_layout_verdict "${_hl_nf:-0}" "${_hl_no:-0}" "${_hl_s:-}") + case "$HL" in + PASS*) pass payload-home-layout "${HL#PASS }" ;; + *) fail payload-home-layout "${HL#FAIL }" ;; + esac + fi fi fi From d55624def17b84ea914c5264d1997384e3113779 Mon Sep 17 00:00:00 2001 From: pi-os3 Date: Sun, 8 Nov 2026 20:42:19 -0400 Subject: [PATCH 2/4] os/mini: the class-4 row fails a DANGLING home path too, and only a DIRECTORY target passes Review point, taken: counting `dangling` in the PASS set left a hole with the same shape as the one this row exists for. A `bin/1bit -> /home//wt/build/onebit` whose target was not carried still ships the builder's username and workdir AS THE LAYOUT - the disclosure is the path, not the file behind it - and it is the worse failure to stand up, because nothing loads and the engine registers no device on an otherwise fine boot. So the FAIL set is now a FILE target OR a target that is not there; a DIRECTORY target is the only PASS, and it is named in the green line so the count travels. Measured before changing the rule, on the shipped c33 image (data partition mounted read-only, `unsquashfs -ll` of the puppy SFS, 55,669 entries): whole rootfs, absolute symlinks into home|Users|root 1 `root/spot -> /home/spot` (a DIRECTORY) inside opt/1bit-package (the row's scope) 0 so the stricter rule costs nothing on today's artifact. The residual risk is named rather than hidden: a payload that legitimately names a home DIRECTORY whose target is absent on the machine running the check is indistinguishable from a dangling builder path and would FAIL. That is zero today; if it ever stops being zero the fix is to pass the image root into the row, not to weaken it. Proven end to end with the extracted scanner and verdict (four synthetic trees plus the real builder tree that still exists on this host): relative ../opt/1bit/1bit -> no output -> PASS /home/bcloud/wt/issue-709-build/1bit (a FILE) -> kind=file -> FAIL /home/nonexistent-xyz/wt/build/onebit -> kind=dangling -> FAIL /home/spot (a directory, absent here) -> kind=dangling -> FAIL (see residual risk) os/mini/release-check.sh --self-test: rc=0, 128 assertions (main 123). --- os/mini/release-check.sh | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/os/mini/release-check.sh b/os/mini/release-check.sh index 6f018a43d..5e6d2b402 100755 --- a/os/mini/release-check.sh +++ b/os/mini/release-check.sh @@ -806,17 +806,22 @@ for dp, dns, fns in os.walk(root): PYSCAN } -payload_home_layout_verdict() { # [] - _bad=${1:-} _other=${2:-} _s=${3:-} - case "${_bad}:${_other}" in - *[!0-9:]*) printf 'FAIL the home-path links in the payload could not be counted (%s:%s)' "${_bad:-empty}" "${_other:-empty}"; return 0 ;; +payload_home_layout_verdict() { # [] + _bad=${1:-} _dir=${2:-} _s=${3:-} + case "${_bad}:${_dir}" in + *[!0-9:]*) printf 'FAIL the home-path links in the payload could not be counted (%s:%s)' "${_bad:-empty}" "${_dir:-empty}"; return 0 ;; esac + # FAIL on a FILE target AND on a target that is NOT THERE. A dangling `bin/1bit -> /home//wt/build/onebit` + # is the leak twice over: the disclosure IS the path (the image still ships the builder's username and workdir as its + # layout), and it is the worse failure to stand up - nothing to load, so the engine registers no device on an + # otherwise fine boot. Only a DIRECTORY target is a different, legitimate thing (`root/spot -> /home/spot`, a home + # on /data): measured on the shipped c33 image, the whole rootfs has exactly one of those and the payload has none. if [ "$_bad" != 0 ]; then - printf 'FAIL %s absolute symlink(s) in the payload point into a home directory at a FILE%s - the image ships the build tree as its layout and no content check can see it' \ + printf 'FAIL %s absolute symlink(s) in the payload point into a home directory at a file or at nothing%s - the image ships the builder path as its layout and no content check can see it' \ "$_bad" "${_s:+: $_s}" - elif [ "$_other" != 0 ]; then - printf 'PASS no payload symlink resolves to a builder FILE (0); %s name a home directory or an absent target%s - not this class, named so the count travels' \ - "$_other" "${_s:+: $_s}" + elif [ "$_dir" != 0 ]; then + printf 'PASS no payload symlink points at a builder file or at nothing (0); %s name a home DIRECTORY%s, which is a home on /data and not this class' \ + "$_dir" "${_s:+: $_s}" else printf "PASS no absolute symlink in the payload points into a home directory: the payload's layout carries no builder path" fi @@ -864,7 +869,8 @@ if [ "${1:-}" = --self-test ]; then # the RUNPATH rule (2026-11-08 incident): $ORIGIN only, and RPATH is always a fail. check PASS "$(payload_home_layout_verdict 0 0 '')" check FAIL "$(payload_home_layout_verdict 1 0 'bin/1bit|/home/x/wt/issue-709-build/1bit|file')" - check PASS "$(payload_home_layout_verdict 0 1 'root/spot|/home/spot|dangling')" + check FAIL "$(payload_home_layout_verdict 1 0 'bin/1bit|/home/x/wt/build/onebit|dangling')" + check PASS "$(payload_home_layout_verdict 0 1 'root/spot|/home/spot|dir')" _hl_st=$(mktemp -d) mkdir -p "$_hl_st/bin" "$_hl_st/opt" ln -s /home/nonexistent-xyz/wt/build/1bit "$_hl_st/bin/leak" # the class: absolute, target absent @@ -2193,10 +2199,11 @@ else if [ "$_hl_rc" = 2 ]; then skip payload-home-layout "the payload's symlinks could not be read here - that is not evidence" else - _hl_nf=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | awk -F'|' '$3 == "file"' | wc -l) - _hl_no=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | awk -F'|' '$3 != "file"' | wc -l) - _hl_s=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | head -3 | tr '\n' ' ') - HL=$(payload_home_layout_verdict "${_hl_nf:-0}" "${_hl_no:-0}" "${_hl_s:-}") + _hl_nf=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | awk -F'|' '$3 != "dir"' | wc -l) + _hl_nd=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | awk -F'|' '$3 == "dir"' | wc -l) + _hl_s=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | awk -F'|' '$3 != "dir"' | head -3 | tr '\n' ' ') + [ "$_hl_nf" = 0 ] && [ -n "$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d')" ] && _hl_s=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | head -2 | tr '\n' ' ') +HL=$(payload_home_layout_verdict "${_hl_nf:-0}" "${_hl_no:-0}" "${_hl_s:-}") case "$HL" in PASS*) pass payload-home-layout "${HL#PASS }" ;; *) fail payload-home-layout "${HL#FAIL }" ;; From 9ab1ea3efe66dc9a25a9117923363e6fbe763ff4 Mon Sep 17 00:00:00 2001 From: pi-os3 Date: Sun, 8 Nov 2026 20:53:35 -0400 Subject: [PATCH 3/4] os/mini: run the release check's self-test in CI - the 128 assertions had no runner The row in this PR is asserted by `os/mini/release-check.sh --self-test`, and nothing anywhere ran it: not `tests/`, not `.github/workflows/`. A gate whose own assertions never execute is a gate reviewed by reading, which is how a row comes to pass over an empty directory (measured twice this week, once by me and once by #1599 on the payload rows). One `add_test`, and it is the only one here that takes **no `$`**: the subject is the verdict functions, so it needs no build, no device and no network. CI already runs `ctest --test-dir build --output-on-failure`, so this needs no workflow file - which matters, because **no lane on this fleet can edit `.github/workflows/ci.yml`**: the token scopes are `gist, read:org, repo`, and GitHub refuses workflow edits from an OAuth app without `workflow`. That is the fleet fact that made the "just add a ci.yml step" answer unavailable to both lanes that reached for it. It also does not touch the direction-B measurement (#1595): an `add_test` whose COMMAND is a script names no `add_executable`, so it adds nothing to the set of test targets the CI `--target` list would have to build. Verified by configuring and running, with nothing built: cmake -S . -B /tmp/cfg rc=0, configuring done ctest -R '^release_check_selftest$' 1/1 Test #9: release_check_selftest ... Passed 0.46 sec and the negative, on a copy with one assertion inverted: broken copy rc=1 FAIL want PASS, got: FAIL 1 absolute symlink(s) ... good copy rc=0 --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 288321f6a..0981bbb39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,6 +203,11 @@ add_test(NAME print_backend COMMAND ${CMAKE_SOURCE_DIR}/tests/print_backend.sh $ add_test(NAME lemonade_hrx COMMAND ${CMAKE_SOURCE_DIR}/tests/lemonade_hrx.sh $) add_test(NAME parallel_args COMMAND ${CMAKE_SOURCE_DIR}/tests/parallel_args.sh $) add_test(NAME recipes_route COMMAND ${CMAKE_SOURCE_DIR}/tests/recipes_route.sh $) +# os/mini/release-check.sh --self-test: the shipped release gate's own verdict rows, asserted (engine#1596). It needs no +# build and no device - the subject is the row functions - so it is the one test here that takes no $, and +# it is here because nothing else runs it: the rows had 128 assertions and no runner. It names no add_executable, so it +# adds nothing to the set of test targets the CI --target list would have to build (the direction-B measurement, #1595). +add_test(NAME release_check_selftest COMMAND bash ${CMAKE_SOURCE_DIR}/os/mini/release-check.sh --self-test) add_test(NAME template_pin COMMAND ${CMAKE_SOURCE_DIR}/tests/template_pin.sh $) add_test(NAME greedy_shortcut COMMAND ${CMAKE_SOURCE_DIR}/tests/greedy_shortcut.sh $) add_test(NAME device_route COMMAND ${CMAKE_SOURCE_DIR}/tests/device_route.sh $) From 234a4fe5230a4c3fd83c45ebb71e9f0e22a41999 Mon Sep 17 00:00:00 2001 From: pi-os3 Date: Sun, 8 Nov 2026 21:01:59 -0400 Subject: [PATCH 4/4] os/mini: the layout row checks its subject, and checks it in the right order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The row passed over an empty payload: with no entries there are no symlinks to judge, so it printed "no absolute symlink in the payload points into a home directory" over nothing. #1599 measured the same in the other two payload rows, and the ordering there is the part worth copying carefully: absent payload dir -> SKIP, because the checker was handed nothing present but empty -> FAIL, because an appliance with an empty payload is broken real payload -> the row, exactly once Existence first, subject second, row third, in one if/elif/elif/else chain - so a subject failure can never fall through and print a green line under a red one. (On #1599's head the runpath guard fails and the row still runs, printing FAIL and PASS with the same name in one transcript, and there the absent case gets FAIL *and* SKIP because `elif [ ! -d ]` after a `< 100 entries` test is dead code. Same class of mistake, so this follows the shape rather than the letter.) The block also moves out of the runpath row's else-branch: it was nested there, which meant a host with no payload never reached it at all - measured as zero rows printed. Verified against the real script, one case each (PAYLOAD_DIR override): /nonexistent-payload-xyz rows=1 SKIP empty dir rows=1 FAIL holds fewer than 100 entries … /tmp/payload-extract/…/opt/1bit-package (258 entries) rows=1 PASS same + one injected builder link rows=1 FAIL 1 absolute symlink(s) … at a file or at nothing and --self-test stays rc=0, 128 assertions. --- os/mini/release-check.sh | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/os/mini/release-check.sh b/os/mini/release-check.sh index 5e6d2b402..26af8a251 100755 --- a/os/mini/release-check.sh +++ b/os/mini/release-check.sh @@ -2194,24 +2194,32 @@ else PASS*) pass payload-runpath "${RP#PASS }" ;; *) fail payload-runpath "${RP#FAIL }" ;; esac - # the layout class runs on the same unpacked payload, right after the content classes - _hl_bad=$(payload_home_layout_bad "$RUNDIR" 2>/dev/null); _hl_rc=$? - if [ "$_hl_rc" = 2 ]; then - skip payload-home-layout "the payload's symlinks could not be read here - that is not evidence" - else - _hl_nf=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | awk -F'|' '$3 != "dir"' | wc -l) - _hl_nd=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | awk -F'|' '$3 == "dir"' | wc -l) - _hl_s=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | awk -F'|' '$3 != "dir"' | head -3 | tr '\n' ' ') - [ "$_hl_nf" = 0 ] && [ -n "$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d')" ] && _hl_s=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | head -2 | tr '\n' ' ') -HL=$(payload_home_layout_verdict "${_hl_nf:-0}" "${_hl_no:-0}" "${_hl_s:-}") - case "$HL" in - PASS*) pass payload-home-layout "${HL#PASS }" ;; - *) fail payload-home-layout "${HL#FAIL }" ;; - esac - fi fi fi +# The layout row gets the same subject check as the other payload rows (engine#1599 measured why): existence first, +# so a host that simply has no payload SKIPs, then the subject, so an empty or interrupted unpack FAILs rather than +# passing over nothing, and only then the row itself - once, in the else, so a subject failure never falls through. +_HL_DIR=${PAYLOAD_DIR:-/opt/1bit-package} +if [ ! -d "$_HL_DIR" ]; then + skip payload-home-layout "no $_HL_DIR on this system: the payload is not unpacked where an appliance keeps it, so its symlinks cannot be judged here - that is not evidence" +elif [ "$(find "$_HL_DIR" -mindepth 1 2>/dev/null | wc -l)" -lt 100 ]; then + fail payload-home-layout "the payload at $_HL_DIR holds fewer than 100 entries - an empty or interrupted unpack has no layout to judge, and a green row here would be a pass over nothing (c33: 263 entries)" +elif ! command -v python3 >/dev/null 2>&1; then + skip payload-home-layout "no python3 here, so the payload's symlinks cannot be read - that is not evidence" +else + _hl_bad=$(payload_home_layout_bad "$_HL_DIR" 2>/dev/null) + _hl_nf=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | awk -F'|' '$3 != "dir"' | wc -l) + _hl_nd=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | awk -F'|' '$3 == "dir"' | wc -l) + _hl_s=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | awk -F'|' '$3 != "dir"' | head -3 | tr '\n' ' ') + [ "$_hl_nf" = 0 ] && [ -n "$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d')" ] && _hl_s=$(printf '%s\n' "${_hl_bad:-}" | sed '/^$/d' | head -2 | tr '\n' ' ') + HL=$(payload_home_layout_verdict "$_hl_nf" "$_hl_nd" "${_hl_s:-}") + case "$HL" in + PASS*) pass payload-home-layout "${HL#PASS }" ;; + *) fail payload-home-layout "${HL#FAIL }" ;; + esac +fi + # ── the NPU's locked memory in force (the driver asks for unlimited; this fleet's own 99- file can override ours) ── MEMLOCK_PID=${MEMLOCK_PID:-}