SPB Git

Repository Public

SECURITY.md 5.0 KB 76 lines markdown

1# NEXTERM — Security behaviour23## Process model and entitlements4* NEXTERM is **not App Sandboxed**: it must spawn the user's login shell, `ssh`, `git`, `tmux` and5  `claude` with the user's real environment and PTYs. Hardened Runtime is enabled; the only6  entitlement is `com.apple.security.network.client` (hook receiver on loopback, SSH is a child process).7  Consequence: distribution is Developer ID + notarization (not Mac App Store). See `docs/RELEASE.md`.8* macOS privacy (TCC) prompts for Desktop/Documents/Downloads/removable volumes are attributed to9  NEXTERM when a child process touches them, exactly as with Terminal.app. NEXTERM never pre-grants anything.10* Child processes are launched from argument arrays (`LaunchSpec`) — never from concatenated shell11  strings. The one remote-side command string (`cd '<dir>' && exec tmux …` over SSH) single-quotes12  every user value and strips control characters (`SSHCommandBuilder.shellQuote`, unit-tested).1314## Terminal output is untrusted15* SwiftTerm parses escape sequences; NEXTERM never interprets terminal text as application16  commands. Session state shown in the UI (pid, tty, cwd, foreground program) comes from the kernel17  (`tcgetpgrp`, libproc) or from OSC 7/OSC 0 title updates, which only set display strings.18* Claude status comes exclusively from Claude Code hook events — never from scraping the screen.19* Clickable links/paths go through SwiftTerm's `UntrustedTerminalLink` validation.2021## Clipboard and paste22* Multi-line pastes prompt for confirmation (Settings ▸ Behavior, on by default); bracketed paste is23  honoured by SwiftTerm and control bytes in pasted text are filtered (xterm `disallowedPasteControls`).2425## SSH26* Always `/usr/bin/ssh` with `StrictHostKeyChecking=ask`: unknown hosts prompt **in the terminal**,27  changed keys are refused by OpenSSH. There is no code path that sets `StrictHostKeyChecking=no`28  or `UserKnownHostsFile=/dev/null` (tested in `RemoteCoreTests`). Verified live on 2026-11-01:29  an unknown key produced OpenSSH's fingerprint prompt, "no" was answered and `known_hosts` was unchanged.30* Host aliases are placed after `--` so an alias can never be parsed as an option.31* Authentication uses the user's SSH agent/keys; NEXTERM stores no passwords, passphrases or keys.32  Host metadata (labels, tags, groups, favourites, tmux session, remote dir) is stored in SQLite.3334## Claude Code hooks (opt-in)35* Off by default. When enabled, NEXTERM runs an HTTP receiver on `127.0.0.1:<ephemeral port>` and36  writes `~/Library/Application Support/NEXTERM/hooks/hooks-settings.json` (mode 0600) containing37  `type: http` hooks with a per-launch random bearer token. Claude sessions started by NEXTERM get38  `--settings <that file>`; `~/.claude/settings.json` is never modified.39* The receiver authenticates with a constant-time token compare, accepts only `POST /hook`, caps40  bodies at 2 MB and **always returns an empty 200** — it cannot return `permissionDecision`,41  `decision`, `updatedInput` or any other directive, so it can never approve, deny or alter a tool call.42* Turning the toggle off (or quitting) stops the receiver and deletes the settings file. Sessions43  already running keep the file path on their command line until restarted.4445## Git46* Read operations only, plus `git worktree add` and `git worktree remove` of a *clean* worktree47  (the API has no force parameter; dirty worktrees throw `GitSafetyError`). No merge, push, reset,48  clean, checkout or branch deletion is exposed. Dangerous UI actions ask for confirmation.49* `GIT_TERMINAL_PROMPT=0` prevents credential prompts from hanging the app.5051## Process termination52* Closing a pane/tab/window or quitting with a foreground program running asks first53  (`tcgetpgrp` says whether something other than the shell owns the PTY).5455## Logging and telemetry56* No telemetry, no network calls other than the user's own SSH/Git/Claude processes.57* Diagnostics use `os.Logger` (subsystem `ai.spboucher.nexterm`); terminal contents are never logged.58  SwiftTerm's `setHostLogging` (raw PTY capture) is not enabled anywhere.59* The settings file can enable diagnostic logging; it only adds lifecycle messages.6061## Persistence62* SQLite at `~/Library/Application Support/NEXTERM/nexterm.sqlite` (WAL). All statements use bound63  parameters (`PersistenceCoreTests.parameterBindingIsSafe`). Stored: layouts, window geometry,64  pane profiles (kind, cwd, label, env overrides set by the user), settings, host metadata.65  Not stored: terminal scrollback, credentials, hook tokens.6667## Deep links68* `nexterm://pane|ssh|claude|mission-control` only act on already-configured hosts/panes and69  file-system paths that exist; nothing from a URL reaches a shell.7071## Known limitations72* The hook receiver trusts any local process holding the token (the file is 0600 and the token73  is per launch; a local attacker with the user's privileges could post fake events — these would74  only affect NEXTERM's status display, never Claude's permission flow).75* `--settings` merges with the user's own hook settings; NEXTERM cannot see or control those.76
Files main
Menu

Theme