File: src/server/socket.zig:43-58; src/socket_path.zig:34-50
Severity: MEDIUM
Status: ✅ FIXED
createListener probes the socket path with a unix connect first
(connectProbeUnix): a successful connect means another live szn owns the
endpoint and startup aborts with error.AddressInUse instead of stealing
it; a refused connection means a stale socket from a dead server, safe to
replace.chmod 0700 after bind regardless of umask,
closing the world-connectable /tmp/szn-{uid}.sock fallback hole.Existing listener/socket tests all pass; probe behaviour exercised implicitly by every test that creates a listener.
_ = c.unlink(path.ptr) runs unconditionally before bind: starting a
second szn while the first is alive rebinds the path out from under the
first server, stranding its clients.$HOME/.szn or XDG_RUNTIME_DIR the 0700 directory saves us, but the
/tmp/szn-{uid}.sock fallback creates the socket under the process umask;
containers commonly run umask 000 → any local user can connect and issue
command packets.Bind first and treat EADDRINUSE as “server already running” (probe with a ping before considering takeover); chmod the socket to 0700 explicitly regardless of umask.