fleet: fix parent-escape ERE double-escape + arm (T110 delta B2)
ci/woodpecker/pr/ci Pipeline was successful

The parent-escape rejection grep used a double-escaped ERE ('\\.\\.'), which
matches a literal backslash followed by any character - never a normal '..'
component - so an absolute HOME containing '/../' traversed to a planted tree
and executed it (rev-code-02 delta probe: rc 0, no diagnostic, sentinel
present). Corrected to the single-escaped ERE ('\.\.'), which matches a
literal dot-dot component.

Suite: A8 parent-escape hostile arm added (absolute HOME
<base>/../escape-target, executable planted at the resolved tree outside the
seat home) - the real launcher must refuse with the parent-escape diagnostic
and leave the sentinel absent, and a guard-bypassed mutant copy MUST execute
the same plant under the identical arm (sentinel present), proving the check
is what stands. The arm's HOME traversal was also corrected during authoring:
the first draft double-prefixed the worktree path, which made the candidate
nonexistent and would have let the mutant pass vacuously (the same
wrong-resolved-path class B3 caught).

Marker T110-DISPATCH-TOPHER-1N2O / ORCH-T110-B2FIX-X8Y9.
This commit is contained in:
topher
2026-08-29 22:42:21 -05:00
parent 2435e74b8e
commit 9154a006de
2 changed files with 32 additions and 1 deletions
+1 -1
View File
@@ -86,7 +86,7 @@ fallback_candidate_usable() {
return 1
;;
esac
if printf '%s' "$candidate" | grep -qE '(^|/)\\.\\.(/|$)'; then
if printf '%s' "$candidate" | grep -qE '(^|/)\.\.(/|$)'; then
echo "mosaic: refusing \$HOME candidate $candidate: parent-escape component" >&2
return 1
fi
@@ -159,4 +159,35 @@ 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"
# A8 — parent-escape hostile arm (rev-code-02 delta, B2 remains): an absolute
# HOME containing a literal '..' component must be refused by the
# parent-escape check — the traversal would otherwise land on a planted tree
# OUTSIDE the seat home with no symlink involved.
ESC_BASE="$WORK/escape-base"
ESC_TARGET="$WORK/escape-target"
mkdir -p "$ESC_BASE" "$ESC_TARGET/.npm-global/bin"
cat >"$ESC_TARGET/.npm-global/bin/mosaic" <<SH
#!/bin/sh
touch "$WORK/escape-sentinel"
echo "0.0.0-escape-planted"
SH
chmod +x "$ESC_TARGET/.npm-global/bin/mosaic"
set +e
eout="$(printf '' | env GETENT_STUB=fail HOME="$ESC_BASE/../escape-target" PATH="$STUB_BIN:/usr/bin:/bin" "$LAUNCHER" --version 2>&1)"
erc=$?
set -e
[ "$erc" = "127" ] || fail "A8 parent-escape HOME was followed (rc $erc, out '$eout')"
case "$eout" in *"parent-escape component"*) ;; *) fail "A8 parent-escape diagnostic missing: '$eout'" ;; esac
[ ! -e "$WORK/escape-sentinel" ] || fail "A8 escape plant EXECUTED"
# A8b — mutation control: the guard-bypassed copy MUST execute the parent-
# escape plant under the identical arm (sentinel present, rc 0), proving the
# parent-escape check is what stands.
set +e
emout="$(printf '' | env GETENT_STUB=fail HOME="$ESC_BASE/../escape-target" PATH="$STUB_BIN:/usr/bin:/bin" "$MUTANT" --version 2>&1)"
emrc=$?
set -e
[ "$emrc" = "0" ] || fail "A8b mutant did not execute the escape plant (rc $emrc, out '$emout') - A8 proves nothing"
[ -e "$WORK/escape-sentinel" ] || fail "A8b mutant ran but escape sentinel absent - arm wrong, A8 proves nothing"
echo "mosaic launcher suite: all arms passed"