Relationships
↔ sibling #4840#4873 @swamp/cfgmgmt: SSH ControlMaster sockets and pins ignore TMPDIR (hard-coded /tmp)
Opened by randybias · 11/18/2026· Shipped 11/20/2026
Behaviour only, no secrets. Seen on @swamp/cfgmgmt 2026.11.17.1, swamp 20261116.052640.0-sha.4d3ccd8c, Linux.
What happens
prepareSocketDir(base = "/tmp") in models/_lib/ssh.ts is called with no argument, so the per-user directory
/tmp/cfgmgmt-ssh-<uid>/ is always under the literal /tmp. The ControlMaster sockets (<hash>) and, with the
pinned host-key policy, the pinned <hash>.known_hosts files live there. The same file stages uploads at
/tmp/.swamp-upload-<id> and /tmp/.swamp-stage-<id> on the remote host (that one is fine: it is the target's /tmp).
Running swamp with TMPDIR=<other dir> changes nothing: the directory is still created under /tmp on the host
that runs swamp.
Why it matters
- A host or a CI job that gives each run its own temp dir (rootless, per-run cleanup, a read-only or small
/tmp) cannot keep these files with the run. They outlive it, shared by every run of the same uid. - A test harness that wants to check "nothing of this run is left behind" has to look in a shared directory and match by content.
- The sockets stay alive after the run (ControlPersist) with no per-run owner.
Suggested change
Use the OS temp dir for the local side: prepareSocketDir(base = Deno.env.get("TMPDIR") ?? "/tmp")
(mind the sun_path limit of about 104 bytes: a long TMPDIR can break the socket path, so fall back to /tmp or
a short hashed name if the full path is too long). The remote-side staging paths can stay as they are.
Our side
Our live driver sets TMPDIR for the swamp child anyway and keeps its own cleanup of only the pins of its own run
in /tmp/cfgmgmt-ssh-<uid>/, until upstream honours TMPDIR.
Upstream repository: https://github.com/swamp-club/swamp-extensions
Environment
- Extension:
@swamp/cfgmgmt@2026.11.15.4 - swamp:
20261117.233659.0-sha.9a2f5148 - OS:
linux(x86_64) - Deno:
2.9.8 - Shell:
/bin/bash
Shipped
Click a lifecycle step above to view its details.
system commented 11/18/2026, 5:18:34 PM
Classified automatically when this issue was filed.
- Source: Extensions
If you feel this classification is incorrect, add a ripple to tell us so.
stack72 commented 11/20/2026, 7:24:31 PM
Thanks @randybias for reporting this! The fix has been merged and a release is on its way. We appreciate your contribution to swamp.
Sign in to post a ripple.