Security in depth
Added in 2.6
Security says what Kraft protects against and which settings matter. This page is the detail behind it, for someone who wants to know how a check works or where it stops. Each section names what is enforced and what isn't.
Network and browser
- Loopback by default.
kraft admin startrefuses to bind a non-loopback address without a password set inaccess.yaml. There is no way to expose the API or UI on a LAN or the internet without opting in. - Remote access is the recommended way to
reach the board from a phone or another machine: bind the machine's
Tailscale address. A bare
--host 0.0.0.0also listens on your LAN, and a Cloudflare Quick Tunnel is the public internet, guarded by the password and a login throttle. - No framing by another site. Every response carries
Content-Security-Policy: frame-ancestors 'self'andX-Frame-Options: SAMEORIGIN. Your browser refuses to show the board inside a frame on any other site. Without this, a page could hide the board under its own content and turn your selection into Resume or Approve (clickjacking). That matters most on a loopback bind, where the board needs no login. - The API docs pages load nothing unpinned.
/docsand/redocneed no login. Their scripts come from a CDN, each pinned to one release and checked by hash. Their policy lets an image load only from Kraft itself or inline, so no other site learns your Kraft's address from them. See The schema. - A document can't make your browser fetch another site. Specs, plans,
notes, review threads and gate pages are Markdown a worker can write. An
image in them shows only when it comes from the board's own address or is
inline (
data:). Any other image shows as a link,image: host/path, and your browser fetches it only if you select it.
Otherwise a sandboxed worker could put data in an image's URL and have your browser send it out, past the worker'snetwork:policy.
Host allowlist
The rules differ by bind:
- A loopback bind answers only to
127.0.0.1,localhostand[::1], so a web page can't reach it under another name. A trailing dot (localhost.) or a longer spelling of::1is the same name, and is accepted too. - A non-loopback bind checks the
Hostheader againstallowed_hostsinaccess.yamlfor every request that carriesSec-Fetch-Site,Origin,Refereror a pageAccept. That covers every page load and login: a password alone doesn't authorise an arbitrary hostname. - Each entry is kept in the form the
Hostis compared in: lowercase, with no scheme, port or trailing dot. A wildcard is refused when you save it, andkraft admin doctornames one already in the file. - This machine's own
127.0.0.1,localhostand[::1]always pass, since a browser sends them only when it is on this machine. - A request with none of those headers, as the CLI, MCP and
curlsend, needs no entry. It still needs the password for anything but the unauthenticated routes such as/api/health. - The board's live event connection, the
/api/ws/eventsWebSocket, follows the sameHostrules, and refuses anOriginfrom another site. The board's own page and a page on this machine pass.
Agents and gates
Which gates wait for you. The shipped default chain stops and waits for
you to approve the spec and the plan, before it opens a draft merge request,
and again before it marks it ready. There are two exceptions:
- A spec or plan you attach at intake arrives already decided, so its gate is dropped.
- The
chain_revision_approvalgate passes on its own when the revision proposes no change, which is the usual case.
If your forge requires a review, the item then waits for that approval before
it merges. A gate you give an auto_review task that decides lets that
agent's verdict approve it. The default chain's gate reviewers check first,
so they never approve.
The ten item verbs are approve, reject, pause, resume, skip,
abandon, retry, complete, cancel and escalate. The rules differ for
a sandboxed worker and an unsandboxed one.
A sandboxed worker under a network: policy can't decide its own gates. A kind: os worker is sandboxed in this sense, and network: is required for it. On macOS that worker can read the environment and arguments of your other processes, which the gate guarantee doesn't cover: keep a secret out of the environment of a Mac that runs work you don't trust.
- It reaches Kraft only through its session's channel, which acts as that session. The channel allows only reads, progress, CI re-runs, thread replies and permission asks on the worker's own item, and an escalation turn's retry of it.
- It can't use any of the ten item verbs on its item, revise its attachments, overrides, policy or budget, or file work, whatever it sends. Anything else is refused and recorded.
- A permission hook that gets no answer denies. See Callbacks from a sandbox.
A sandbox with unrestricted_network: true has no channel, but nothing
blocks a direct connection. Without network: the container has the
runtime's default network, which is why Kraft refuses such a launch unless the
sandbox sets that key. Kraft gives it no channel and no kraft shim, and it
adds nothing that stops the container dialling the host. Whether it can reach
Kraft's loopback-bound API depends on the runtime.
If it can, Kraft can't tell the worker's calls from yours, because the loopback API needs no login. Don't count on such a sandbox to keep a worker from approving its own gate.
An unsandboxed worker can, because it runs as you. It can read Kraft's token, write Kraft's database and edit its config. No check inside Kraft can stop it approving its own gate or starting work it filed.
What refuses a worker acting on its own item. These checks do, and none is a boundary against a worker that isn't sandboxed.
- The
kraftCLI and the MCP server refuse a worker's item verbs on its own item, and its changes to that item's attachments, overrides, policy and budget. They check this on the client, from the item the worker stands in. - The API refuses the same calls when the request carries the worker's session
(
X-Kraft-Session-Id,<work item id>/<session id>, or the bare 32-character ID of a session started before session IDs were per item). A header that is neither form, a bare 6-character session ID included, gets400.
A caller that leaves the header off passes. A well-formed header that names no session passes too. Both IDs are matched whole and exactly, so an item given by the start of its ID, or in a different case, names no session. - The review tools are refused by the API from any request that carries a session ID, on any item, not only the worker's own.
- Three doors that put text into a task, or change the chain an item runs, are
refused by the API from any request that carries a session ID or comes
through the MCP server, on any item: setting a node's
extra_prompt, a retry that changes anything of a task but its model and effort, and writing or applying an item's chain draft. - Turning a repo on is refused the same way. A repo such a request connects with its own test or setup command is saved disabled: those commands run for every work item on it, so no such request files work on a disabled repo until a person has read them and enabled it.
The MCP tools page lists every refusal.
Filing and starting in one step. The MCP create tool has no autostart
option, so everything filed through it lands paused. A person starts it, from
the board or by asking their agent to resume it. The server refuses
kraft item create --autostart (403, nothing filed) from a request that carries
a Kraft session ID or the MCP client tag; see
kraft item create.
The kraft command tags a call from a shell it detects as a coding agent's
(today Claude Code's), and the server then refuses it as it does an MCP call.
It can't tell any other agent that runs kraft item create --autostart in a
shell on your machine from you, nor one that overrides the tag, so that
call starts the item. Anyone with a shell can start work this way.
What this doesn't stop. These refusals rest on Kraft's own clients and
the X-Kraft-Session-Id and X-Kraft-Client headers they send. They stop an
agent using Kraft's own tools, not an agent with a shell: it can call kraft
or the API without those headers, or edit the files under
$KRAFT_HOME/config/, repos.yaml included.
For untrusted work, the sandbox is the boundary. If a gate must hold against the agent, follow steps 1, 2 and 4 of Run it safely. See Default posture for why a sandbox is the line, and Use Kraft from your agent.
Replies to review bots
Unreleased
With replies: true on a bot, Kraft posts text that an agent wrote after reading the bot's threads, and anyone who can comment on the merge request can write those notes. A body gate narrows the text: it refuses a link, an image, raw HTML or a secret Kraft knows, breaks mentions and command lines so none fires, and checks every quote against the repository. It can't judge what the prose says.
On a repository that outsiders can comment on, run the triage and repair sandboxed. On a remote worker, the worker's own environment applies. See Let Kraft answer the review bots.
Escalation turns can force-push
An escalation turn is the agent Kraft starts to help with a stopped item. It can commit, rebase and push its item's branch, and a push can be a force-push.
Kraft starts a turn by itself when an item gets stuck: a task still failing
after recovery and the fix loop, or a fix loop that hits its cap, stalls on
findings that stop changing, or whose judge
stops it. This is auto_escalate_stuck, on by default, up to three times by
default (auto_escalate_stuck_cap). Config errors, budget and time caps,
infrastructure failures, wait timeouts and a worker's question aren't
answered this way.
What the grants allow
The turn holds the git-commit, git-rebase and git-push grants, and is
told to push only its branch, with --force-with-lease. That is an
instruction, not a check.
- The
git-pushgrant is the permission gate's allow for a push to a plain remote name whose refspecs all update the item's own branch and nothing else (see Grants). A push without a force flag matches too. - A plain
--force,-for a+refspec doesn't match the grant, and nothing blocks it either. Which check decides it depends on the harness: see Default posture. In Kraft's gate, only adeny_toolsentry, anallowed_toolslist that leaves it out or, on Cursor, a write to Kraft's hook file stops it. - A grant is allowed even under an
allowed_toolslist. Onlydeny_toolsoverrides it. - A grant is the gate's allow only. On Cursor a hook allow doesn't outrank
--auto-review, so Cursor decides whether the call runs. - A grant doesn't stop git's own hooks, which the agent can edit.
Set defaults.escalation_grants: [] in policy.yaml to remove the grants.
That removes the gate's allow only: the pushes then go to whatever decides a
call under the default posture.
What the turn can call
The turn runs as a person's session, not a worker's, so the CLI doesn't treat it as a worker acting on its own item. A turn that isn't sandboxed can:
- Complete, cancel or abandon the item.
- Change its agent overrides, and the overrides of a node that hasn't
started, except a node's
extra_prompt. - Ask for a retry of a
needs_humanitem, which Kraft performs once the turn ends.
The turn's prompt tells it not to skip or abandon the item, and to give you the command instead. No check stops an abandon from a turn that isn't sandboxed. Kraft's own prompt doesn't mention complete or cancel.
A sandboxed turn under a network: policy has only its session's channel, as
a sandboxed worker does. Of the calls above, the channel
carries the retry and nothing else.
What the API refuses it
By its session ID, the API refuses the turn these calls, because a gate, a review, a spending cap and text that reaches a task are a person's decision:
- approve and reject
- raising or changing the budget, and changing the policy
- a reviewer's calls: opening, editing, deleting, resolving or reopening a thread, adding, editing or deleting a comment, and submitting a review (a turn can still reply to a thread)
- setting a node's
extra_prompt - a retry that changes a task's prompt, command or other fields beyond its model and effort
- writing or applying the item's chain draft
- turning a repo on
The check reads the X-Kraft-Session-Id header. It is a consistency check,
not a security boundary: a turn that isn't sandboxed can leave the header off.
While a turn runs, the API also answers 409 to these calls on its item, whoever makes them, because they depend on the item's state, not on who is calling:
- Skip, resume and a second escalation, the turn's own calls included.
- Pause, because the item is stopped and pause takes only a running one.
- A change to its attachments, because the item has started.
Workers and the sandbox
An in-place item is never sandboxed. Its agents run as you, in the same checkout your shell and editor use, beside your uncommitted edits, so they reach everything an unsandboxed worker does. Kraft refuses an in-place item that a sandbox would cover rather than run it unsandboxed. Keep repos you don't fully trust on worktrees with a sandbox. See Run items in your own checkout.
A worker's environment is allowlisted, not inherited. It doesn't take
whatever the server's own shell had set. A repository's repos.yaml entry adds
what it declares. See
Environment variables.
A sandbox bounds what a worker writes, and with a network policy what it reaches.
- A sandboxed worker can't move a branch in your repository other than its own.
- A tool policy Kraft can't enforce for that harness in the sandbox refuses
the launch. Where it is enforced, an
allowed_toolslist on Claude runs inmanualmode, and Claude then runs read-only shell commands such ascatwithout asking Kraft's gate, ifBashis in the list. - Of Kraft's
run/folder it sees only its own work item's session files, read-only and writes only its own result file and summary, its item'sdocs/and its sandbox home. Another item's diff, findings and instructions aren't in the container, nor are the files the person filed or the earlier versions of a document a gate decided on. - Kraft never follows a link a worker planted in a folder it can write: it reads, copies and deletes there without following one.
- Git state it plants in its worktree, such as a HEAD naming another branch or a rebase or merge in progress, stops the item for you. Kraft never commits, rebases or aborts over it.
What it reaches.
- Without a
networkpolicy its network isn't restricted, and on a cloud VM the metadata address is reachable. Kraft refuses the launch unless the sandbox setsunrestricted_network: true, andkraft admin doctorreports the sandbox either way. - With one, the worker has only loopback and reaches out only through Kraft's own proxy, on a channel that is its session's alone. Only the hosts the policy allows are reachable. Loopback, link-local, unspecified and multicast addresses, cloud metadata and the addresses the host's own name resolves to never are. Another non-public address, such as an RFC 1918 one, is reachable only when an allow entry names its host exactly. Refusals are recorded.
- On Docker Desktop and Podman machine that channel is a mutual-TLS connection, and a session's certificate expires after seven days, so a longer session fails closed. The certificate names its work item and its session, so it never reaches another item's session with the same session ID. See Network policy.
- The limit: the allow list is enforced on the requested name and the dialled address, so an allowed name on a shared CDN address can reach other names that address serves (domain fronting). Through an upstream proxy, the upstream resolves the name again, so the checked address isn't necessarily the one reached.
A variable listed under credentials never enters the container. It needs
a network: policy: a sandbox policy that lists credentials without one is
refused when it loads. The container holds a sentinel in its place, and the
proxy holds the real value in memory. Other variables aren't covered:
ANTHROPIC_API_KEY and CLAUDE_CODE_OAUTH_TOKEN are forwarded into the
container unless you list them.
The proxy injects a credential only for a host the allow list names exactly. A host reached only through a wildcard is a blind tunnel, where the worker sees only the sentinel.
For the credential's host the proxy terminates TLS, with a certificate from Kraft's CA, which such a container trusts. It verifies the real host against the server's own roots plus the sandbox's extra CA, and replaces the sentinel in the declared header. It refuses any request that doesn't carry the sentinel.
The limits: HTTP/1.1 only, no upgrade to a managed host, and a host that echoed the key in its response would hand it to the worker. See Credentials.
A sandbox covers a workspace's members as it covers the root. Each member is checked out from its connected repository, never from a git directory the worker can write. The files host git trusts for it are read-only in the container. A member Kraft didn't check out, or one a worker swapped, stops the item before host git runs in it. See Workspaces.
A Kit runs only what Kraft enforces. A kind: kit sandbox runs a Kit
pinned by digest whose descriptor decodes strictly. Kraft lowers the Kit onto
the same Docker sandbox: its network lists, credentials and limits alone, with
no harness host added.
- A required capability Kraft doesn't enforce stops the item naming it before anything runs, and an optional one is skipped and recorded.
- A Kit credential's value comes only from the server variable
sandbox.yamlbinds to its service, never from a variable the Kit names. - Kraft reads one Kit you wrote. A Kit that needs a capability Kraft doesn't enforce is refused, as Docker's published ones are. See Kits.
Files and settings
- The permission hook imports nothing from the worktree. Cursor runs the
hook from the worktree, which the worker writes, with the worker's
environment. Kraft starts it with Python's
-I, so neither the current directory nor aPYTHONPATHis on its import path. A file in the worktree named like a module Kraft imports can't run in its place and answer the hook. See Cursor.
This doesn't protect Kraft's own install: an unsandboxed worker can change that as it can any file your user owns (see Default posture). - Search indexes only files inside the repository. Kraft indexes the
Markdown files git tracks under a repository's
.engineering/. It skips a symlink, wherever it points, and anything else that isn't a regular file. A repository can't commit a link to a file outside it, such as a token in your home directory, and have search hand that file to you or your agent. The scan also never runs acore.fsmonitorprogram the repository's own git config names. - A worker's session summary is read only from its own worktree. It is read
only if it is a Markdown file, so a worker can't point search at a file
such as your checkout's
.env. - An add-on changes what agents are told. See Kraft add-ons.
- Settings can change what the server runs. A harness profile's
executable(Settings › Harnesses) is the program every agent launch on that harness profile starts. A repository'ssetup_command(Settings › Repos) runs in every new worktree.
Both are editable by anyone who can open the Settings pages. On a loopback bind, a request from this machine needs no password, so anyone with access to this machine can change them. Off loopback, the access password (Settings › Access) guards command execution, not only configuration. Keep the bind on loopback or behind the access password, and review these fields after anyone else has had access. install.shis a shell script fetched and piped from the internet. It is short by design: read it before you run it,install.sh.
Kraft add-ons
Added in 2.1
A Kraft add-on is configuration someone else wrote: chains, prompts, skills and agent profiles that your instance runs. Kraft changes what an instance runs only after you accept a review, and it never lets an add-on change what a run may do.
What an add-on can't change. Kraft refuses an add-on that tries, at validate, install and update:
- It runs no command. A
subprocesstask is refused: a shell command runs outside the permission gate an agent works under. - It grants no permission. Its
policy:blocks take limits only: time, attempts, budget anddeny_tools.allowed_tools,grants,sandboxandallowed_harnessesstay in yourpolicy.yamlandrepos.yaml, and a limit above yourmaxima:is refused. - It picks no executable. It can't define a harness profile. Its tasks
run only on harness profiles your
harnesses.yamldefines and its manifest lists. - It reaches nothing of yours by name. Its content sits under its own
namespace, a bare name in your files never resolves to it, and
kraftis reserved.
What an add-on does change. It decides what the agent is told, and which gates, merge steps, models and limits its chains have. A prompt, a steering profile and a skill are instructions the agent follows with whatever tools your instance allows.
Under the default posture, a prompt
that says to run a command is about as strong as a command task. Set
maxima:, allowed_tools and a sandbox before you install an add-on from
people you don't fully trust: see
Bound what an add-on's agents may do.
Nothing changes without a review.
- An install or update prints what would change, leading with what can change how far a run goes, and writes nothing until you accept it.
- A file that carries a control or Unicode format character is refused, and the review writes any such character out, so text can't hide from you while a model still reads it.
- The library loads an add-on only from the commit and digest in
addons.lock. A stored add-on whose files no longer match isn't loaded, and a file edited after that is refused when it is read. - A work item keeps the add-on version it was filed with until it ends.
- A chain revision or an item draft can add an installed add-on's component to a running item: a revision only through its gate, which names the component, and a draft only by your own apply. The item then pins that add-on's version. Disabling an add-on doesn't take it from an item that already pinned it: that item can still add its components.
Auto-update is off unless you turn it on. It applies an update whose review has no Reach line, so a new version that changes only a prompt or a skill is applied with no one reading it. It holds for you a removed gate, a merge step, a changed harness, model or agent profile, a raised limit, a collection moved to another URL, a downgrade and a pre-release.
kraft admin doctor warns when an add-on auto-updates and
policy.yaml sets none of maxima:, allowed_tools and a sandbox. See
Auto-update.
Fetching a collection runs none of its code. Kraft fetches into a bare
mirror, never checks out a working tree, runs no hook and never prompts for a
login. It reads only the add-on's own files, within
size and content limits.
An https URL with credentials in it is refused in addons.yaml.
The lock is trusted like the rest of config/. Restoring an add-on from an
addons.lock you copied isn't a review: Kraft takes the commit the lock
names. A worker is refused the
kraft admin addon verbs that change add-ons, but an unsandboxed worker can
edit config/ as it can any file your user owns.
Repo libraries
Added in 2.1
A repo library is the same content as an
add-on, under the same limits: limits and never permissions, no command, no
harness. Kraft reads it from the commit origin names as the default branch's
head, never from a branch, working tree or worktree of your checkout, and it
loads only after you accept a review.
- A first load is always a person's.
kraft repo connectin a terminal asks.-y, no terminal, the web UI and an agent'sensure_reponever accept one. - A change waits. The server checks each accepted library after a start and
once a day, reports a change as waiting, and applies nothing. You take it with
kraft repo library. - Opting in trusts what the merge says. With
library_auto_update: trueon the repository's entry, a change that alters only prompt text, gate messages, descriptions and skills and steering no deciding task reads is taken without you. That trusts whoever can merge to the default branch, Kraft's own merges included, with what the repository's agents are told. - Everything else still waits. A change of structure, route, limit or gate,
a new chain, and the text a gate's own reviewer reads wait for you. Anything
that can write
repos.yamlor reach the API can set the key. - A repo library reaches only its own repository's items. Another
repository's items, entries and schedules, your own chains and library, and
harnesses.yamlcan't name it. Another repository's launch reads its skills and agent profiles only for an item filed on it before the change that refuses it, and that item finishes on its pinned version. What one repository's maintainers merge into.kraft/stays theirs. - A repo library builds only on add-ons you already loaded. It names them
in
addons:, and accepting refuses one this instance doesn't load. A change that arrives through the add-on is judged by the add-on's rules: an auto-update applies what it would apply to your own chains, and holds the rest. - A worker with no sandbox runs with your access. It can rewrite the
checkout's
originURL, orrepo-libraries.lockitself. A sandboxed worker can't reach$KRAFT_HOME/configor the remote's default branch. Refusing thekraft repo libraryverb to a worker is a convention, as it is forkraft admin addon.
Whoever can merge to the default branch decides what the next accept shows you. Read the review before you take it, as you do an add-on's.
The bearer token
$KRAFT_HOME/run/mcp-token is a full-admin credential. A request that
carries it as Authorization: Bearer <token> passes the login check on every
route: it can file, start, approve and cancel work, and change settings. It isn't
limited to /api/triggers.
$KRAFT_HOME/run/trigger-token is the one to hand out. It passes the login
check on POST /api/triggers only, so its holder can file work, which lands
paused, and nothing else. On any other route Kraft treats it as no credential
and answers 401. The mcp-token works on POST /api/triggers too.
- Kraft creates both files with mode
0600on first start and keeps them after that.kraft admin doctorfails itsmcp tokenortrigger tokencheck if the file's mode gives anyone but you any access. - The
kraftCLI and the MCP server read the file on every call, so they need no setup. - The VS Code extension reads it too, and sends it only to a daemon on
127.0.0.1,::1orlocalhost, to thekraft.urlyou set in your user or Remote settings, or, with nokraft.url, to the hostKRAFT_HOSToraccess.yaml'sbindnames. A workspace's.vscode/settings.jsoncan't setkraft.url. - A dev container's
devcontainer.jsoncan set Remote settings andremoteEnv, so a dev container you open can point the extension, and its token, at its own Kraft. - To rotate either, follow Rotate the token.
trigger-token, never the
mcp-token. Anyone with the mcp-token has full control of this Kraft
instance and of the work it runs in your repos.Login
Remote access uses a password, stored in access.yaml as a salted scrypt
hash. A successful login sets an HttpOnly, SameSite=Lax session cookie.
Remote access shows how to set it up.
- Failed logins are throttled per client address. After 5 wrong passwords
from one address within 15 minutes, Kraft answers that address
429with aRetry-Afterheader. It does so even for the right password, until 15 minutes have passed since the last failure. A successful login clears the count. The counts live in memory, so a restart clears them too. - The address is the one Kraft sees. A proxy or tunnel on the same machine
can name the real client in
X-Forwarded-For. Kraft believes that header only from127.0.0.1, so a remote caller can't pick its own address. - A tunnel that sends no such header makes the throttle global. Every visitor looks like the same address, so 5 wrong guesses from anyone lock everyone out for 15 minutes. That still guards the password, but use a long random one before you expose the board anywhere.
- The cookie is
Secureover HTTPS. When the login request arrives over HTTPS, or carries theX-Forwarded-Proto: httpsa tunnel sets, the cookie is markedSecureand the browser never sends it over plain HTTP. A login over plain HTTP, such as loopback or Tailscale, gets a cookie without it.