Summary
scripts/postinstall.mjs rebuilds/patches node-pty (pinned upstream hash in scripts/ensure-node-pty.cjs), fixes spawn-helper permissions, and if tmux is missing runs the system package manager (brew/apt-get/dnf/apk/pacman/zypper, prefixed with sudo on Linux) before writing ~/.termdock/.boot-check-ok. Runtime code (dist/server/quota/tokenDiscovery.js) reads agent credential stores — ~/.claude/settings.json, ~/.codex/auth.json, ~/.local/share/opencode/auth.json, ~/.kimi-code/credentials/kimi-code.json, ~/.copilot/config.json and OPENAI/CODEX/GITHUB/GEMINI/XAI/KIMI env keys — but uses those tokens only against the token owner's own API (api.anthropic.com, chatgpt.com/backend-api/wham/usage, api.openai.com, api.github.com, api.kimi.com, api.x.ai, generativelanguage.googleapis.com) to render quota bars; there is no third-party endpoint anywhere in dist/server. dist/server/agent/installers.js writes marker-guarded hooks into the same agents' configs pointing at its own emitter (dist/server/agentHook.js), and the emitter stays silent unless TERMDOCK is set or it is inside a tmux pane. Lab detonation: hook exited 1 on missing node-pty (no deps installed), 0 network connections, 0 DNS, no files written outside the package; the single canary read (/home/andy/.npmrc) came from npm itself during the `npm run-script postinstall` wrapper, not from package code. Treat the credentials and shell access as a product-level risk, not malware: install only where the agent's tokens may be used by a service that also exposes a shell on 0.0.0.0:9834 unless a password is set.
Intent
termdock is a real self-hosted web terminal / agent-pane manager (xterm + Express + node-pty + tmux, PWA client, Electron desktop shell, libp2p-based federation). Its install hook prepares node-pty and tmux, and its server-side "quota" feature deliberately reads installed CLI agents' OAuth tokens to call those same providers' usage APIs. Every capability I found maps to a documented feature; I found no concealment, exfiltration to third parties, or behavior mismatch.
credential_access network_egress agent_config_tamper code_execution reconnaissance
postinstall runs the system package manager with sudo when tmux is missing medium scripts/postinstall.mjs:94-145
scripts/postinstall.mjs:105-145 detects a missing tmux and runs brew/port/nix-env on macOS, or `sudo apt-get install -y tmux` / dnf / yum / apk / pacman / zypper on Linux (retrying without sudo on failure). scripts/postinstall.mjs:94-95 also runs `rm -rf <node-pty>/prebuilds/*` and `npx --yes node-gyp rebuild`, and scripts/ensure-node-pty.cjs:45-59 rewrites node-pty's src/unix/pty.cc (upstream hash pinned at line 7) before rebuilding. Documented in the hook's own log output and in README (tmux auto-install / mkcert via brew), but it is a privileged, non-interactive install-time action an operator should expect.
Runtime reads CLI agent OAuth tokens and API keys (quota feature) medium dist/server/quota/tokenDiscovery.js:14-265
dist/server/quota/tokenDiscovery.js:14-265 reads ~/.local/share/opencode/auth.json, ~/.claude/settings.json (oauthAccount.accessToken), ~/.codex/auth.json (tokens.access_token), ~/.kimi-code/credentials/kimi-code.json, ~/.kimi-code/config.json, ~/.copilot/config.json and env vars OPENAI_API_KEY, CODEX_API_KEY, CHATGPT_TOKEN, GH_TOKEN/GITHUB_TOKEN, GEMINI_API_KEY/GOOGLE_API_KEY, GROK_API_KEY/XAI_API_KEY, KIMI_API_KEY. Usage is confined to the owning provider: dist/server/quota/providers/claude.js:9 sends `Authorization: Bearer <token>` to https://api.anthropic.com/api/oauth/usage; codex.js:11-13 to chatgpt.com/backend-api/wham/usage and api.openai.com; copilot.js:8-9, kimi.js:8, grok.js:5, gemini.js:7 likewise. No token is written to disk or sent to any non-provider host.
Installs hooks into other agents' configuration files medium dist/server/agent/installers.js:54-282
dist/server/agent/installers.js:54-64 targets ~/.claude/settings.json, ~/.codex/hooks.json, ~/.copilot/hooks/termdock.json, ~/.config/opencode/plugins/termdock.js, ~/.pi/agent/extensions/termdock/index.ts, ~/.grok/hooks/termdock.json, ~/.kimi-code/config.toml; entries are marker-guarded (`agent-hook <slug>`) and user-authored hooks are preserved (lines 195-282, 286-301). The installed emitter dist/server/agentHook.js:186 exits silently unless TERMDOCK is set or TMUX_PANE exists, and only writes an OSC 777 sentinel to the pane tty (lines 159-177). This is an agent-supply-chain surface to review before adopting, not tampering for theft.
Service exposes a shell and filesystem browser; default bind is 0.0.0.0 info dist/server/entry.js:408-409
README ('默认监听 0.0.0.0:9834') and dist/server/entry.js:408-409 show the server binds all interfaces by default and warns when no password is set (auth stored in ~/.termdock/auth.json, mode 0600, scrypt). dist/server/routes/terminal.js and filesystem.js give the authenticated client terminal/PTY and file read/write access by design. Agents that install this package to a host with credentials should set a password or bind loopback.
Static prescreen hits are bundle artifacts, not obfuscation info dist/client/assets/App-C-sArfYM.js:61
The heavy obfuscation/ransomware/crypto_wallet tags on dist/client/assets (App-C-sArfYM.js, katex, cytoscape, mermaid, diffWorker, index-*.js) come from minified third-party bundles: base64 WebAssembly blobs (InWasm/'AGFzbQE' wasm headers) for xterm image/webp decoding, libp2p/@noble crypto in dist/client/sw-encrypted-background.js:1, `swiper:gesture-lock` strings matching a 'locked' ransomware regex, and `String.fromCharCode` terminal escape handling. `bit.ly`, `chevrotain.io`, `www.jetbrains.com` appear only in bundled library strings and third-party-notices.txt; the raw IP 192.168.1.23 is the LAN onboarding example in README.md:169. No decoded-and-executed payload was found in dist/server (only base64url pagination cursors and federation packet framing).
Lab detonation: no network, no unexpected writes, hook failed on missing deps info LAB REPORT
andy_detonate ran postinstall (exit 1: 'Cannot find module node-pty/package.json' at scripts/postinstall.mjs:52 — dependencies are not installed in the lab, so the tmux/sudo and rebuild paths were never reached) and a require of the entry (.desktop-dist/main.js, exit 0 with a missing electron preload module). 0 connect() calls, 0 DNS names, 0 HTTP requests, 0 files written outside the package. The one canary read of /home/andy/.npmrc is attributable to the npm wrapper (`npm run-script postinstall`), which is why it is not listed as a package IOC.
Install hooks ran in the isolated lab. Processes spawned: 6. Hooks: postinstall (exit 1), require (exit 0).
Canary credential files read: /home/andy/.npmrc