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:
parent
b44a3b705f
commit
938491df1e
3 changed files with 45 additions and 16 deletions
|
|
@ -142,9 +142,10 @@ setup() {
|
|||
cat > "$stub" <<'S'
|
||||
#!/bin/sh
|
||||
case "${MODE:-}" in
|
||||
ok) exit 0 ;;
|
||||
deny) echo "access not allowed" >&2; exit 0 ;;
|
||||
*) echo "error connecting to /x (No such file or directory)" >&2; exit 1 ;;
|
||||
ok) exit 0 ;;
|
||||
deny) echo "access not allowed" >&2; exit 0 ;;
|
||||
deny2) echo "connection declined by policy (hypothetical future wording)" >&2; exit 0 ;;
|
||||
*) echo "error connecting to /x (No such file or directory)" >&2; exit 1 ;;
|
||||
esac
|
||||
S
|
||||
chmod +x "$stub"
|
||||
|
|
@ -153,5 +154,8 @@ S
|
|||
# The trap this function exists for: tmux answers unauthorized users
|
||||
# with EXIT 0 + a stderr message, so rc alone says "authorized".
|
||||
export MODE=deny; [ "$(party_conn_state /x)" = "unauthorized" ]
|
||||
# Classification must not depend on tmux's denial wording (adversarial
|
||||
# review finding): rc 0 with ANY stderr output is a refusal.
|
||||
export MODE=deny2; [ "$(party_conn_state /x)" = "unauthorized" ]
|
||||
export MODE=dead; [ "$(party_conn_state /x)" = "dead" ]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue