# Security overview & threat model

Vaultport handles private keys, passwords and access to production infrastructure. This section summarizes how it protects them. The design principles:

1. **No servers.** There is no backend, no account system and no telemetry. Nothing can be breached on our side because there is nothing on our side.
2. **Secrets never leave the Rust core.** The web UI only handles opaque identifiers; private keys and passwords are decrypted inside the core, used, and wiped.
3. **Untrusted by default.** Servers, sync storage, cloud APIs, import files and model output are all treated as potentially hostile input.
4. **Secure defaults.** Strict host-key verification, post-quantum key exchange preferred, modern algorithms only unless you opt in, no input recording.

## Assets

| Asset                               | Where it lives                                                                   |
| ----------------------------------- | -------------------------------------------------------------------------------- |
| Private keys, passwords, API tokens | Vault secrets (encrypted), hardware tokens, Secure Enclave / Windows Hello / TPM |
| Hosts, groups, snippets, settings   | Vault records (encrypted)                                                        |
| Trusted host keys                   | Vault records (encrypted)                                                        |
| Session output                      | Encrypted session logs on the recording device                                   |

## Threats considered

| Adversary                                              | Mitigation                                                                                                                                                                                                   |
| ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Someone with a copy of your vault file or backup       | XChaCha20-Poly1305 encryption, Argon2id (256 MiB desktop / 64 MiB mobile) against offline guessing; optional two-factor unlock (password + security key) — see [key slots](http://vaultport.niessen.dev/security/vault-crypto.md#key-slots) |
| Other programs or people using your OS account         | Windows Hello / Touch ID unlock bound to TPM / Secure Enclave keys; PIN attempts limited by the app; auto-unlock is opt-in and documented as unprotected — see [key slots](http://vaultport.niessen.dev/security/vault-crypto.md#key-slots) |
| Your sync storage provider or anyone with access to it | Ciphertext only; per-device hash chains detect forged, reordered, rolled-back or dropped data — see [Sync protocol](http://vaultport.niessen.dev/security/sync.md)                                                                          |
| A network attacker (man-in-the-middle)                 | Host-key verification on every hop, `@revoked` and CA support, strict KEX (Terrapin mitigation) — see [Host-key policy](http://vaultport.niessen.dev/security/host-keys.md)                                                                 |
| A future quantum adversary recording traffic           | `mlkem768x25519-sha256` hybrid key exchange preferred by default                                                                                                                                             |
| A malicious or compromised SSH server                  | Read-only in-process agent, validated SFTP file names, no symlink following on delete, OSC 52 clipboard writes need consent                                                                                  |
| A compromised dependency in the web UI                 | Secrets never reach the UI; Tauri isolation pattern, strict CSP, frozen prototypes, least-privilege capabilities — see [App isolation](http://vaultport.niessen.dev/security/app-isolation.md)                                              |
| Malicious import files                                 | Size limits, bounded nesting, panic-free parsers, validation of every entity                                                                                                                                 |
| Prompt injection into an AI agent via server output    | Agents never see secrets; every change needs approval in the app, read-only mode and host scope, audit log — see [below](#ai-agents-over-mcp)                                                                |
| Prompt injection into the local AI                     | Remote text framed as data, grammar-constrained output, validation, never auto-executed                                                                                                                      |
| A tampered download                                    | SHA-256 checksums, Sigstore signatures, build-provenance attestations, SBOM — see [Supply chain](http://vaultport.niessen.dev/security/supply-chain.md)                                                                                     |

## AI agents over MCP

[Agent access](http://vaultport.niessen.dev/guide/ai-agents.md) lets local AI tools call Vaultport over the Model Context Protocol. It is off by default and desktop-only.

- **Reachability:** a `0600` Unix socket or a local-only, per-user named pipe; no network listener. Connections must present a 256-bit token from a `0600` file, and on macOS and Linux the peer's user id must match.
- **Secrets:** tools never return passwords, keys or vault data. Vaultport opens connections itself, with full host-key verification.
- **Authority:** the agent can only use the tools you allow (read-only mode), on the hosts you allow (host scope). Every call that changes something needs your approval in the app, with the exact command, path or content shown; approvals time out (denied) after 5 minutes; session grants end when the agent disconnects or the vault locks. A locked vault refuses all calls.
- **Residual risk — prompt injection:** output from your servers (logs, files, command output) flows into the agent's context and may contain instructions aimed at the model. Vaultport cannot detect this. **Approvals are the control**: review each action, prefer _Allow once_ for anything destructive, and use read-only mode or a host allow-list when exploring. Also remember that what the agent reads is sent to wherever the AI tool runs its model.

## Out of scope

- Vulnerabilities in the SSH servers you connect to.
- A fully compromised operating system, or a malicious application already running with the same privileges as Vaultport. Such an attacker can read process memory while the vault is unlocked.
- Denial of service by the user against their own device.

## Hardening in the Rust core

- `unsafe` code is denied across the workspace.
- Pure-Rust cryptography (`ring` and RustCrypto); no OpenSSL.
- Secret material is held in zeroizing buffers and redacted from `Debug` output and logs.
- Parsers for untrusted input are written not to panic, use bounded memory, and are covered by property-based tests.

## Read more

- [Vault cryptography](http://vaultport.niessen.dev/security/vault-crypto.md)
- [Sync protocol](http://vaultport.niessen.dev/security/sync.md)
- [Host-key policy](http://vaultport.niessen.dev/security/host-keys.md)
- [App isolation](http://vaultport.niessen.dev/security/app-isolation.md)
- [AI agents (MCP)](http://vaultport.niessen.dev/guide/ai-agents.md#security-model)
- [Supply chain](http://vaultport.niessen.dev/security/supply-chain.md)
- [Reporting a vulnerability](http://vaultport.niessen.dev/security/disclosure.md)
