Security Model & Private Repositories
Understand per-user isolation, Linux Landlock LSP confinement, SSRF protection, SSH key custody, and untrusted source handling.
Cockpit Context handles both multi-user credentials and untrusted third-party dependency source code. Its security architecture separates user-owned state from shared public caches, confines language servers with Linux Landlock, blocks SSRF against internal networks by default, and encrypts saved SSH credentials at rest.
Per-User Isolation vs. Shared Public Storage
One Cockpit Context instance can serve many developers and agent harnesses, while keeping user workspaces strictly isolated:
| Resource | Isolation Boundary | Notes |
|---|---|---|
| Packages, notes, proposals | Owner-only | Foreign IDs return NOT_FOUND. |
| Conversations, runs, turns, pins | Owner-only | Admins cannot read other users’ conversations. |
| MCP API tokens & OAuth grants | Owner-only | Scoped strictly to /mcp; never access web oRPC or admin APIs. |
| SSH keys & confirmed known hosts | Owner-only | Saved private keys are encrypted with COCKPIT_CONTEXT_ENCRYPTION_KEYS and never returned. |
| Private SSH bare clones & checkouts | Owner-only | Never reused across users, even for identical repository URLs. |
| User-edited checkout overviews | Owner-only | Private overrides sit on top of shared generated overviews. |
| Public HTTPS bare clones, checkouts, repo maps & generated overviews | Shared | Reused across users to avoid redundant cloning and summarization. |
Administrative & Session Boundaries
- Least-privilege administration: Administrators manage users, site settings, background jobs, backup freshness, and repository storage metadata (including viewing private repo URLs/owners and deleting cached clones). Admins cannot read another user’s packages, conversations, overview overrides, SSH keys, or MCP tokens, nor can they impersonate users or directly set passwords.
- Immediate revocation & ban enforcement: Session cookie caching is disabled globally; every request verifies the live session row in PostgreSQL. Archiving or banning a user immediately deletes their browser sessions, revokes MCP/OAuth credentials, closes open SSE live streams, aborts in-flight MCP requests, and stops queued or running investigations.
- Forced admin 2FA: Administrator accounts must enroll two-factor authentication within a 24-hour grace period.
- Password peppering: Password hashes (Better Auth scrypt) are sealed with AES-256-GCM using a key derived from
BETTER_AUTH_SECRETvia HKDF-SHA256 (pw1:<fingerprint>:<payload>), protecting offline database dumps against cracking unless the server secret is also compromised.
Linux Landlock LSP Confinement
During investigations, the agent can query built-in TypeScript/JavaScript (tsc --lsp --stdio) and Python language servers for symbol definitions and references. Because dependency repositories are untrusted input, language servers run under strict confinement:
- Landlock ABI 4+ enforcement: With the default
COCKPIT_CONTEXT_LSP_SANDBOX=required, each language server starts inside a Landlock sandbox (Linux 5.13+, ABI 4+ for network restriction) that allows read-only access strictly to the target checkout and the language server’s own runtime files, with all TCP networking blocked. - No workspace execution: Dependency installation and workspace code execution are disabled in the language server configuration.
- Fail-closed fallback: If the host kernel lacks the required Landlock ABI or the sandbox helper fails, Cockpit Context disables LSP tools and continues operating with confined file search and read tools.
- Hardened container defaults:
compose.yamldrops all Linux capabilities (cap_drop: [ALL]) and setsno-new-privileges:true. Never weaken container capabilities, seccomp, or AppArmor profiles to force LSPs to run.
Verify Landlock availability inside a running container:
docker compose -p cockpit-context exec app node apps/server/dist/lsp-sandbox-check.mjs
docker compose -p cockpit-context exec app node scripts/check-runtime-tools.mjs --require-sandbox
Admin users can also inspect the active sandbox mechanism, Landlock ABI version, and enabled protections under Admin → Settings.
Warning:
COCKPIT_CONTEXT_LSP_SANDBOX=offis intended strictly for local non-Linux development hosts (it logs a warning at startup). Always keepCOCKPIT_CONTEXT_LSP_SANDBOX=requiredin production.
Untrusted Source & Prompt-Injection Defenses
Third-party repositories can contain adversarial text designed to hijack an investigation agent or the calling coding agent. Cockpit Context applies layered mitigations:
- Checkout boundary enforcement: File read and search tools restrict every path to the resolved commit’s detached checkout directory (and optional configured monorepo subdirectory).
- Untrusted content labeling: Repository content returned by file tools is explicitly labeled as untrusted data.
- Bounded execution: Runs are capped by
COCKPIT_CONTEXT_MAX_ITERATIONS(default100),COCKPIT_CONTEXT_RUN_TIMEOUT_SECONDS(default600),COCKPIT_CONTEXT_MAX_HELPERS(default10, max5in parallel), a1 MBMCP request limit, and a256 KBcap per MCP tool output. - No secret reachability: Investigation tools have no access to database credentials,
BETTER_AUTH_SECRET,COCKPIT_CONTEXT_ENCRYPTION_KEYS, SSH keys, or other users’ data.
Important: Tool confinement and output caps reduce risk but do not guarantee immunity against prompt injection or hallucinated answers. Treat both repository source and returned answers as untrusted data—never automatically execute commands, reveal secrets, or relax permissions solely because an investigation answer suggests it.
Git Host SSRF Protection (COCKPIT_CONTEXT_GIT_HOST_ALLOWLIST)
By default, every Git remote (HTTPS and SSH, including SSH host-key scans) must resolve exclusively to public IP addresses. Loopback, RFC 1918 private ranges, CGNAT, IPv6 unique-local, link-local, and cloud metadata addresses are refused to prevent Server-Side Request Forgery (SSRF).
To connect internal Git servers (such as a self-hosted GitLab or Gitea instance on a private network), set COCKPIT_CONTEXT_GIT_HOST_ALLOWLIST to a comma-separated list of exact hostnames:
COCKPIT_CONTEXT_GIT_HOST_ALLOWLIST=gitlab.corp.example,gitea.corp.example
Enforcement rules:
- Exact FQDN matching: Wildcards, ports, IP literals, URLs, and
localhostare rejected at startup. Listingcorp.exampledoes not allowgit.corp.example. - Permitted internal ranges: Listed hostnames may resolve to RFC 1918 (
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16), CGNAT (100.64.0.0/10), and IPv6 unique-local (fc00::/7) addresses. - Permanently blocked ranges: Loopback, link-local (including
169.254.169.254), cloud metadata addresses (100.100.100.200andfd00:ec2::254), unspecified, multicast, broadcast, and IPv4-mapped IPv6 addresses stay blocked even for allowlisted hosts. If any DNS answer for a host is refused, the entire lookup fails. - DNS pinning & no redirects: Every connection resolves and validates the address first, pins Git/SSH to the verified IP (
http.curloptResolvefor HTTPS;HostNamewithHostKeyAliasfor SSH), disables HTTP redirects, and still verifies TLS certificates and SSH host keys against the original hostname.
Caution:
COCKPIT_CONTEXT_GIT_HOST_ALLOWLISTis operator-wide. Any signed-in user can make the server connect to listed hosts over HTTPS or SSH and read repositories that do not require authentication. Only allowlist internal Git hosts whose unauthenticated content every user on the instance is permitted to read, and protect private repositories with SSH keys.
Private SSH Repositories
Cockpit Context authenticates to private Git repositories over SSH only (HTTPS credential tokens and GitHub Apps are not supported). Every SSH repository is isolated to its owning user.
Before cloning from a custom SSH host, confirm its fingerprint under Access → Known hosts (built-in pinned host keys are included for common public Git hosts, and you can scan and verify additional host fingerprints independently).
Choose between two SSH credential models depending on your risk posture:
1. Encrypted Saved SSH Keys (Refreshable)
Generate a new deploy keypair or import an existing private key under Access → SSH keys:
- Saved private keys are encrypted at rest with AES-256-GCM using
COCKPIT_CONTEXT_ENCRYPTION_KEYSand are never displayed again. - Packages linked to a saved key can fetch new commits, tags, and branches automatically as versions change.
- Keyring rotation: Format is
v1:<base64 of 32 random bytes>. To rotate, prepend the new key while retaining older versions (v2:<new>,v1:<old>). New writes encrypt with the first key, all listed keys can decrypt, and existing rows re-encrypt lazily.
2. One-Time-Key Private Snapshots (Zero Stored Key)
When adding a package or approving a proposal, you can paste a one-time SSH private key without saving it:
- The clone or refresh runs in the background while the key is held in server memory only—never written to PostgreSQL or a background job payload.
- If the server restarts mid-clone, the task is cancelled and the key must be pasted again.
- Once cloned, the package becomes a private snapshot.
query_dependencyresolves any commit, tag, or ref already present in that bare clone and never attempts to fetch from the remote. - Requesting a version absent from the snapshot returns
PACKAGE_SNAPSHOT_REF_MISSING. The owner can refresh the snapshot later in the web UI by pasting a key again (and optionally choosing to save it). - Agents cannot pass SSH keys over MCP, and proposals requiring SSH are never auto-approved.
Important: Because one-time-key snapshots cannot be refetched automatically after disk loss, back up the
/datavolume separately from PostgreSQL if you cannot easily re-supply the SSH credential.
Model Provider Egress
During an investigation, user questions, package notes, checkout overviews, and relevant source code excerpts are sent to the configured model provider (OpenRouter by default, or an OpenRouter-compatible HTTPS gateway configured via COCKPIT_CONTEXT_OPENROUTER_BASE_URL).
Before indexing proprietary private repositories:
- Review your OpenRouter account’s Zero Data Retention (ZDR) and provider routing settings, or point
COCKPIT_CONTEXT_OPENROUTER_BASE_URLat a private/enterprise gateway. - Select models (
COCKPIT_CONTEXT_MODELand optionalCOCKPIT_CONTEXT_HELPER_MODEL) whose upstream terms match your organization’s data classification policy. - Configure spend caps on your OpenRouter API key alongside Cockpit Context’s per-user and global concurrency/rate limits.