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
test(identity): read the token dir once instead of exists-then-read
Claude Code28fd7f77bf9b
diff --git a/src/core/agents/node-token-files.test.ts b/src/core/agents/node-token-files.test.tsindex 32ecb98d0..6ce4eeb6d 100644--- a/src/core/agents/node-token-files.test.ts+++ b/src/core/agents/node-token-files.test.ts@@ -35,7 +35,15 @@ describe('node token files', () => {for (const bad of ['../evil', '..', '.', 'a b', 'a/b']) {expect(writeNodeTokenFile(bad, 'kid.mac'), bad).toBe(false)}- const entries = fs.existsSync(nodeTokenDir()) ? fs.readdirSync(nodeTokenDir()) : []+ // Read once and treat "no dir" as "no entries", rather than exists-then-read: the two-step is a+ // check-then-use race (CodeQL js/file-system-race), and here it also reads worse — a refused id+ // must leave the dir either empty or absent, and both are the same assertion.+ let entries: string[] = []+ try {+ entries = fs.readdirSync(nodeTokenDir())+ } catch {+ /* dir was never created — that is the passing shape too */+ }expect(entries).toEqual([])// Prove nothing escaped the token dir into userDataDir.expect(fs.existsSync(path.join(dir, 'evil'))).toBe(false)