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
fix(ssh): pass raw (unquoted) remote path to scp so SFTP-mode upload works
enes78d75e90ff26
diff --git a/src/main/remote-ssh/control-master.test.ts b/src/main/remote-ssh/control-master.test.tsindex 2c81bf69a..66c6fa0c0 100644--- a/src/main/remote-ssh/control-master.test.ts+++ b/src/main/remote-ssh/control-master.test.ts@@ -148,14 +148,15 @@ describe('hook forwarding', () => {})describe('scpArgs', () => {- it('reuses the master socket, uses scp -P for the port, and quotes the absolute remote path', () => {+ it('reuses the master socket, uses scp -P for the port, and passes the RAW absolute remote path', () => {const j = scpArgs(conn, '/s.sock', '/local/i m.png', '/home/u/.nodeterm/uploads/t/i m.png').join(' ')expect(j).toContain('-o ControlPath=/s.sock')expect(j).toContain('-o BatchMode=yes') // fail fast on a fallback connection (no tty prompt)expect(j).toContain('-P 2222') // scp uses uppercase -Pexpect(j).toContain('-i /k/id') // identityFile- // local path raw; remote spec is user@host:<posixQuote(remotePath)>- expect(j).toContain(`/local/i m.png [email protected]:'/home/u/.nodeterm/uploads/t/i m.png'`)+ // Modern scp uses SFTP (no remote shell), so the remote path must be RAW (NOT quoted) — a quoted+ // path makes the SFTP server open a file literally named `'…'`. SFTP handles spaces literally.+ expect(j).toContain(`/local/i m.png [email protected]:/home/u/.nodeterm/uploads/t/i m.png`)})})diff --git a/src/main/remote-ssh/control-master.ts b/src/main/remote-ssh/control-master.tsindex 1a26a725f..a1a64bef4 100644--- a/src/main/remote-ssh/control-master.ts+++ b/src/main/remote-ssh/control-master.ts@@ -3,7 +3,7 @@import os from 'os'import path from 'path'import { createHash } from 'crypto'-import { posixQuote, quoteRemotePath, remoteTmuxCommand, type SshConnection } from '../../shared/ssh'+import { quoteRemotePath, remoteTmuxCommand, type SshConnection } from '../../shared/ssh'/** Dedicated remote tmux socket so an SSH project never collides with the user's own tmux. */export const RMT_TMUX_SOCKET = 'nodeterm-rmt'@@ -89,11 +89,16 @@ export function mkDirArgs(conn: SshConnection, controlPath: string, path: string}/** scp argv that reuses the project's ControlMaster. `localPath` is a raw local arg; the absolute- * `remotePath` is posixQuote'd (the remote shell interprets it). scp uses `-P` for the port. */+ * `remotePath` is passed RAW (NOT posixQuote'd). Modern scp (OpenSSH 9+) uses the SFTP protocol by+ * default and does NOT run the remote path through a shell — it opens the literal string after the+ * `host:`, so a quoted path makes the SFTP server look for a file literally named `'…'` (the upload+ * then silently fails). Leaving it raw means SFTP opens the exact absolute path (spaces and all);+ * there is no remote shell, so no quoting is needed and no injection is possible (`fileName` is also+ * basenamed by the caller, and the path is absolute). scp uses `-P` (uppercase) for the port. */export function scpArgs(conn: SshConnection, controlPath: string, localPath: string, remotePath: string): string[] {const args = ['-o', 'ControlMaster=no', '-o', `ControlPath=${controlPath}`, '-o', 'BatchMode=yes', '-P', String(conn.port ?? 22)]if (conn.identityFile) args.push('-i', conn.identityFile)- args.push(localPath, `${conn.user}@${conn.host}:${posixQuote(remotePath)}`)+ args.push(localPath, `${conn.user}@${conn.host}:${remotePath}`)return args}diff --git a/src/main/remote-ssh/ssh-project.test.ts b/src/main/remote-ssh/ssh-project.test.tsindex c45168b31..31064db14 100644--- a/src/main/remote-ssh/ssh-project.test.ts+++ b/src/main/remote-ssh/ssh-project.test.ts@@ -79,7 +79,7 @@ describe('SshProjectManager', () => {const out = await mgr.uploadFile('p1', '/local/img.png', 'img.png')expect(out).toMatch(/^\/home\/u\/\.nodeterm\/uploads\/[a-z0-9]+\/img\.png$/)// scp targeted that exact absolute remote path (conn is { host: 'h', user: 'u' }).- expect(scpCalls[0].join(' ')).toContain(`u@h:'${out}'`)+ expect(scpCalls[0].join(' ')).toContain(`u@h:${out}`)})it('uploadFile basenames a traversal fileName so it cannot escape the token dir', async () => {@@ -104,7 +104,7 @@ describe('SshProjectManager', () => {const out = await mgr.uploadFile('p1', '/local/evil', '../../evil')expect(out).toMatch(/^\/home\/u\/\.nodeterm\/uploads\/[a-z0-9]+\/evil$/)expect(out).not.toContain('..')- expect(scpCalls[0].join(' ')).toContain(`u@h:'${out}'`)+ expect(scpCalls[0].join(' ')).toContain(`u@h:${out}`)})it('connect writes + source-files the remote tmux.conf and returns its absolute path', async () => {