From 84dfe1769b0982b63414840220ce746d183ec631 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Sun, 8 Nov 2026 20:52:01 -0400 Subject: [PATCH 1/2] os: a payload row refuses a vacuous subject (#1596's first ask) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An empty, 0755 `/opt/1bit-package` printed PASS no path in the payload is group- or other-writable - neither a file nor a directory over **zero** entries - the vacuous-PASS shape #1596's author hit while testing the row they had just written to refuse exactly it (their first `unsquashfs -d` produced 0 entries and their scanner returned nothing, so their row said PASS). A payload carries hundreds of entries (c33: 263), so both payload rows check their subject before their claim: * `payload-modes`: **FAIL** below 100 entries - "an empty or interrupted unpack … a clean mode count over it would prove nothing"; * `payload-runpath`: **FAIL** below 5 ELFs by magic bytes - otherwise the row prints `ELF=0 non-$ORIGIN=0`, a pass over nothing (c33: 19 real ELFs plus 14 symlinks). `--self-test` 138 ok / 0 failed under both the shebang (dash) and bash. The `ci.yml` step that would run this suite in CI is **not** in this PR: the OAuth app this lane pushes with has no `workflow` scope, so a workflow edit is rejected (`refusing to allow an OAuth App to create or update workflow`). That change needs someone whose token carries `workflow` - and the one-line step is in #1596's comment thread, ready to paste. --- os/mini/release-check.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/os/mini/release-check.sh b/os/mini/release-check.sh index 3857b409c..ebebda4cb 100755 --- a/os/mini/release-check.sh +++ b/os/mini/release-check.sh @@ -1987,7 +1987,15 @@ fi # to trust that a mode fix happened. A SKIP (not a failure) when the payload is not where an appliance keeps it, so the row can be # run off a stick. PDIR=${PAYLOAD_DIR:-/opt/1bit-package} -if [ ! -d "$PDIR" ]; then +# A clean mode count over an EMPTY payload proves nothing - and a directory that exists but holds nothing is exactly what an +# interrupted extraction leaves behind (measured 2026-11-08: an `unsquashfs -d` with the wrong path argument produced 0 entries +# and this row printed PASS over it). So the row checks its subject before it checks the modes: a real payload carries hundreds +# of entries (c33: 263). +_pm_entries=0 +[ -d "$PDIR" ] && _pm_entries=$(find "$PDIR" -mindepth 1 2>/dev/null | wc -l) +if [ "$_pm_entries" -lt 100 ] 2>/dev/null; then + fail payload-modes "the payload at $PDIR holds only ${_pm_entries:-0} entries - a payload has hundreds (c33: 263), so this is an empty or interrupted unpack and a clean mode count over it would prove nothing" +elif [ ! -d "$PDIR" ]; then skip payload-modes "no $PDIR on this system: the payload is not unpacked where an appliance keeps it, so its modes cannot be read" else _pm_f=$(find "$PDIR" -type f \( -perm -g+w -o -perm -o+w \) 2>/dev/null | wc -l) @@ -2122,6 +2130,14 @@ PYSCAN fi } RUNDIR=${PAYLOAD_DIR:-/opt/1bit-package} +# A payload with no ELF in it is an empty or interrupted unpack, not a clean RUNPATH set: the row would print +# "ELF=0 non-$ORIGIN=0" and read as a pass over nothing. Same floor as payload-modes, for the same reason. +_rp_elfs=0 +[ -d "$RUNDIR" ] && _rp_elfs=$(find "$RUNDIR" -type f -size +1k 2>/dev/null | head -400 | while IFS= read -r _f; do + head -c4 "$_f" 2>/dev/null | od -An -tx1 | tr -d ' \n' | grep -q '^7f454c46' && echo x; done | wc -l) +if [ "${_rp_elfs:-0}" -lt 5 ] 2>/dev/null; then + fail payload-runpath "the payload at $RUNDIR holds ${_rp_elfs:-0} ELF(s) - a payload carries dozens (c33: 19 real ELFs plus 14 symlinks), so this is an empty or interrupted unpack and 'every RUNPATH is \$ORIGIN' would be true of nothing" +fi if [ ! -d "$RUNDIR" ]; then skip payload-runpath "no $RUNDIR on this system: the payload is not unpacked where an appliance keeps it, so its RUNPATHs cannot be read" else From 36b5dd068ef04fb9b1fecfe2a0b6dd8ce5d48e81 Mon Sep 17 00:00:00 2001 From: pi-release Date: Mon, 9 Nov 2026 04:40:21 -0400 Subject: [PATCH 2/2] os/mini: the vacuity floor runs AFTER the payload's existence, in both payload rows Review catch, and it is the ordering the rows' own comments describe: absence first, then vacuity, then the scan. `_pm_entries`/`_rp_elfs` start at 0, so with the floor checked first a MISSING payload satisfied "< 100" and took the fail branch - the SKIP underneath, whose wording ("no /opt/1bit-package on this system: the payload is not unpacked where an appliance keeps it") proves the absent case is expected, was unreachable. Running the check off a stick or on a dev box then printed FAIL for payload-modes instead of SKIP. payload-runpath had the same order in two separate `if`s, so it recorded a FAIL and a SKIP for the same path and counted both in the summary. It is one chain now. The distinction the reordering preserves: a missing payload is a claim about THIS SYSTEM (a stick, a dev box) and stays a SKIP; a payload that exists and holds nothing is a claim about the ARTIFACT and is a FAIL. Measured, three fixtures, both rows: absent SKIP payload-modes / SKIP payload-runpath empty FAIL "holds only 0 entries" / FAIL "holds 0 ELF(s)" real 122 entries, 6 ELFs, mode 644/755 -> PASS payload-modes, PASS payload-runpath --- os/mini/release-check.sh | 83 ++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 37 deletions(-) diff --git a/os/mini/release-check.sh b/os/mini/release-check.sh index ebebda4cb..8907e1e1d 100755 --- a/os/mini/release-check.sh +++ b/os/mini/release-check.sh @@ -1991,29 +1991,33 @@ PDIR=${PAYLOAD_DIR:-/opt/1bit-package} # interrupted extraction leaves behind (measured 2026-11-08: an `unsquashfs -d` with the wrong path argument produced 0 entries # and this row printed PASS over it). So the row checks its subject before it checks the modes: a real payload carries hundreds # of entries (c33: 263). -_pm_entries=0 -[ -d "$PDIR" ] && _pm_entries=$(find "$PDIR" -mindepth 1 2>/dev/null | wc -l) -if [ "$_pm_entries" -lt 100 ] 2>/dev/null; then - fail payload-modes "the payload at $PDIR holds only ${_pm_entries:-0} entries - a payload has hundreds (c33: 263), so this is an empty or interrupted unpack and a clean mode count over it would prove nothing" -elif [ ! -d "$PDIR" ]; then +# Absence first, then vacuity: the SKIP below is the row's documented behaviour on a machine where the payload is not +# unpacked (a stick, a dev box), and the floor must not pre-empt it. A missing payload is a claim about THIS system; a +# payload that exists and holds nothing is a claim about the ARTIFACT - and only the second is a FAIL. +if [ ! -d "$PDIR" ]; then skip payload-modes "no $PDIR on this system: the payload is not unpacked where an appliance keeps it, so its modes cannot be read" else - _pm_f=$(find "$PDIR" -type f \( -perm -g+w -o -perm -o+w \) 2>/dev/null | wc -l) - _pm_d=$(find "$PDIR" -mindepth 0 -type d \( -perm -g+w -o -perm -o+w \) 2>/dev/null | wc -l) - # the sample is relative to the payload, like the modes below it: an absolute path per file makes a long line on a console - # nobody can scroll, and the prefix is identical for every one of them - # the sample prints the mode too, because "writable" is not actionable and `drwxrwxr-x opt/1bit-package` is - _pm_s=$(find "$PDIR" -mindepth 0 \( -type f -o -type d \) \( -perm -g+w -o -perm -o+w \) 2>/dev/null | head -3 | - while IFS= read -r _p; do _r=${_p#"$PDIR"}; _r=${_r#/}; printf '%s %s ' "$(stat -c %A "$_p" 2>/dev/null)" "${_r:-.}"; done) - PM=$(payload_modes_verdict "${_pm_f:-}" "${_pm_d:-}" "${_pm_s:-}") - _pm_bits= - for _b in "$PDIR/1bit/1bit" "$PDIR/bin/lemond" "$PDIR/lemond-onebit"; do - [ -f "$_b" ] && _pm_bits="$_pm_bits $(stat -c '%a %n' "$_b" 2>/dev/null | sed "s|$PDIR/||")" - done - case "$PM" in - PASS*) pass payload-modes "${PM#PASS }${_pm_bits:+ (modes:$_pm_bits)}" ;; - *) fail payload-modes "${PM#FAIL }${_pm_bits:+ (modes:$_pm_bits)}" ;; - esac + _pm_entries=$(find "$PDIR" -mindepth 1 2>/dev/null | wc -l) + if [ "${_pm_entries:-0}" -lt 100 ] 2>/dev/null; then + fail payload-modes "the payload at $PDIR holds only ${_pm_entries:-0} entries - a payload has hundreds (c33: 263), so this is an interrupted extraction, not a clean payload" + else + _pm_f=$(find "$PDIR" -type f \( -perm -g+w -o -perm -o+w \) 2>/dev/null | wc -l) + _pm_d=$(find "$PDIR" -mindepth 0 -type d \( -perm -g+w -o -perm -o+w \) 2>/dev/null | wc -l) + # the sample is relative to the payload: an absolute path per file makes a line nobody can scroll, and the + # prefix is identical for every one of them. It prints the mode too, because "writable" is not actionable + # and `drwxrwxr-x opt/1bit-package` is. + _pm_s=$(find "$PDIR" -mindepth 0 \( -type f -o -type d \) \( -perm -g+w -o -perm -o+w \) 2>/dev/null | head -3 | + while IFS= read -r _p; do _r=${_p#"$PDIR"}; _r=${_r#/}; printf '%s %s ' "$(stat -c %A "$_p" 2>/dev/null)" "${_r:-.}"; done) + PM=$(payload_modes_verdict "${_pm_f:-}" "${_pm_d:-}" "${_pm_s:-}") + _pm_bits= + for _b in "$PDIR/1bit/1bit" "$PDIR/bin/lemond" "$PDIR/lemond-onebit"; do + [ -f "$_b" ] && _pm_bits="$_pm_bits $(stat -c '%a %n' "$_b" 2>/dev/null | sed "s|$PDIR/||")" + done + case "$PM" in + PASS*) pass payload-modes "${PM#PASS }${_pm_bits:+ (modes:$_pm_bits)}" ;; + *) fail payload-modes "${PM#FAIL }${_pm_bits:+ (modes:$_pm_bits)}" ;; + esac + fi fi # ── the BASE layer's modes (engine#1474) ──────────────────────────────────────────────────────────────────────── @@ -2132,26 +2136,31 @@ PYSCAN RUNDIR=${PAYLOAD_DIR:-/opt/1bit-package} # A payload with no ELF in it is an empty or interrupted unpack, not a clean RUNPATH set: the row would print # "ELF=0 non-$ORIGIN=0" and read as a pass over nothing. Same floor as payload-modes, for the same reason. -_rp_elfs=0 -[ -d "$RUNDIR" ] && _rp_elfs=$(find "$RUNDIR" -type f -size +1k 2>/dev/null | head -400 | while IFS= read -r _f; do - head -c4 "$_f" 2>/dev/null | od -An -tx1 | tr -d ' \n' | grep -q '^7f454c46' && echo x; done | wc -l) -if [ "${_rp_elfs:-0}" -lt 5 ] 2>/dev/null; then - fail payload-runpath "the payload at $RUNDIR holds ${_rp_elfs:-0} ELF(s) - a payload carries dozens (c33: 19 real ELFs plus 14 symlinks), so this is an empty or interrupted unpack and 'every RUNPATH is \$ORIGIN' would be true of nothing" -fi +# Same order as payload-modes, and one chain rather than two `if`s: with the floor checked first, a missing payload +# took the FAIL branch and its own SKIP was unreachable - and in this row both ran, recording a FAIL and a SKIP for the +# same path, which also double-counted in the summary. if [ ! -d "$RUNDIR" ]; then skip payload-runpath "no $RUNDIR on this system: the payload is not unpacked where an appliance keeps it, so its RUNPATHs cannot be read" else - _rp_bad=$(payload_runpath_bad "$RUNDIR"); _rp_rc=$? - if [ "$_rp_rc" = 2 ]; then - skip payload-runpath "neither python3 nor readelf is here, so the payload's RUNPATHs cannot be read - that is not evidence" + # Count ELFs by magic rather than by name, and judge only after: a RUNPATH scan over a tree holding no ELF prints + # the same PASS whether it read a payload or an empty directory. + _rp_elfs=$(find "$RUNDIR" -type f -size +1k 2>/dev/null | head -400 | while IFS= read -r _f; do + head -c4 "$_f" 2>/dev/null | od -An -tx1 | tr -d ' \n' | grep -q '^7f454c46' && echo x; done | wc -l) + if [ "${_rp_elfs:-0}" -lt 5 ] 2>/dev/null; then + fail payload-runpath "the payload at $RUNDIR holds ${_rp_elfs:-0} ELF(s) - a payload carries dozens (c33: 19 real ELFs), so this is an interrupted extraction, not a clean payload" else - _rp_n=$(printf '%s\n' "${_rp_bad:-}" | sed '/^$/d' | wc -l) - _rp_s=$(printf '%s\n' "${_rp_bad:-}" | sed '/^$/d' | head -3 | tr '\n' ' ') - RP=$(payload_runpath_verdict "${_rp_n:-0}" "${_rp_s:-}") - case "$RP" in - PASS*) pass payload-runpath "${RP#PASS }" ;; - *) fail payload-runpath "${RP#FAIL }" ;; - esac + _rp_bad=$(payload_runpath_bad "$RUNDIR"); _rp_rc=$? + if [ "$_rp_rc" = 2 ]; then + skip payload-runpath "neither python3 nor readelf is here, so the payload's RUNPATHs cannot be read - that is no verdict either way" + else + _rp_n=$(printf '%s\n' "${_rp_bad:-}" | sed '/^$/d' | wc -l) + _rp_s=$(printf '%s\n' "${_rp_bad:-}" | sed '/^$/d' | head -3 | tr '\n' ' ') + RP=$(payload_runpath_verdict "${_rp_n:-0}" "${_rp_s:-}") + case "$RP" in + PASS*) pass payload-runpath "${RP#PASS }" ;; + *) fail payload-runpath "${RP#FAIL }" ;; + esac + fi fi fi