Skip to content

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) ​

  1. Session decisions: explicit session allow/deny grants (or autoApproveAll when enabled for non-interactive/CLI flows).
  2. Agent / Role rules: per-role tool allowlists (enabledTools) and permission overrides defined via AgentConfig / role_manager.
  3. User overrides: overrides set via /permissions in chat, or per-web-chat overrides stored in ~/.kompile/conversations/<session>.web-permissions.json.
  4. Built-in defaults: permissive by default so local and 24/7 workflows are not stalled waiting for terminal input.

Default permission levels ​

Permission KeysDefaultRationale
read, grep, glob, list, todoread, todowrite, progress, webfetch, websearch, question, crawl_discover, crawl_result, knowledge_*, graph_*ALLOWRead-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_retractALLOWPermissive local default — The Enforcer and explicit user/role rules own policy rather than constant prompt fatigue
judge_controlASKChanging live supervision / judge controls is an operator decision, not an ordinary tool call
hooksASKHooks register and execute automatic shell commands — even around read-only tools

Customizing permissions to match your posture ​

  • Tighten interactively: Use /permissions in chat (or the Web Harness permissions editor) to switch any key — such as bash.destructive, write, edit, external_directory, or task — to ASK or DENY.
  • Fail-closed web overrides (WebPermissionSettings): Per-web-chat overrides live in ~/.kompile/conversations/<session>.web-permissions.json, validate their exact canonical workspace path and 64 KiB size 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-wide autoApproveAll for that session.
  • Server-side MCP permissions (ToolPermissionService): kompile-app-mcp supports ALLOW / DENY rules resolved by tool override → category rule → default in tool-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, mutate gc, 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.checkCliPermissionCeiling fails closed and requires a native agent_type / role instead.
  • Role scoping: Use role_manager to 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 (:8080 kompile-app-main, :8081 kompile-chat-harness / kompile-chat, :8082 kompile-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 required Origin header, 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).
  • Network deployment recommendation: kompile chat --web is 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 POSIX 0600 / 0700 permissions and fail closed on symlinks or unsupported filesystems.
  • No secret leakage in config or diagnostics:
    • kompile explain, /subagent-config, /model failover route drafts, and ~/.kompile/config/sources.json store credential names only — never raw API keys or tokens, and parse errors never echo pasted input.
    • Unified Sources (HarnessComponent) explicitly exclude auth.json, credentials.json, machine-bound GPU/hardware configs, and peer-identity.json so 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-install serves 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.

5. Choosing your own security posture ​

Your EnvironmentRecommended Posture
Trusted single-user dev workstationKeep permissive defaults (ALLOW), rely on The Enforcer + Draft Workflow + lsp action=check + /subagent-config cost caps
Tight interactive reviewOverride 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 setupPut :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 isolationRun kompile inside a dedicated OS user, rootless container (Docker/Podman), or VM so the OS kernel enforces filesystem and network isolation

Released under the Apache-2.0 License.