SPB Git

Repository Public

SECURITY.md 6.8 KB 96 lines markdown

1# SP Term — Security, sandbox and privacy23## Distribution model45SP Term is distributed **outside the Mac App Store**, signed with a Developer ID Application certificate,6with the **hardened runtime** enabled and notarized by Apple when a notarization profile is available.78It is **not sandboxed**, by analysis rather than by convenience: the App Sandbox forbids what a terminal exists9to do. A sandboxed process cannot give its children unrestricted file access, cannot run arbitrary user-installed10tools with the user's own permissions, and `ssh`, `git`, package managers, compilers and editors launched from it11would all inherit the container. Mac App Store terminals work around this with helper tools or restricted shells;12SP Term chooses the honest model used by Terminal.app-class tools shipped outside the store.1314What still protects the user:1516| Mechanism | State |17|---|---|18| Hardened runtime | On. No `allow-jit`, no `allow-unsigned-executable-memory`, no `disable-library-validation`, no `get-task-allow`, no debugger entitlement. |19| Entitlements | Exactly one: `com.apple.security.automation.apple-events`, so that programs the user runs (e.g. `osascript`) can send Apple Events — each target still requires the user's consent in a system prompt. |20| TCC (privacy prompts) | Not bypassed. When a program in a session touches Desktop/Documents/Downloads, the local network, etc., macOS asks on behalf of SP Term; the usage strings explain that a program in a session triggered it. |21| Privileges | The app never asks for root, installs no helper, no launch agent, no kernel/system extension, and never touches SIP or Gatekeeper settings. `sudo` is whatever the user types in a shell. |22| Child processes | Started through `forkpty` + `posix_spawn(SETEXEC, CLOEXEC_DEFAULT)`: they inherit no file descriptor of the app (tested), get default signal handling and a cleaned environment (`DYLD_*`, `XPC_*` and debugging variables are stripped). |2324## Untrusted terminal output2526Program output — including output from remote hosts — is treated as untrusted input.2728- **Escape sequences**: parsed by the engine; malformed/unknown sequences are ignored (conformance + fuzz tests).29- **Window title** (OSC 0/2): control characters removed, length capped.30- **Clipboard** (OSC 52): *write* is `ask` by default (the text and the requesting program are shown), *read* is `deny` by default. Both are settings.31- **Links** (OSC 8 and detected URLs): `http`, `https`, `mailto` open directly on ⌘-click; `file:` is only revealed in Finder, never launched; `javascript:`/`data:` are blocked; any other scheme asks first.32- **Notifications**: only process name and duration are shown, never terminal text.3334## Paste and typed input3536- Several lines → confirmation with a preview where control characters are made visible (configurable).37- Text containing escape sequences or the bracketed-paste terminator → always asks, and the default action pastes a sanitized version.38- Sanitized pastes never end with a line break, so nothing runs before the user presses Return.39- Dropped files insert shell-escaped paths (round-trip tested against a real shell with hostile names).4041## Broadcast input4243Off at every launch (never persisted); enabling it shows which sessions will receive input and requires a44confirmation; a full-width banner and coloured pane borders stay visible; lines that look destructive or use45`sudo` are held for the other panes until the user types the confirmation phrase; cancelling clears the line46in the other panes. Automatic terminal replies are never broadcast.47Limit: the pane being typed in is a normal terminal — the line runs there as typed; the guard protects the fan-out.4849## SSH5051SP Term builds an argument vector for `/usr/bin/ssh` and lets OpenSSH do everything else.52Every field is validated against an allow-list (no leading `-`, no whitespace, no shell metacharacters); the53builder never emits `StrictHostKeyChecking`, `UserKnownHostsFile`, `BatchMode` or password options; extra `-o`54options go through an allow-list. Host key verification is therefore OpenSSH's interactive prompt in the55terminal; SP Term never answers it. Private keys are never opened. Passwords and passphrases are typed into the56PTY and are neither captured nor logged. Opening a host runs `ssh` only — no command is sent to remote hosts.5758## Assistant (SP Intelligence)5960Off by default. Guarantees enforced by types and tests:61621. No request without a preview: `AIClient.send` only accepts an `ApprovedPreview`, which can only be made from a `ContextPreview` the user has seen.632. The preview is the exact payload (destination, model, byte count, masked text). Secrets are always masked first.643. Terminal text is attached only when the user selects *Selected text* or *Last 60 lines*.654. Local-only mode refuses every non-loopback destination before any I/O; plain HTTP to a remote host is refused.665. API keys are stored in the Keychain (`ai.spboucher.spterm.ai`), sent in a header, and wrapped in a type whose description is redacted.676. Suggested commands are text. *Insert* types them without Return. *Review & Run* goes through the consent gate: full command, target, host, directory, risk reasons; destructive, sudo, network-transfer and multi-host commands need a typed phrase.6869## Data at rest7071`~/Library/Application Support/SP Term/` is created 0700; files are 0600 and written atomically. Stored: settings,72layouts (titles, directories, session kinds), snippets, SSH profile metadata, provider metadata, and — only if73enabled — a history of commands run from snippets/assistant/broadcast with secrets masked. **Not stored**: terminal74output, keystrokes typed at prompts, API keys, SSH credentials. Private mode stops layout and history writes and75deletes the saved layout.7677## Plugins and extensions7879There is no plugin system and no scripting bridge: SP Term loads no third-party code and exposes no automation80interface that could run commands. If one is added later, the policy is: explicit installation by the user,81signed bundles only, a declared capability list shown at install time, no access to terminal content or to82"run a command" without the same consent gate as the assistant, and nothing enabled by default.8384## Updates8586No update mechanism is active: no feed URL exists for this build, and shipping a self-updater without a signed,87reliable feed would be a liability. Sparkle (EdDSA-signed appcasts) is the intended mechanism once a distribution88URL exists.8990## Known limits9192- The risk analyzer and the secret redactor are pattern based: `safe` means "no known risky pattern", and an93  unusual secret format can pass unmasked — the preview exists so the user can check.94- A program running in a session has the user's full permissions; SP Term does not confine it.95- Exported session files contain whatever was on screen (masked by default); they are created 0600.96
Files main
Menu

Theme