Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Security model

What Surjection guarantees about your secrets and your client files, and what it does not. To report a vulnerability, see SECURITY.md. The design is in SPEC.md sections 11 and 17.

What Surjection touches

Surjection reads and writes:

  • its own data directory (SURJECTION_HOME): the store, state/, servers/ (local copies of MCP servers that run from their repository), backups/, cache/, logs/;
  • the MCP config files and skill folders of the clients listed in adapters.md, at user scope and in the project folders you add;
  • your OS keyring (entries under the service surjection, and loadout for entries Loadout made) and, when you use it, the 1Password CLI op.

It uses the network only for remotes you add, git sources of skills and MCP servers, online catalogs (off until you turn them on), "Check this address" for a remote MCP server (only for a host you allowed), the optional update check, and the optional SkillSpector scanner (off until you turn it on; see below). Everything else, the built-in scan included, works offline.

Secrets

  • No secret values in the store. Servers refer to secrets by alias (${secret:ALIAS}); secrets.toml holds provider references (env:, keyring://, op://, op-env://), never values. Because the store has no values, pushing it to a remote does not publish secrets.
  • Leak scanner. Every store commit is scanned; a commit that contains something that looks like a secret value is refused before anything is written. surject doctor --scan-history scans older commits too (it reports, and never rewrites history). surject import replaces a literal that looks like a secret with a reference and sends the value to the OS keyring, or maps it to a 1Password item or an environment variable, as you choose; without a choice it skips the entry (needs_secret_extraction). The SkillDock migration asks where each plaintext value should go and stores only a reference.
  • No values across IPC. The desktop app's backend never sends a secret value to the frontend. Previews mask values.
  • Delivery. By default (launch delivery), clients start surject exec, which fetches values into memory and starts the real server with them; nothing is written to disk. env delivery lets the client expand an environment variable itself. command delivery lets the client run a Surjection command at connect time. Only inline delivery writes a value into a client file, only when you opt in for a server, and never into a shared project file.
  • Missing secrets block, never blank. A server whose secret does not resolve on this machine is reported as blocked for the clients that need it instead of being written with an empty value.
  • 1Password service account tokens (optional) are kept in the OS keyring and passed only to op, never to the server. The tradeoff is a long-lived token at rest in the keyring.
  • Ledger hashes are keyed. The ownership ledger stores HMAC-SHA256 hashes of what was written, with a per-machine key, so an inline value cannot be guessed offline from the ledger.

Client files

  • Foreign entries are never touched. Surjection edits, disables or removes only entries it wrote or that you adopted, as recorded in the machine-local ownership ledger. Everything else in a file (other entries, comments, formatting) stays byte for byte the same.
  • Backups before every write. Each file is copied to backups/files/<time>-<apply-id>/ before it is changed (user-only permissions). surject restore --files <apply-id> restores the copies. Backups can contain values from your client files, so they are never pushed to remotes.
  • Old secret values in backups. When an import moves literal secrets out of a client file, the backup its apply took still holds them. The import lists those backups (file paths only; values are compared in memory during the import and never stored, logged or returned) and offers to remove them: Remove those backups now in the app, or surject import --remove-old-backups[=<apply-id>]. Removal overwrites each listed backup with zeros in place (same file, same length, flushed to disk), then deletes it. Copies the system keeps elsewhere are out of reach: SSDs (wear leveling), copy-on-write file systems, snapshots and backup tools such as OneDrive, Time Machine or File History may still hold the old bytes. The recorded path is never trusted on its own: only that run's own backup of that file, as a regular file (not a link or junction), is touched. The run's result in state/applies/ records the removal as soon as the zeros are written, so a later rollback or restore --files says that file's previous content is no longer kept and never writes a zeroed copy back. Not covered: backups of earlier apply runs, and an import in review mode or an entry left a collision to decide, where no apply rewrote the file yet. The import then says the file still holds the old values; the backups of the apply that rewrites it later are not marked, so delete that run's folder under backups/files by hand or let retention prune it (50 runs or 30 days).
  • Atomic, checked writes. A file is written to a temporary file in the same folder and renamed into place (ReplaceFileW on Windows); before that, Surjection re-parses the result and checks that its own entries are as intended and every other entry is unchanged. A file that changed on disk between planning and writing is re-planned.
  • Drift is reported, not reverted. Hand edits of managed entries are shown as drift and wait for your decision.
  • Read-only files are left alone. A file or folder your account cannot write is found before the apply by a check that never writes (it never creates, truncates or changes a file) and its entries are blocked (read_only_target); a write the system refuses later is reported the same way. Surjection never changes permissions, attributes or ownership to get a write through.

Projects

A project manifest can define stdio servers, which run programs. Adding a project folder is therefore like running code from it, so:

  • Surjection applies a manifest only after you trusted its exact content (a SHA-256 of both manifest files, recorded per machine in state/trust.json).
  • A changed manifest (for example after git pull) is blocked until you review the diff and trust it again (surject project trust PATH, or Review change & trust). User scope and other projects keep applying.
  • New manifests are private (project.local.toml, hidden from git) unless you choose to share them.

Clients have their own trust prompts for project servers (Claude Code, Codex, Gemini CLI, Grok Build); Surjection does not bypass them.

Skills

Skill archives are checked for path escapes (zip slip) and links pointing outside the skill, and limited in size and file count. Surjection never replaces a skill folder it does not own; such folders are reported as unmanaged or mismatched and can be imported or moved to the trash.

Every skill install and update is scanned offline by Surjection's built-in rules (crates/surjection-core/src/scan/rules.toml): remote code execution idioms, credential reads next to network calls, hidden Unicode and HTML-comment instructions, prompt injection, disabled safety prompts and native binaries. A dangerous verdict blocks unless you explicitly install anyway (--allow-dangerous, Install anyway); trusting a source never skips the scan. No content leaves the machine. The scan is a second opinion, not a guarantee: patterns can be evaded, so read what you install. A custom rules file at state/scan-rules.toml is merged into the built-in rules: it can add rules or raise a severity, never remove or lower a built-in rule, and every result says "custom rules in use". An instruction to write that file is itself flagged (agent-config-write).

Trust in a git source is an explicit, recorded decision (store/sources.toml, #24). Trust is never implicit: the first install or update from a source asks, --yes never answers that question, and a run without a terminal (a script, --json) fails with source_trust_required instead of trusting. Two explicit opt-ins do work without a terminal: surject source trust <URL|KEY> and --trust-source on skills add, skills update, server add --from, server update and server checkout. A coding agent that can run shell commands can run them too, so they don't stop an agent you've given a shell; they make the decision deliberate and recorded (via = "cli-command" or "cli-flag" in sources.toml). Keeping agents from approving trust on their own is the narrower scope of #8. A block wins over any trust. Trust lapses, and the next update asks again, when the repository's history is rewritten (the installed commit is no longer in the followed branch) or the host redirects it to another repository (renamed or transferred). A redirect can only add a question, never answer one. Sources over plain http:// or git:// have their own keys: HTTPS or SSH trust never admits them, a block on either form does, and they are never marked official. Credentials in a URL are used only for the fetch: they are not stored in sources.toml, a server file or a checkout's git config, and messages show them as ***. A blocked source is never contacted. Trust never skips the scan.

Optional second scanner: SkillSpector

NVIDIA SkillSpector 2.13.7 can scan skills as a local second opinion (off by default; Settings > Security or surject scanner enable, per machine). Surjection never bundles it: it runs uvx --python 3.13 --exclude-newer 2026-11-25T00:00:00Z --from skillspector==2.13.7 skillspector once you prepared it, or a skillspector you installed on PATH. --exclude-newer pins the whole dependency set to versions published before that date, and the check, Prepare and every scan pass the same arguments, so uv never resolves anything else. When no uv is on PATH, Set up SkillSpector (or surject scanner setup) installs a private uv for that, described below.

What leaves the machine, exactly: SkillSpector runs on this computer and never uploads the skill. Nothing leaves this machine except the names and versions of the skill's dependencies, sent to OSV.dev (api.osv.dev) to look up known vulnerabilities, when the skill has a dependency manifest (requirements.txt, package.json, pyproject.toml or Pipfile). Preparing the uvx form once downloads SkillSpector 2.13.7 and its dependencies (a few hundred MB) from PyPI, and a Python 3.13 build when uv has none; scans themselves never download anything. Set up (when uv is missing) also downloads uv 0.13.10 (about 16 MB) from GitHub once, checked against SHA-256 values built into Surjection, and keeps it, its cache and the Python it downloads inside Surjection's data folder; Remove deletes them. No account, no token, no upload of skill content. Surjection runs it only on skills, never on MCP servers (SkillSpector does not read MCP client configs), and only when you turn it on (or pass --external).

How each run is contained:

  • Static only. The command is exactly skillspector scan --no-llm --format json --fail-on-incomplete -- <copy>; uv runs it with --offline. Never a flag that follows references, downloads packages, loads a baseline the skill ships, or calls an AI provider.
  • A copy of what will be written. The skill is staged in cache/scan-external/run-<random>/ and that folder is removed after the run. Stdin is closed; output is read from stdout (at most 16 MiB).
  • Scrubbed environment. The child starts from an empty environment plus what Python and uv need (system, profile, locale, proxy and CA variables, uv's cache folders) and its own temp folder. AI provider keys (OPENAI_*, ANTHROPIC_*, AWS_*, NVIDIA_*, GOOGLE_*, LANGSMITH_*, ...) and your SKILLSPECTOR_* never reach it; LANGSMITH_TRACING=false and LANGCHAIN_TRACING_V2=false are set. Surjection sets SKILLSPECTOR_LOG_LEVEL=INFO to follow its progress: only the names of SkillSpector's own checks that Surjection knows reach the app ("7 of 22 checks done"); its log lines are never shown, stored or sent.
  • Bounded. 600 s per scan by default (120 s before 1.0.1); on timeout or cancel the whole process tree is killed (Windows Job Object, Unix process group).
  • Never weaker than the built-in scan. A dangerous result needs the same explicit install anyway; a run that fails, times out or prints something Surjection cannot read is "not scanned" or "not understood", never clean, and a partial scan is "not fully scanned". While it is on and ready, every update and every install with Install after both scans must carry its report.
  • Install now is your choice. With Install now; SkillSpector checks in the background, the skill is installed after the built-in scan (whose dangerous verdict still needs Install anyway), and SkillSpector scans the installed copy afterwards: a review scan still running is canceled first, and a canceled, failed or timed-out review scan never skips that background scan. Until it answers, the skill can be in use without its second opinion. A dangerous result raises a warning that stays until closed, with Disable everywhere. The choice is stored only on this computer and starts as Install after both scans.
  • Cached results. Finished scans are kept in cache/skillspector/, keyed by a hash of the content, the SkillSpector version and the exact arguments (including the --exclude-newer date), so a result is reused only for the same content scanned the same way. Changed content, another version or other arguments scan again; Scan again always does.

The private uv (Set up)

Set up downloads uv only when no uv/uvx is on PATH; a uv you installed is always used instead and never touched.

  • Hosts. The uv archive comes from github.com (the astral-sh/uv release), following redirects one at a time, over https only, and only to github.com, objects.githubusercontent.com or release-assets.githubusercontent.com. Through that uv, Prepare then fetches SkillSpector and its dependencies from PyPI and Python 3.13 from python-build-standalone (GitHub releases), as uv does.
  • Pinned by hash. The archive's SHA-256 and size, and those of the uv and uvx inside it, are compiled into Surjection (uv_pin.rs, uv 0.13.10), never fetched at install time. A mismatch deletes the download and installs nothing (scanner_verification_failed). Only those two files are extracted: any other entry, a link, an absolute path or a .. path is never written. Before each use Surjection re-hashes them; a changed file makes the private uv read as not installed.
  • What is written where. Only <SURJECTION_HOME>/tools/uv/: 0.13.10/ (uv, uvx, installed.json), and uv's own cache/, python/, python-bin/, tool/, tool-bin/ and credentials/. Every process started through it gets UV_CACHE_DIR, UV_PYTHON_INSTALL_DIR, UV_PYTHON_BIN_DIR, UV_TOOL_DIR, UV_TOOL_BIN_DIR and UV_CREDENTIALS_DIR pointing into that folder, UV_PYTHON_INSTALL_BIN=0, UV_PYTHON_INSTALL_REGISTRY=0 (no Windows registry entries), UV_NO_CONFIG=1 (no user or project uv.toml) and UV_MANAGED_PYTHON=1 (only the Python it downloads into its own folder), replacing any UV_* you set. Nothing is added to PATH, the profile or the registry. Your own uv runs with your environment as before.
  • Reversible. Remove in Settings > Security, or surject scanner remove, deletes tools/uv/ entirely: uv, its cache, SkillSpector's environment and the Python it downloaded.

SkillSpector's bundled YARA rules partly derive from Neo23x0 signature-base (Detection Rule License 1.1); Surjection ships none of them.

MCP servers from a Git repository or folder

surject server add --from and the app's From Git or folder run nothing while they propose servers: git clones shallow into a temporary folder (repositories cannot install git hooks, submodules are not fetched) and the files are only read and scanned. A blocked source is not contacted at all. A saved server, though, runs its command every time a client starts it, and a server that is the repository itself (npx -y github:owner/repo#<sha>, a clone kept in SURJECTION_HOME/servers/<id>) runs that repository's code, including npm and pip install scripts. So every save and update goes through source trust (git sources and local folders alike) and then the built-in scan of the files and of the exact command line saved, and commands are pinned to the reviewed commit or package version. Secret values are never copied from a source: declared secrets become references, and a literal that looks like a secret in a committed config is replaced by a reference and dropped. Dependency and build folders (node_modules, dist, .venv, ...) are not scanned, so a server that runs from dist/ relies on the repository you trusted. A Docker draft's image is local only (surjection-local/..., never pulled). A checkout runs only at the commit its server file names: a stale copy (another machine updated the server) blocks the server's entries until surject server checkout restores it behind the same gates, and a folder's server never runs on another machine.

Catalogs (network use)

Catalogs and the address check (below) are the only parts of Surjection that make HTTP requests of their own (besides the optional updater and the git your remotes and sources use).

  • Off until you turn it on. "Online catalogs" (online_catalogs in state/local-settings.toml, per machine) is off by default. While it is off, nothing contacts any catalog: searches answer from saved results, and refreshes and installs from a catalog fail with catalogs_off.
  • Only on your request, never in the background: a search, opening an entry, a refresh, an install from a catalog, or server update of a server added from a registry. Requests go only to the catalogs you turned on (a registry server's update check needs its catalog turned on at the same address), carry only your search words, and send no telemetry or identifiers besides a Surjection/<version> user agent.
  • Hosts contacted. The built-in catalogs contact registry.modelcontextprotocol.io, github.com (the Anthropic skills tap, through git) and skills.sh (its public search, GET https://skills.sh/api/search?q=<words>, the endpoint the open-source skills CLI uses; no account or token). The question before turning online catalogs on, and Settings > Catalogs, name the hosts of the catalogs you have turned on. A skills.sh answer that redirects to another site is refused, and skills.sh is never asked anything for an install: it is the git install of the skill's GitHub repository.
  • Each host needs your OK. Turning online catalogs on approves the hosts the question named (online_catalog_hosts). A host added later (skills.sh since 0.9.0, a catalog you add or turn on) is not contacted until you allow it: Browse asks with a short note (Allow, Not now; a Not now is remembered in online_catalog_hosts_not_now), Settings > Catalogs shows it waiting with an Allow button, and surject catalog online on allows it. An answer from before 0.9.0 approved registry.modelcontextprotocol.io and github.com.
  • Git installs are git sources. Skills and plugin servers installed from a tap, and skills.sh addresses, are git sources like any other: installing, updating and checking them for updates contacts the git host even with online catalogs off.
  • HTTP client: ureq with rustls and the operating system's certificate verifier (no OpenSSL); GET only, a 10 s connect and 20 s overall limit, an 8 MiB body cap (after decompression), at most 3 redirects, each of them https (a loopback registry follows none). Registry addresses must be https (http only for localhost) and carry no credentials. Proxies come from HTTPS_PROXY (then ALL_PROXY) for https and HTTP_PROXY (then ALL_PROXY) for a loopback registry, and NO_PROXY; a SOCKS or unreadable proxy is an error, never a direct connection. Git taps use the system git (shallow, sparse, metadata only; symbolic links in a tap are never read); no GitHub API is called. A tap address with a user name, password or token is refused (it would be saved in your synced store): use your git credential helper instead. Commit pins are full 40-character commits.
  • Catalog data is untrusted. Names, descriptions, publisher metadata and SKILL.md text are shown as plain text; icons and images are never fetched or rendered. "Official" is shown only for github.com/anthropics taps, and there only for plugins in the tap itself or from an Anthropic repository; registry entries show what the registry checks (namespace ownership), not a safety claim. A registry entry's repository is the publisher's claim and is labeled so. A marketplace that uses a name reserved for Anthropic elsewhere is flagged. Deleted registry entries are hidden and refused; deprecated ones are marked. The app opens an entry's links only when they are https.
  • Installing never bypasses the gates. A registry entry's server.json and a plugin's .mcp.json and mcpServers go through the review of servers from Git (secret extraction, source trust, the scan); skills go through the git skill install review. A registry draft's trust is keyed on what it runs (its package on its package registry, or a remote's host), never on the repository the publisher names. Plugin hooks, commands, agents, bin, monitors and workflows are never imported, and plugins from npm, archive or command sources are refused. Unpinned packages (no version, an npm tag, an OCI image without a digest) are marked "not pinned".
  • Cache: results are saved in SURJECTION_HOME/cache/catalogs (this machine only, keyed on the catalog's address) for 24 hours; stale results are labeled with their age, and a failed refresh keeps them.

Address check and client sign-in (network use)

"Check this address" (the Add server dialog) and surject server check find out what a remote MCP server asks for before it is added.

  • Only on your request, and only for a host you allowed. Nothing is sent when you paste or type an address. The first check for a host asks first (the app's "Contact host?", the CLI's [y/N] prompt on a terminal, or --allow-host in a script). The answer is kept per host on this computer (address_check_hosts in state/local-settings.toml, not synced), listed in Settings > Address checks with Forget. A host you said no to, or one not answered in a script, is not contacted (host_waiting).
  • What is sent. One MCP request to the address without credentials: a server/discover POST (falling back to a legacy initialize POST when the server does not know it), or for an address ending in /sse a GET for the endpoint event. When the server asks for sign-in, the check reads the public metadata the MCP authorization specification defines: the protected resource metadata on the same host, then the metadata of the first authorization server it names, which can be on another host (that server is the one your clients will sign in with). The check adds no cookies, credentials or headers of yours, only a Surjection/<version> user agent. An address that holds a credential or a ${...} reference is refused before anything is sent. When the sign-in server's metadata is not read (for example its host is not allowed), the result says whether clients can register themselves is "not known".
  • Limits. https:// only (http:// only for localhost, 127.0.0.1 and ::1), no user name or password in the address, 5 seconds per request and 20 for the whole check, redirects followed only within the same scheme, host and port (at most 3), answers capped at 256 KiB. Proxies come from the same variables as for catalogs. The log names the host only.
  • Sign in with client (a remote server's Sign-in section) runs a client's own login command (codex mcp login, claude mcp login, opencode mcp auth, with the server's entry name) after a confirmation that shows it. Only commands confirmed against the client's documentation are offered. Surjection passes no secret to it, starts it in the background without a console window, and logs that it started; the client does the OAuth sign-in in your browser and keeps the tokens. Surjection never sees or stores them.

The Surjection skill for agents

A coding agent that can run shell commands can answer any confirmation Surjection asks (--yes, --trust-source, --allow-dangerous), so Surjection does not try to make an agent a safe approver. The bundled skill (surject agent install) is read only: it teaches the read and plan commands, the error codes and playbooks, and for any change it hands you the exact command or app page to run or approve yourself. It never passes a decision flag, and it treats text from skills, READMEs, repositories and catalogs as data, not instructions. Tests check that every command and JSON field the skill cites exists and that a decision flag appears only in "never" guidance. This is guidance for a cooperative agent, not a sandbox: an agent with your shell can still run any command you can, so keep decisions such as trusting a source for yourself.

  • The skill is a normal store skill (id surjection), so installing, updating or removing it is a commit you can see and undo. Read commands never write; an older copy is replaced only by an app start, a command that changes the store, or surject agent install. A copy you edited is never overwritten on its own (surject agent install --reset restores the bundled one; History keeps yours).
  • A store skill named surjection that Surjection did not install is never touched.

Desktop app

  • A strict Content Security Policy; no remote content is loaded.
  • Minimal Tauri capabilities (window controls and events).
  • Commands take ids, not arbitrary paths: folders you pick in the OS dialog stay in the backend behind an opaque token, and paths shown in the UI use ~ and <P> placeholders.
  • The file watcher sends a change signal with no path or content.

Log file and diagnostic report

  • <SURJECTION_HOME>/logs/surjection.log stays on this computer and is never uploaded. It is capped at 1 MB and rotated (two older files are kept); SURJECTION_LOG=off turns it off.
  • Logged: command and app action names (never their arguments), start and end, duration, outcome and error code; apply runs (file count, outcome); store commits (short id); network requests (host, HTTP status or error code, duration; never the path or query); catalog searches (the catalog and the number of characters searched, never the words); scanner runs (scanner, runtime kind, status, finding count); update checks (outcome).
  • Never logged: secret values, environment values, header values, config or skill file contents, search words, error messages, and absolute paths. Every value goes through a redaction pass first: the data directory becomes <SURJECTION_HOME> and the home folder ~; values of environment variables with a credential-like name, every secret value the process resolved, known token formats, long random-looking words and the userinfo and query of URLs are replaced with ***.
  • The diagnostic report (surject doctor --report, Copy diagnostic report in the app) is built only when you ask for it, from names, counts, sizes and yes/no answers, plus recent log lines, and goes through the same redaction. Remote addresses are never in it. The app's backend copies it to the clipboard with the system's clipboard program (clip.exe, pbcopy, wl-copy, xclip or xsel; the window gets no clipboard permission) or, when that fails, shows it to copy by hand; nothing is sent anywhere.
  • Log writes happen on a background thread; the CLI waits for it before it exits, so the last line of a command is never lost.

Releases

Windows installers are signed with Azure Trusted Signing; every release has SHA256SUMS. In-app updates (Windows installer and AppImage builds only) are verified against the project's updater public key. Builds you make yourself are unsigned.

Not covered

  • Surjection cannot protect values once a client or server has them, or values you chose to deliver inline.
  • The data directory is protected by your OS account permissions only.
  • Do not keep the data directory inside a file-sync folder; use a remote instead (surject doctor warns with sync_root_detected).