style: no em-dash in test comments
This commit is contained in:
parent
120fed8cb4
commit
521777215d
6 changed files with 21 additions and 21 deletions
|
|
@ -70,7 +70,7 @@ party_rec() { printf '%s/party-%s:%s.d/roster\n' "$PARTY_SOCKET_DIR" "$USER" "$1
|
||||||
@test "party close rejects bad names" {
|
@test "party close rejects bad names" {
|
||||||
# Previous incarnation of this test edited HOST_USER in the roster
|
# Previous incarnation of this test edited HOST_USER in the roster
|
||||||
# file and expected close to refuse. That's no longer the trust
|
# file and expected close to refuse. That's no longer the trust
|
||||||
# model — host identity is anchored on dir ownership, not file
|
# model: host identity is anchored on dir ownership, not file
|
||||||
# content (commit 94befac), so editing HOST_USER is a no-op.
|
# content (commit 94befac), so editing HOST_USER is a no-op.
|
||||||
# The "not the host" path now tests as: another user owns the dir,
|
# The "not the host" path now tests as: another user owns the dir,
|
||||||
# which we can't fake without root. Coverage for the symlink and
|
# which we can't fake without root. Coverage for the symlink and
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ EOF
|
||||||
|
|
||||||
# Cross-user discovery regression. Earlier revisions of party_conn_state
|
# Cross-user discovery regression. Earlier revisions of party_conn_state
|
||||||
# probed the PID with `kill -0`, which returns EPERM under POSIX semantics
|
# probed the PID with `kill -0`, which returns EPERM under POSIX semantics
|
||||||
# when the caller can't signal the target — illumos, all BSDs, and macOS
|
# when the caller can't signal the target: illumos, all BSDs, and macOS
|
||||||
# honor that, so guests couldn't discover parties hosted by other users
|
# honor that, so guests couldn't discover parties hosted by other users
|
||||||
# on the same box. To simulate the foreign-uid case without privilege,
|
# on the same box. To simulate the foreign-uid case without privilege,
|
||||||
# rewrite the roster's SERVER_PID to 1 (init/launchd, root-owned on every
|
# rewrite the roster's SERVER_PID to 1 (init/launchd, root-owned on every
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ party_rec() { printf '%s/party-%s:%s.d/roster\n' "$PARTY_SOCKET_DIR" "$USER" "$1
|
||||||
sr=$(tmux -S "$sock" show-options -gv status-right)
|
sr=$(tmux -S "$sock" show-options -gv status-right)
|
||||||
[[ "$sr" == *"who --short"* ]]
|
[[ "$sr" == *"who --short"* ]]
|
||||||
# The #() body is executed with the tmux server's PATH, which need
|
# The #() body is executed with the tmux server's PATH, which need
|
||||||
# not contain an installed `party` — the widget must pin the absolute
|
# not contain an installed `party`: the widget must pin the absolute
|
||||||
# path of the script that hosted the party.
|
# path of the script that hosted the party.
|
||||||
[[ "$sr" == "party: #('/"* ]]
|
[[ "$sr" == "party: #('/"* ]]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ party_rec() { printf '%s/party-%s:%s.d/roster\n' "$PARTY_SOCKET_DIR" "$USER" "$1
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "host --group <name> records the chosen group in the roster" {
|
@test "host --group <name> records the chosen group in the roster" {
|
||||||
# The stub doesn't care which group we pick — exercise the path that
|
# The stub doesn't care which group we pick: exercise the path that
|
||||||
# plumbs --group through to the GROUP= field. Use the caller's primary
|
# plumbs --group through to the GROUP= field. Use the caller's primary
|
||||||
# group so chgrp succeeds.
|
# group so chgrp succeeds.
|
||||||
primary=$(id -gn)
|
primary=$(id -gn)
|
||||||
|
|
@ -130,7 +130,7 @@ party_rec() { printf '%s/party-%s:%s.d/roster\n' "$PARTY_SOCKET_DIR" "$USER" "$1
|
||||||
@test "host with --group works without any pre-existing shared install dir" {
|
@test "host with --group works without any pre-existing shared install dir" {
|
||||||
# Regression: the old layout required /tmp/roster to be installed at
|
# Regression: the old layout required /tmp/roster to be installed at
|
||||||
# mode 1770 g=$TMUX_PARTY_GROUP at install time. The new layout has
|
# mode 1770 g=$TMUX_PARTY_GROUP at install time. The new layout has
|
||||||
# nothing of the sort — every party is self-contained under PARTY_SOCKET_DIR.
|
# nothing of the sort: every party is self-contained under PARTY_SOCKET_DIR.
|
||||||
# Confirm `party host --group` succeeds with a clean sandbox that
|
# Confirm `party host --group` succeeds with a clean sandbox that
|
||||||
# never had a shared roster directory.
|
# never had a shared roster directory.
|
||||||
primary=$(id -gn)
|
primary=$(id -gn)
|
||||||
|
|
@ -165,7 +165,7 @@ party_rec() { printf '%s/party-%s:%s.d/roster\n' "$PARTY_SOCKET_DIR" "$USER" "$1
|
||||||
@test "host party_dir ends at mode 0750 even with permissive umask" {
|
@test "host party_dir ends at mode 0750 even with permissive umask" {
|
||||||
# Regression for the umask race: with umask 0002, plain `mkdir` would
|
# Regression for the umask race: with umask 0002, plain `mkdir` would
|
||||||
# produce 0775 until the later chmod 0750 closed the window. mkdir -m
|
# produce 0775 until the later chmod 0750 closed the window. mkdir -m
|
||||||
# 0700 in cmd_host removes the window entirely — and the postcondition
|
# 0700 in cmd_host removes the window entirely, and the postcondition
|
||||||
# is still 0750.
|
# is still 0750.
|
||||||
( umask 0002 && "$PARTY_BIN" host umasked )
|
( umask 0002 && "$PARTY_BIN" host umasked )
|
||||||
party_dir="$PARTY_SOCKET_DIR/party-$USER:umasked.d"
|
party_dir="$PARTY_SOCKET_DIR/party-$USER:umasked.d"
|
||||||
|
|
@ -282,7 +282,7 @@ EOF
|
||||||
# tmux must not have been touched: the recorder log has nothing for
|
# tmux must not have been touched: the recorder log has nothing for
|
||||||
# this party.
|
# this party.
|
||||||
! grep -q "kill-server" "$TMUX_LOG"
|
! grep -q "kill-server" "$TMUX_LOG"
|
||||||
# Symlink and victim contents both intact — we did not chase the
|
# Symlink and victim contents both intact: we did not chase the
|
||||||
# symlink to delete the attacker's tree.
|
# symlink to delete the attacker's tree.
|
||||||
[ -L "$party_dir" ]
|
[ -L "$party_dir" ]
|
||||||
[ -d "$victim" ]
|
[ -d "$victim" ]
|
||||||
|
|
@ -290,7 +290,7 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "host warns when PARTY_SOCKET_DIR is not group/world readable" {
|
@test "host warns when PARTY_SOCKET_DIR is not group/world readable" {
|
||||||
# The sandbox parent is mode 0700 — trustworthy but undiscoverable to
|
# The sandbox parent is mode 0700, trustworthy but undiscoverable to
|
||||||
# invitees. cmd_host should accept it (validator is happy) but emit
|
# invitees. cmd_host should accept it (validator is happy) but emit
|
||||||
# a warning so the host notices before sending invites.
|
# a warning so the host notices before sending invites.
|
||||||
run "$PARTY_BIN" host noreach
|
run "$PARTY_BIN" host noreach
|
||||||
|
|
@ -556,7 +556,7 @@ STUB
|
||||||
# Trap fired: kill-server invoked against the derived socket.
|
# Trap fired: kill-server invoked against the derived socket.
|
||||||
grep -q "$party_dir/sock kill-server" "$TMUX_LOG"
|
grep -q "$party_dir/sock kill-server" "$TMUX_LOG"
|
||||||
|
|
||||||
# Per-party dir is gone — no leftover roster, no leftover sock.
|
# Per-party dir is gone: no leftover roster, no leftover sock.
|
||||||
[ ! -e "$party_dir" ]
|
[ ! -e "$party_dir" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -577,7 +577,7 @@ STUB
|
||||||
|
|
||||||
@test "host refuses leftover per-party dir without a roster" {
|
@test "host refuses leftover per-party dir without a roster" {
|
||||||
# Simulate a prior incarnation that left a per-party dir behind with
|
# Simulate a prior incarnation that left a per-party dir behind with
|
||||||
# no roster (the rollback trap couldn't fire — SIGKILL or panic).
|
# no roster (the rollback trap couldn't fire: SIGKILL or panic).
|
||||||
# cmd_host's mkdir-as-lock acquisition will fail with EEXIST. We
|
# cmd_host's mkdir-as-lock acquisition will fail with EEXIST. We
|
||||||
# deliberately do NOT auto-clean: the same code path triggers on a
|
# deliberately do NOT auto-clean: the same code path triggers on a
|
||||||
# concurrent in-flight host attempt for the same name, and racing
|
# concurrent in-flight host attempt for the same name, and racing
|
||||||
|
|
@ -592,7 +592,7 @@ STUB
|
||||||
[[ "$output" == *"already exists"* ]]
|
[[ "$output" == *"already exists"* ]]
|
||||||
[[ "$output" == *"party clean"* ]]
|
[[ "$output" == *"party clean"* ]]
|
||||||
|
|
||||||
# The leftover dir is untouched — proves we did not race-clean.
|
# The leftover dir is untouched: proves we did not race-clean.
|
||||||
[ -d "$party_dir" ]
|
[ -d "$party_dir" ]
|
||||||
[ -e "$party_dir/sock" ]
|
[ -e "$party_dir/sock" ]
|
||||||
|
|
||||||
|
|
@ -626,7 +626,7 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "roster_read rejects basename whose party name fails validate_party_name" {
|
@test "roster_read rejects basename whose party name fails validate_party_name" {
|
||||||
# The basename glob (party-*:*.d) is permissive — names like '.' (basename
|
# The basename glob (party-*:*.d) is permissive: names like '.' (basename
|
||||||
# party-USER:..d) match it. cmd_host's validate_party_name rejects '.' as
|
# party-USER:..d) match it. cmd_host's validate_party_name rejects '.' as
|
||||||
# a reserved name; roster_read runs the same check on read so a forged
|
# a reserved name; roster_read runs the same check on read so a forged
|
||||||
# dir whose basename derives an illegal name can't pass.
|
# dir whose basename derives an illegal name can't pass.
|
||||||
|
|
@ -649,7 +649,7 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "cmd_list skips parties whose tmux list-clients fails" {
|
@test "cmd_list skips parties whose tmux list-clients fails" {
|
||||||
# SERVER_PID liveness alone doesn't prove a party is real — init's PID 1
|
# SERVER_PID liveness alone doesn't prove a party is real: init's PID 1
|
||||||
# always passes, and a non-tmux daemon (or `nc -lU`) can hold a real
|
# always passes, and a non-tmux daemon (or `nc -lU`) can hold a real
|
||||||
# AF_UNIX socket. cmd_list must run list-clients and treat non-zero as
|
# AF_UNIX socket. cmd_list must run list-clients and treat non-zero as
|
||||||
# "not a real party," skipping the entry rather than reporting it with
|
# "not a real party," skipping the entry rather than reporting it with
|
||||||
|
|
@ -730,7 +730,7 @@ STUB
|
||||||
# resolver. A roster can have a live SERVER_PID (PID reuse, init's pid 1)
|
# resolver. A roster can have a live SERVER_PID (PID reuse, init's pid 1)
|
||||||
# and an [ -S ]-passing socket (planted via `nc -lU`) yet not be a real
|
# and an [ -S ]-passing socket (planted via `nc -lU`) yet not be a real
|
||||||
# tmux server. party_conn_state must probe list-clients on every resolver,
|
# tmux server. party_conn_state must probe list-clients on every resolver,
|
||||||
# not just cmd_list — otherwise `party join
|
# not just cmd_list, otherwise `party join
|
||||||
# imposter` would resolve to the imposter and try to attach.
|
# imposter` would resolve to the imposter and try to attach.
|
||||||
legit_dir="$PARTY_SOCKET_DIR/party-$USER:legit2.d"
|
legit_dir="$PARTY_SOCKET_DIR/party-$USER:legit2.d"
|
||||||
mkdir -p "$legit_dir" && chmod 0750 "$legit_dir"
|
mkdir -p "$legit_dir" && chmod 0750 "$legit_dir"
|
||||||
|
|
@ -785,7 +785,7 @@ STUB
|
||||||
# cmd_host MUST require server-access at runtime, not just in the
|
# cmd_host MUST require server-access at runtime, not just in the
|
||||||
# README. tmux < 3.3 doesn't support the command, and silently
|
# README. tmux < 3.3 doesn't support the command, and silently
|
||||||
# swallowing its failure (the prior behavior) would degrade the auth
|
# swallowing its failure (the prior behavior) would degrade the auth
|
||||||
# gate to nothing — group members with FS access could attach without
|
# gate to nothing: group members with FS access could attach without
|
||||||
# being invited.
|
# being invited.
|
||||||
cat > "$PARTY_TMUX" <<'STUB'
|
cat > "$PARTY_TMUX" <<'STUB'
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
@ -804,7 +804,7 @@ case "$*" in
|
||||||
echo "$FAKE_SERVER_PID"
|
echo "$FAKE_SERVER_PID"
|
||||||
;;
|
;;
|
||||||
*"server-access "*)
|
*"server-access "*)
|
||||||
# Simulate tmux < 3.3 — command unknown.
|
# Simulate tmux < 3.3: command unknown.
|
||||||
echo "unknown command: server-access" >&2
|
echo "unknown command: server-access" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# Uninvited-guest semantics. tmux >= 3.3 answers a non-allowlisted
|
# Uninvited-guest semantics. tmux >= 3.3 answers a non-allowlisted
|
||||||
# user's connection with "access not allowed" on stderr and EXIT 0
|
# user's connection with "access not allowed" on stderr and EXIT 0
|
||||||
# (verified live on 3.3a and 3.5a with two real users), for every
|
# (verified live on 3.3a and 3.5a with two real users), for every
|
||||||
# command — including has-session, which then reports any target as
|
# command, including has-session, which then reports any target as
|
||||||
# existing. Exit-code-based checks therefore misclassified
|
# existing. Exit-code-based checks therefore misclassified
|
||||||
# "unauthorized" as "authorized": party status reported uninvited
|
# "unauthorized" as "authorized": party status reported uninvited
|
||||||
# members as joined, party leave silently "succeeded", and party list
|
# members as joined, party leave silently "succeeded", and party list
|
||||||
|
|
@ -28,7 +28,7 @@ STUB
|
||||||
|
|
||||||
# Plant a live-looking party dir + roster. Ownership is ours (bats
|
# Plant a live-looking party dir + roster. Ownership is ours (bats
|
||||||
# can't fake a foreign uid without root), so cmd_status will also see
|
# can't fake a foreign uid without root), so cmd_status will also see
|
||||||
# this fixture as "hosting" — that's orthogonal to the joined/leave
|
# this fixture as "hosting": that's orthogonal to the joined/leave
|
||||||
# misreporting under test.
|
# misreporting under test.
|
||||||
ensure_party_dir "$USER" fiesta
|
ensure_party_dir "$USER" fiesta
|
||||||
d="$PARTY_SOCKET_DIR/party-$USER:fiesta.d"
|
d="$PARTY_SOCKET_DIR/party-$USER:fiesta.d"
|
||||||
|
|
@ -88,7 +88,7 @@ STUB
|
||||||
|
|
||||||
@test "read-only invitee joining active falls back to passive with a notice" {
|
@test "read-only invitee joining active falls back to passive with a notice" {
|
||||||
# tmux refuses new-session from a read-only client ("client is
|
# tmux refuses new-session from a read-only client ("client is
|
||||||
# read-only", exit 1 — verified 3.3a/3.5a), so an active join for an
|
# read-only", exit 1, verified 3.3a/3.5a), so an active join for an
|
||||||
# -r invitee died mid-command under set -eu. cmd_join must detect the
|
# -r invitee died mid-command under set -eu. cmd_join must detect the
|
||||||
# R flag on its own ACL line and attach passive instead. The unquoted
|
# R flag on its own ACL line and attach passive instead. The unquoted
|
||||||
# STUB delimiter is deliberate: $USER expands at write time, \$* at
|
# STUB delimiter is deliberate: $USER expands at write time, \$* at
|
||||||
|
|
@ -110,7 +110,7 @@ STUB
|
||||||
|
|
||||||
@test "read-only invitee (U,R) flag format also falls back to passive" {
|
@test "read-only invitee (U,R) flag format also falls back to passive" {
|
||||||
# tmux refuses new-session from a read-only client ("client is
|
# tmux refuses new-session from a read-only client ("client is
|
||||||
# read-only", exit 1 — verified 3.3a/3.5a), so an active join for an
|
# read-only", exit 1, verified 3.3a/3.5a), so an active join for an
|
||||||
# -r invitee died mid-command under set -eu. cmd_join must detect the
|
# -r invitee died mid-command under set -eu. cmd_join must detect the
|
||||||
# R flag on its own ACL line and attach passive instead. The unquoted
|
# R flag on its own ACL line and attach passive instead. The unquoted
|
||||||
# STUB delimiter is deliberate: $USER expands at write time, \$* at
|
# STUB delimiter is deliberate: $USER expands at write time, \$* at
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ require_party_group() {
|
||||||
|| skip "user not in group '$g'; run: sudo usermod -aG $g $USER && relog"
|
|| skip "user not in group '$g'; run: sudo usermod -aG $g $USER && relog"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print one username per line for users in group $1 — both supplementary
|
# Print one username per line for users in group $1: both supplementary
|
||||||
# members (4th /etc/group field) and primary-group members (passwd gid
|
# members (4th /etc/group field) and primary-group members (passwd gid
|
||||||
# match). Linux / illumos / FreeBSD / OpenBSD use getent(1); macOS has
|
# match). Linux / illumos / FreeBSD / OpenBSD use getent(1); macOS has
|
||||||
# no getent and stores users in Directory Services, so fall back to
|
# no getent and stores users in Directory Services, so fall back to
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue