You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make ~/.ssh/config writes atomic, backed up, and permission-safe #42
~/.ssh/config is high-stakes. A write that's interrupted, written with the wrong permissions, or impossible to undo can lock a user out of their machines or make ssh refuse the file.
Evidence
src/tools/sshconfig.ts:62-92:
fs.writeFile(configPath, updated) writes in place. A crash or a concurrent write leaves a truncated config.
fs.mkdir(dir, { recursive: true }) creates ~/.ssh with default mode, not 0700. New files get the umask default rather than 0600. OpenSSH refuses a config that's writable by group or others ("Bad owner or permissions").
A read failure is swallowed (catch {}), so an EACCES on an existing config is treated as "no config" and the file is overwritten with just the managed block.
Suggested approach
Write to config.tmp, then rename it into place.
Keep config.tailscale-mcp.bak (the last pre-edit copy) and mention it in the response.
mkdir with mode 0o700 and write with mode 0o600, keeping the existing mode when the file already exists.
Only treat ENOENT as "no config". Rethrow other errors as a structured error.
On Windows, document that ACLs are left unchanged.
Done when
The write path is atomic, backed up, and permission-correct, and tests cover the EACCES and existing-mode cases.
Activity
fix: ssh-config safety, macOS CLI resolution, share paths, test typec…