Skip to content

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.

docs(server): say plainly that --canvas-control grants execution on the host

Howard Youngdahld4b92adf74d0
diff --git a/docs/SERVER.md b/docs/SERVER.md
index c61589da3..9bfa2c261 100644
--- a/docs/SERVER.md
+++ b/docs/SERVER.md
@@ -530,7 +530,12 @@ directory**.
Server canvas control is disabled by default. Set `NODETERM_SERVER_CANVAS_CONTROL=1` (or pass
`--canvas-control`) to install the Server-local shim and enable its `/control/*` implementation.
-Every enabled request requires verified node identity.
+Every enabled request requires verified node identity. **Enabling it lets an agent session run
+arbitrary commands on this host as the user the server runs as** — `open-terminal --cmd <command>`
+is executed in a PTY this process spawns, with that user's environment, files and credentials. The
+gates below decide *which* agent may ask, not *what* may be asked for, so the surface this flag
+opens is the host, not the canvas. Enable it on a host where you would be content to hand those
+agents a shell.
Ownership is intentionally narrower than the desktop confirmation UI: an agent may mutate, message,
or close only a node it opened during the current Server process run. Link, group, rename, color,
diff --git a/src/server/config.ts b/src/server/config.ts
index 88c411e9d..aae60c34e 100644
--- a/src/server/config.ts
+++ b/src/server/config.ts
@@ -36,9 +36,17 @@ export type ServerConfig = {
* Enable the Server Edition `/control/*` canvas runtime. Defaults OFF so an upgrade cannot
* silently grant agents a new local execution surface. Environment:
* NODETERM_SERVER_CANVAS_CONTROL=1;
- * CLI: --canvas-control. Hook endpoint authentication and per-project capability gates still
- * apply when enabled. The server-process env name is deliberately distinct from the
- * per-session NODETERM_CANVAS_CONTROL discovery bit injected by HookServer.
+ * CLI: --canvas-control.
+ *
+ * Enabling it lets an agent session run arbitrary commands on this host as the user the server
+ * runs as: `open-terminal --cmd <command>` is executed in a PTY this process spawns, with that
+ * user's environment, files and credentials. Hook endpoint authentication, verified node
+ * identity and per-project capability gates still apply when enabled, but they decide WHICH
+ * agent may ask, not WHAT may be asked for — the surface this flag opens is the host, not the
+ * canvas. Boot announces it on stdout for the same reason (see startServer).
+ *
+ * The server-process env name is deliberately distinct from the per-session
+ * NODETERM_CANVAS_CONTROL discovery bit injected by HookServer.
*/
canvasControl?: boolean
/**
diff --git a/src/server/index.ts b/src/server/index.ts
index 35ed2c076..56797b9e4 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -116,6 +116,22 @@ function readAppVersion(): string {
}
}
+/**
+ * Name the account this process runs as, for the canvas-control boot notice. `os.userInfo()`
+ * THROWS a SystemError when the effective uid has no password-database entry — the normal case for
+ * a container started with an arbitrary uid — so it is never called bare on a boot path: the log
+ * line exists to inform the operator, and it must not be able to take the feature they enabled
+ * down with it. Falls back to the numeric uid, and then to a plain phrase on a platform with none.
+ */
+function serverUserLabel(): string {
+ try {
+ return os.userInfo().username
+ } catch {
+ const uid = typeof process.getuid === 'function' ? process.getuid() : null
+ return uid === null ? 'the server user' : `uid ${uid}`
+ }
+}
+
/**
* This host's Server-Edition install metadata (spec: server-update), surfaced to the phone via the
* agent-status mirror's top-level `server` block. `scripts/install-server.sh` writes
@@ -598,6 +614,21 @@ export async function startServer(
error
)
}
+ if (canvasControl) {
+ // Loud on purpose, and in the same register as the proxy-trust line above: this is the
+ // operator's one chance to notice that a flag reading as "canvas control" also hands agent
+ // sessions the ability to run commands as this user. An operator who took "opt-in canvas
+ // control" and "creator ownership" at face value could reasonably size the blast radius as
+ // the canvas; it is the host. Printed only when the runtime actually came up, so a failed
+ // init never announces a capability that is in fact disabled.
+ console.log(
+ `⚠️ Server canvas control ENABLED: agent sessions with verified node identity can run ` +
+ `arbitrary commands on this host as ${serverUserLabel()} (open-terminal --cmd), with ` +
+ `this user's environment, files and credentials. Creator ownership and the per-project ` +
+ `capability gates decide which agent may ask, not what may be asked for. Unset ` +
+ `NODETERM_SERVER_CANVAS_CONTROL / drop --canvas-control to turn it off.`
+ )
+ }
}
// Session budget (docs/SERVER.md): reap long-idle DETACHED nt- tmux sessions under memory
diff --git a/test/server/canvas-control-boot-e2e.test.ts b/test/server/canvas-control-boot-e2e.test.ts
index 419b7d6fb..c4988fd02 100644
--- a/test/server/canvas-control-boot-e2e.test.ts
+++ b/test/server/canvas-control-boot-e2e.test.ts
@@ -3,7 +3,7 @@ import fs from 'node:fs'
import os from 'node:os'
import path from 'node:path'
-import { afterAll, beforeAll, describe, expect, it } from 'vitest'
+import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'
import { sessionName, TMUX_SOCKET } from '../../src/core/tmux-naming'
import { startServer } from '../../src/server/index'
@@ -36,6 +36,9 @@ describe.skipIf(!hasTmux)('disposable Server boot rescue', () => {
let dataDir = ''
let projectDir = ''
let close: (() => Promise<void>) | undefined
+ // Everything startServer printed while booting with canvasControl on. Captured rather than
+ // asserted through a spy call count because the boot logs several unrelated lines.
+ const bootLogs: string[] = []
beforeAll(async () => {
dataDir = fs.mkdtempSync(path.join(os.tmpdir(), 'nt-server-boot-rescue-'))
@@ -75,6 +78,9 @@ describe.skipIf(!hasTmux)('disposable Server boot rescue', () => {
fs.writeFileSync(path.join(dataDir, 'workspace.json'), JSON.stringify(workspace), 'utf8')
expect(backendExists()).toBe(false)
+ const log = vi.spyOn(console, 'log').mockImplementation((...args: unknown[]) => {
+ bootLogs.push(args.map((a) => String(a)).join(' '))
+ })
const server = await startServer({
port: 0,
host: '127.0.0.1',
@@ -86,6 +92,7 @@ describe.skipIf(!hasTmux)('disposable Server boot rescue', () => {
canvasControl: true,
headless: false
})
+ log.mockRestore()
close = server.close
}, 30_000)
@@ -106,6 +113,17 @@ describe.skipIf(!hasTmux)('disposable Server boot rescue', () => {
fs.rmSync(projectDir, { recursive: true, force: true })
})
+ // The flag reads as "canvas control", but what it grants is command execution as the server's
+ // own user. An operator who never opens docs/SERVER.md still has to be told, so boot says it —
+ // and this pins that it is actually said, on a real boot with the flag on.
+ it('announces at boot that the flag grants command execution on this host', () => {
+ const notice = bootLogs.find((line) => line.includes('Server canvas control ENABLED'))
+ expect(notice).toBeDefined()
+ expect(notice).toContain('arbitrary commands on this host')
+ expect(notice).toContain('open-terminal --cmd')
+ expect(notice).toContain('NODETERM_SERVER_CANVAS_CONTROL')
+ })
+
it('leaves a persisted queued node dormant when no backend exists', () => {
expect(backendExists()).toBe(false)
const persisted = JSON.parse(