Security & Permission Model
Kompile's security and permission model is intentionally minimal. Different teams and operators hold very different views on security — from permissive local-workstation 24/7 autonomy, to strict interactive approvals, to OS containers/VMs, to VPNs and corporate SSO reverse proxies.
Rather than forcing a heavyweight IAM layer or pretending a prompt-level guardrail is an OS sandbox, Kompile provides lightweight, transparent primitives and expects you to layer your own network, OS, and approval posture on top.
IMPORTANT
Guardrails vs. security boundaries: The Enforcer, The Judge, and PermissionService are operational safety rails designed to prevent agent mistakes, drift, and accidental damage. If you need hard adversarial containment (untrusted code, multi-tenant users, or untrusted networks), run Kompile inside your own OS user, container/VM, firewall, VPN, or authenticating reverse proxy.
1. CLI & Web tool permissions (PermissionService)
Kompile's CLI and Web Harness share a three-tier permission model (ALLOW, ASK, DENY) in PermissionService.
Resolution order (highest priority first)
- Session decisions: explicit session allow/deny grants (or
autoApproveAllwhen enabled for non-interactive/CLI flows). - Agent / Role rules: per-role tool allowlists (
enabledTools) and permission overrides defined viaAgentConfig/role_manager. - User overrides: overrides set via
/permissionsin chat, or per-web-chat overrides stored in~/.kompile/conversations/<session>.web-permissions.json. - Built-in defaults: permissive by default so local and 24/7 workflows are not stalled waiting for terminal input.
Default permission levels
| Permission Keys | Default | Rationale |
|---|---|---|
read, grep, glob, list, todoread, todowrite, progress, webfetch, websearch, question, crawl_discover, crawl_result, knowledge_*, graph_* | ALLOW | Read-only inspection and session bookkeeping |
edit, write, patch, draft, bash, bash.readonly, bash.write, bash.destructive, external_directory, task, crawl_documents, crawl_source, crawl_control, ask_graph_assert, ask_graph_retract | ALLOW | Permissive local default — The Enforcer and explicit user/role rules own policy rather than constant prompt fatigue |
judge_control | ASK | Changing live supervision / judge controls is an operator decision, not an ordinary tool call |
hooks | ASK | Hooks register and execute automatic shell commands — even around read-only tools |
Customizing permissions to match your posture
- Tighten interactively: Use
/permissionsin chat (or the Web Harness permissions editor) to switch any key — such asbash.destructive,write,edit,external_directory, ortask— toASKorDENY. - Fail-closed web overrides (
WebPermissionSettings): Per-web-chat overrides live in~/.kompile/conversations/<session>.web-permissions.json, validate their exact canonicalworkspacepath and64 KiBsize cap, reject symlinks, and fail closed if malformed or foreign rather than silently falling back to default access. Saving any web policy automatically disables launcher-wideautoApproveAllfor that session. - Server-side MCP permissions (
ToolPermissionService):kompile-app-mcpsupportsALLOW/DENYrules resolved bytool override → category rule → defaultintool-permissions.json.
2. Subagent & delegation boundaries
Delegated children (task, multi_task, quorum_task, subagent_resume) cannot silently escalate privileges:
- No silent credential inheritance: Subagents never silently borrow the parent chat's Kompile-managed credential; routes must be explicitly configured via
/subagent-config. - No self-escalation (
SubagentDelegationGuard): Delegated children cannot edit permission stores, change peer exposure/profile state, authorize remote peer judge spend, mutategc, or reset their own token/cost budgets (only the user can run/subagent-config refresh <id>). - Fail-closed CLI permission ceiling: Vendor CLIs (
claude,codex,opencode, etc.) cannot enforce a restricted native caller's filtered tool allowlist. If a restricted caller tries to resume a child via a full-access vendor CLI,SubagentResumeTool.checkCliPermissionCeilingfails closed and requires a nativeagent_type/roleinstead. - Role scoping: Use
role_managerto give exploration or audit subagents read-only tool allowlists (read, grep, glob, code_search, lsp) so they physically cannot edit files.
3. Web apps & network exposure
Kompile's web processes deliberately keep authentication minimal:
- No Spring Security in
kompile-app-parent: None of the three web processes (:8080kompile-app-main,:8081kompile-chat-harness/kompile-chat,:8082kompile-app-crawl-manager) ship a built-in user login wall. Anyone who can reach a process's HTTP port can call the endpoints that process mounts. - Classpath persona isolation: Instead of UI hiding, Kompile separates admin (
:8080), end-user chat (:8081), and crawl manager (:8082) into separate processes whose disallowed controllers are not on the classpath (404). See App Persona Boundary. - Explicit local protections where mounted:
- Embedded PTY terminal (
/api/agents/chat/terminal/socket/*): enforces a loopback guard, Spring same-origin checks, a requiredOriginheader, and a bound HTTP session. - Workspace roots (
~/.kompile/chat-workspace.json): canonical directories must be registered explicitly — registering a parent folder never implicitly authorizes arbitrary subdirectories. - Web
/test-milestones: strictly contained to the active project's store (excludes global home and escaping symlinks).
- Embedded PTY terminal (
- Network deployment recommendation:
kompile chat --webis LAN-accessible by default for convenience. On shared or untrusted networks, bind behind a host firewall, private mesh VPN (Tailscale / WireGuard), SSH port-forward, or an authenticating reverse proxy (Caddy, Nginx, Traefik, OAuth2 Proxy).
4. Credentials, secrets & filesystem hygiene
Even with a minimal permission philosophy, Kompile enforces strict hygiene around secrets and sensitive files:
- Owner-only secret storage: Managed credentials (
auth.json) and peer identities (~/.kompile/peer/identity/{identity.p12, password, token}) use anchored, no-follow file I/O with POSIX0600/0700permissions and fail closed on symlinks or unsupported filesystems. - No secret leakage in config or diagnostics:
kompile explain,/subagent-config,/model failoverroute drafts, and~/.kompile/config/sources.jsonstore credential names only — never raw API keys or tokens, and parse errors never echo pasted input.- Unified Sources (
HarnessComponent) explicitly excludeauth.json,credentials.json, machine-bound GPU/hardware configs, andpeer-identity.jsonso sharing skills/memories with blob stores or teammates cannot leak credentials.
- Pinned TLS on Peers (
kompile peer):- Addresses must be
tls://host:port(no plaintext). Clients verify the pinned SHA-256 certificate fingerprint before transmitting the bearer token. - LAN UDP discovery beacons (
:7338) carry non-secret metadata only — never tokens. kompile peer serve-installserves an explicit read-only allowlist (/install.sh, archive,.sha256) and never exposes keys or tokens.- Agent-to-agent peer messages are explicitly marked as untrusted data — never treated as user instructions or operator approvals.
- Addresses must be
5. Choosing your own security posture
| Your Environment | Recommended Posture |
|---|---|
| Trusted single-user dev workstation | Keep permissive defaults (ALLOW), rely on The Enforcer + Draft Workflow + lsp action=check + /subagent-config cost caps |
| Tight interactive review | Override bash.destructive, edit, write, or external_directory to ASK via /permissions; have subagents stage changes via draft and use read-only roles |
| LAN / multi-machine home or team setup | Put :8080/:8081/:8082 behind Tailscale, WireGuard, or an authenticating reverse proxy; use pinned-TLS kompile peer instead of unauthenticated HTTP ports |
| Untrusted repos or strict isolation | Run kompile inside a dedicated OS user, rootless container (Docker/Podman), or VM so the OS kernel enforces filesystem and network isolation |
Related guides
- Why Kompile Is Opinionated — Operational guardrails vs. probabilistic supervision
- The Enforcer & The Judge — Pre-tool enforcement and evidence-backed auditing
- App Persona Boundary — Process and classpath isolation for
:8080,:8081, and:8082 - Peers & Sources — Pinned-TLS pairing, component exclusions, and untrusted peer message boundaries
- How the Kompile MCP Server Works — Permission, Enforcer, and gateway checks inside every MCP call