fleet: T110 rework - exact fleet/bin ownership, absolute fallback guard, mutation-controlled suite
ci/woodpecker/pr/ci Pipeline was successful

B1 (rev-code-02): fleet/bin/** made keep-mode update prune existing estate
executables absent from the package source. Replaced with exact entries
(fleet/bin/mosaic, fleet/bin/test-mosaic-launcher.sh); parity spec gains a
dedicated ownership probe asserting the two shipped files are framework-owned
while seat-up.sh, launch-seat.sh and the directory itself stay operator-owned,
on both resolvers.

B2: a relative HOME bypassed the fallback guard (component probes were
absolute-prefixed, so a relative candidate walked nonexistent absolute paths
and a planted cwd-relative CLI executed). The untrusted fallback candidate is
now refused unless absolute, with parent-escape (..) components refused as
well; the symlink walk then applies.

B3: A6 planted the executable off the resolved candidate path, so a
guard-bypass mutant stayed green (nothing executable at the candidate). The
symlink now points at $PLANT/.npm-global so the candidate resolves exactly to
the planted binary, and the suite gains two mutation controls: a
guard-bypassed copy MUST execute both the absolute-symlink plant and the new
relative-HOME plant (sentinels asserted present), while the real launcher
refuses both (rc 127, diagnostics, sentinels absent).

Marker T110-DISPATCH-TOPHER-1N2O / ORCH-T110-REWORK-M5N6.
This commit is contained in:
topher
2026-08-29 19:30:23 -05:00
parent 7e9e013f92
commit 2435e74b8e
4 changed files with 109 additions and 11 deletions
@@ -93,8 +93,10 @@ set -e
[ "$rc" = "127" ] || fail "A5 typed failure rc: got $rc, want 127"
case "$err" in *"no runnable CLI"*) ;; *) fail "A5 typed failure message missing: '$err'" ;; esac
# A6 — secure descriptor traversal: passwd lookup fails and a symlink-planted
# $HOME/.npm-global is refused without execution.
# A6 — secure descriptor traversal, ABSOLUTE symlink plant (corrected per
# rev-code-02 B3: the symlink points at $PLANT/.npm-global so the candidate
# resolves EXACTLY to the planted executable). passwd lookup fails and a
# symlink-planted $HOME/.npm-global is refused without execution.
PLANT="$WORK/planted-target"
mkdir -p "$PLANT/.npm-global/bin"
cat >"$PLANT/.npm-global/bin/mosaic" <<SH
@@ -103,7 +105,7 @@ touch "$WORK/planted-sentinel"
echo "0.0.0-planted"
SH
chmod +x "$PLANT/.npm-global/bin/mosaic"
ln -s "$PLANT" "$SEAT_HOME/.npm-global"
ln -s "$PLANT/.npm-global" "$SEAT_HOME/.npm-global"
set +e
err="$(printf '' | env GETENT_STUB=fail HOME="$SEAT_HOME" PATH="$STUB_BIN:/usr/bin:/bin" "$LAUNCHER" --version 2>&1)"
rc=$?
@@ -112,4 +114,49 @@ set -e
case "$err" in *"symlink component"*) ;; *) fail "A6 refusal diagnostic missing: '$err'" ;; esac
[ ! -e "$WORK/planted-sentinel" ] || fail "A6 planted mosaic EXECUTED"
# A6b — mutation control (rev-code-02 B3): a copy of the launcher with the
# descriptor guard bypassed MUST execute the plant under the identical hostile
# arm. If the mutant stays clean, the plant path is wrong and A6 proves
# nothing.
MUTANT="$WORK/mutant-mosaic"
sed 's/if fallback_candidate_usable "\$home_candidate"; then/if true; then/' "$LAUNCHER" >"$MUTANT"
chmod +x "$MUTANT"
[ "$(grep -c 'if true; then' "$MUTANT")" -eq 1 ] || fail "A6b mutant not created (guard call not replaced)"
set +e
mout="$(printf '' | env GETENT_STUB=fail HOME="$SEAT_HOME" PATH="$STUB_BIN:/usr/bin:/bin" "$MUTANT" --version 2>&1)"
mrc=$?
set -e
[ "$mrc" = "0" ] || fail "A6b mutant did not execute the plant (rc $mrc, out '$mout') - A6 proves nothing"
[ -e "$WORK/planted-sentinel" ] || fail "A6b mutant ran but sentinel absent - plant path wrong, A6 proves nothing"
# A7 — relative-HOME hostile arm (rev-code-02 B2): a relative HOME whose name
# is a symlink in the launcher CWD must be refused outright, never resolved
# against the working directory.
CWD_SANDBOX="$WORK/cwd-sandbox"
REL_PLANT="$WORK/relative-plant"
mkdir -p "$CWD_SANDBOX" "$REL_PLANT/.npm-global/bin"
cat >"$REL_PLANT/.npm-global/bin/mosaic" <<SH
#!/bin/sh
touch "$WORK/relative-sentinel"
echo "0.0.0-relative-planted"
SH
chmod +x "$REL_PLANT/.npm-global/bin/mosaic"
ln -s "$REL_PLANT" "$CWD_SANDBOX/relative-home"
set +e
rout="$(cd "$CWD_SANDBOX" && printf '' | env GETENT_STUB=fail HOME="relative-home" PATH="$STUB_BIN:/usr/bin:/bin" "$LAUNCHER" --version 2>&1)"
rrc=$?
set -e
[ "$rrc" = "127" ] || fail "A7 relative HOME was followed (rc $rrc, out '$rout')"
case "$rout" in *"relative path"*) ;; *) fail "A7 relative-refusal diagnostic missing: '$rout'" ;; esac
[ ! -e "$WORK/relative-sentinel" ] || fail "A7 relative plant EXECUTED"
# A7b — mutation control for the absolute-shape check: the same mutant (guard
# bypassed) MUST execute the relative plant under the identical arm.
set +e
rmout="$(cd "$CWD_SANDBOX" && printf '' | env GETENT_STUB=fail HOME="relative-home" PATH="$STUB_BIN:/usr/bin:/bin" "$MUTANT" --version 2>&1)"
rmrc=$?
set -e
[ "$rmrc" = "0" ] || fail "A7b mutant did not execute the relative plant (rc $rmrc, out '$rmout') - A7 proves nothing"
[ -e "$WORK/relative-sentinel" ] || fail "A7b mutant ran but relative sentinel absent - arm wrong, A7 proves nothing"
echo "mosaic launcher suite: all arms passed"