Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
harden(fs-atomic): exclusive-create the publish temp (flag: 'wx')
enes6f4a06fb5a01
diff --git a/src/core/fs-atomic.ts b/src/core/fs-atomic.tsindex af8c4dd8c..5e176efce 100644--- a/src/core/fs-atomic.ts+++ b/src/core/fs-atomic.ts@@ -345,7 +345,11 @@ export async function writeFileAtomic(): Promise<void> {const tmp = tempNameFor(target)try {- await fs.writeFile(tmp, data, { encoding: 'utf-8', ...opts })+ // `wx`: fail if the temp already exists rather than following it. The name is unique per call,+ // so this never fires in normal operation — its job is to refuse a symlink an attacker+ // pre-planted at the (now guessable-in-principle) temp path, so a publish can never be+ // redirected to write through it. On the expected fresh path it is a plain exclusive create.+ await fs.writeFile(tmp, data, { encoding: 'utf-8', flag: 'wx', ...opts })await renameAtomic(tmp, target)} catch (e) {await fs.rm(tmp, { force: true }).catch(() => {})