fix: classify unauthorized by stderr presence, not denial wording

Review flagged the 'access not allowed' substring:
if tmux's denial text drifts while keeping exit 0, unauthorized
connections would classify as ok and the false-joined status/leave
misreporting would silently return. A clean authorized list-clients
writes nothing to stderr (verified 3.3a/3.5a/3.6-SunOS, incl. invited
read-only clients), so rc 0 plus any stderr output now classifies as
unauthorized: no message text consulted. Drift in any direction
degrades to a hidden party, never to a false ok.
This commit is contained in:
veg 2026-07-04 14:03:53 +00:00
parent b44a3b705f
commit 938491df1e
3 changed files with 45 additions and 16 deletions

View file

@ -129,3 +129,21 @@ STUB
[[ "$output" == *"read-only"* ]]
[[ "$output" == *"attach-session -r -t fiesta"* ]]
}
@test "unauthorized classification does not depend on tmux's denial wording" {
# Adversarial-review finding: matching the English "access not
# allowed" would silently reopen the false-authorized paths if the
# wording ever drifts. The classifier keys on rc 0 + any stderr
# output instead; this stub proves a drifted message still counts.
cat > "$PARTY_TMP/tmux-denied-drift" <<'STUB'
#!/bin/sh
echo "connection declined by policy" >&2
exit 0
STUB
chmod +x "$PARTY_TMP/tmux-denied-drift"
export PARTY_TMUX="$PARTY_TMP/tmux-denied-drift"
run "$PARTY_BIN" list
[ "$status" -eq 0 ]
[[ "$output" == *"invite-only"* ]]
[[ "$output" != *"0 attendee"* ]]
}