What the runtime can reach
The runtime is one process inside the session container, running as the session user. This page lists what starts it, who can talk to it, and what the process, the agent in the workspace and recipe helpers can touch. None of it depends on a model in the runtime.
Confinement
Section titled “Confinement”| Process | Confinement |
|---|---|
| The runtime | None of its own. It has the session user’s rights |
| The agent in the workspace and anything it starts | None of its own. Same rights, plus the harness’s tool approvals |
shell and proc.spawn children |
None. Same user, own process group |
| The recipe worker | None. A separate process, installed root-owned |
| Recipe helper programs | seccomp always; Landlock filesystem rules by tier |
The runtime can read and write anything the session user can, including the home directory, a mounted persistent profile and other applications’ state. It can open network connections anywhere the container’s network allows. What it can reach also depends on the container’s own security configuration.
A reviewer should plan for these consequences.
- The runtime handles screenshots of whatever is on the session’s screen, and sends them to
KASM_RUNTIME_VISION_ENDPOINTwhen one is set. The runtime does not restrict egress. - Scenario-provided credentials (
KASM_RUNTIME_SECRET_*) are in the process’s environment and memory. - A bug in the runtime or a library it uses, triggered by hostile content on screen or in a page, would run with the session user’s rights.
The isolation barrier is the session container that Kasm manages. Process confinement is on the roadmap.
The on switch
Section titled “The on switch”On images that include the runtime, it starts only when the session’s environment sets KASM_RUNTIME_SESSION_TOKEN. Without the variable there is no process and no listening port. The same value is the credential callers present, so switching it on and choosing the token are one step. It is normally set through the Kasm API’s request_kasm environment map. See Enable the runtime on a workspace.
A scripted run (kasm-session-runtime run) is started by whoever launches it, inside the session. It listens on a port only if KASM_RUNTIME_OBSERVE=true, and then serves the read-only observe routes and, with a token set, the inbox routes. It never serves the methods below.
Callers and credentials
Section titled “Callers and credentials”With a session token set, kasm-session-runtime mcp serves HTTP on KASM_SESSION_RUNTIME_PORT (default 9434), bound to KASM_RUNTIME_BIND_ADDR (default 0.0.0.0, which Kasm’s port-map proxy needs). Without a token it serves MCP on stdio to the process that started it, with no authentication.
Every credential check is a constant-time comparison. An outside caller sends the session token in the X-Kasm-Runtime-Session-Token header only. The header is not Authorization because Kasm’s port-map proxy overwrites that header. Three credentials exist:
| Credential | Held by | Opens |
|---|---|---|
Session token (KASM_RUNTIME_SESSION_TOKEN) |
An outside caller, and the agent in the workspace | Every route |
Messaging token (KASM_RUNTIME_INBOX_TOKEN) |
A custom sidebar or a script that stands in for the person | The operator routes below |
| Sidebar token, generated per session | The bundled sidebar in the viewer’s browser | The operator routes below |
| Route | What it does | Credential |
|---|---|---|
/mcp |
MCP over Streamable HTTP: every method, including shell |
Session token |
POST /v1/call/{method} |
The same methods over plain HTTP | Session token |
/v1/files/..., /v1/dirs/... |
File transfer | Session token only |
/cdp/<name>/ |
Raw Chrome DevTools Protocol proxy to one registered application, only when KASM_ENABLE_CDP is set |
Session token |
GET /events, GET /artifacts/<file> |
Read-only: the live trace and the run’s output directory | Token required inside a Kasm session; see below |
Inbox reads and writes (messages, attachments, stop, finish_intervention) |
The person’s side of Messaging | Session, sidebar or messaging token |
/workspace/... |
Applications, playbooks, file listing for the sidebar | Session, sidebar or messaging token, in the header |
/agent/start, /agent/conversation, /agent/terminal |
Start the agent, begin a conversation, raise its terminal | Session, sidebar or messaging token |
Request create and cancel, ack, /agent/events |
What the agent’s side of Messaging does | Session token only |
Request decline (Not done, Stop) |
The person ends a question | Sidebar or messaging token in the header. The session token is refused |
GET /v1/openapi.json |
The OpenAPI description of this listener | None |
Limits:
- Inside a Kasm session (
KASM_IDset) the read gate on/events,/artifacts/and the inbox reads is always on. They accept the session token or the sidebar token in the header, or the messaging token in the header or as?token=. Outside Kasm the routes are open unlessKASM_RUNTIME_OBSERVE_TOKEN_REQUIRED=true; anything that can reach the port directly, such as another container on the same network, can then read the run’s screenshots, trace and report. With the gate on and no token configured they refuse every request. Pair it withKASM_RUNTIME_BIND_ADDR=127.0.0.1behind a same-host proxy where you can. KASM_RUNTIME_OBSERVE_INPUTrecords keystrokes into the trace and forces the token requirement on.- The messaging token is meant for a sidebar. It cannot call tools, the DevTools proxy, the shell or file transfer, and cannot create requests or acknowledge delivery.
- There is one session token per session and no per-method scopes. A holder can call every method.
KASM_RUNTIME_MCP_LOCALHOST_PROTECTION(DNS-rebinding guard on/mcp) is off by default because Kasm’s proxy never sends a localhost Host header. Turn it on only when/mcpis served directly to a browser on the same machine.- Fixed listener limits: 10 s to send request headers, 2 min idle keep-alive, 8 MiB per
/mcpor/v1/call/request body.
Rights of a token holder
Section titled “Rights of a token holder”A session-token holder is treated as an agent with its own reasoning, so the MCP and HTTP methods are broad:
shellruns a command line to completion and returns its output.launchandproc.spawnstart processes;proc.killstops them.input.clickclicks raw pixel coordinates;input.typeanddom.filltype literal text the caller supplies.dom.queryanddom.clicktake a CSS selector;dom.waitevaluates a JavaScript expression the caller writes;dom.navigategoes to any URL.dom.set_filesgives a page’s file input any file in the home directory or/tmp, which the page can then upload anywhere it sends data.- With
KASM_ENABLE_CDP,/cdp/<name>/gives the full DevTools protocol of that application, which includes running script in the page and reading its cookies and storage.
Each call is recorded as a step in the report with backend rpc. Holding the session token is equivalent to a shell as the session user. The full list is on MCP methods.
A scenario-provided value referenced with ref is resolved inside the session and omitted from the typing result. A session-token holder can still read it with shell or from application content.
The shell method
Section titled “The shell method”shell runs sh -c <cmd> as the session user, with the runtime’s environment, in its own process group.
- It has no timeout parameter and no timeout of its own in
mcpmode. It runs until the command exits, the request that started it ends (which kills the whole process group), or the session’s lifetime limit passes, when an operator has set one withKASM_RUNTIME_DEADLINE_S. - The combined output comes back to the caller cut to the first 2,000 characters by default (
evidence.shell_output_chars), with a marker giving the number of bytes dropped. Registered secret values in it are replaced with[REDACTED], and the recorded step is redacted the same way. - Redaction matches registered values as exact strings. A command that prints a secret re-encoded, or any other credential the session user can read, returns it to the caller as it is.
The agent in your workspace
Section titled “The agent in your workspace”When an operator offers an agent in a workspace, the runtime starts the harness (Claude Code, Codex or OpenCode) in a terminal pane inside the session. The harness is a process of the session user. It can do everything the session user can, and the runtime adds no confinement around it.
What it holds:
- The session token. The launcher gives the harness the runtime’s MCP address on
127.0.0.1and the session token, so it can call every method,shellincluded. Any process the harness starts as the session user can read the token from its environment. - The workspace’s provider credentials. An
ANTHROPIC_API_KEY,ANTHROPIC_AUTH_TOKENorapiKeyHelperin the workspace, or an earlier sign-in, is what Claude Code uses; the runtime marks Claude’s first-run setup done so no key prompt appears. AnOPENAI_API_KEYin the workspace is saved as Codex’s sign-in before launch. With no credentials, the person signs in at the harness’s own prompt in the terminal, and the sign-in persists with the home directory. - What the runtime withholds. The harness’s environment leaves out
KASM_RUNTIME_SECRET_*, the vision API key, the messaging token, the VNC passwords and the runtime’s output directory setting. This keeps the runtime’s credentials from being inherited. It does not stop another process of the session user from reading them elsewhere.
What the runtime sets for tool approvals:
| Harness | Pre-approved | Asks first |
|---|---|---|
| Claude Code | The runtime’s screen, input, accessibility, window, DOM and recipe methods, and human_ask |
Everything else: the runtime’s shell, launch, proc.*, file, download and dom.set_files methods, and the harness’s own tools that need approval. Each appears in Messaging as “Allow the assistant to …?” with Allow and Don’t allow |
| Codex | The same list | The same, in the terminal. Hooks run without Codex’s hook-trust prompt, and the home directory is marked trusted |
| OpenCode | The same list | The same, in the terminal |
Limits:
- The pre-approved input methods (
input.type,input.click,input.key) let the agent type into a terminal window on the same desktop, so an approval card for a shell command reviews one route among several. - The agent’s own tool use (its shell, its file edits) is not recorded by the runtime. The runtime records its own method calls as steps, the messages and approval cards in the inbox, and the harness’s lifecycle events. The harness keeps its own conversation transcript in the session user’s home directory.
- With no vision endpoint, a signed-in Claude Code agent answers
screen.judge,screen.groundandscreen.askfrom a separate one-shot call with no tools, no MCP servers and no saved session.KASM_RUNTIME_HARNESS_VISION=offturns that off. Codex and OpenCode do not answer them. - The harness’s conversation and anything it reads or sees go to its provider.
People viewing the session
Section titled “People viewing the session”The bundled sidebar needs a token for every read and write. The runtime generates it at start and writes it to a file in the sidebar’s web root under Downloads/.kasm-runtime/, which KasmVNC serves only to people signed in to view the session. The sidebar reads the file, keeps the token in the browser and acknowledges it, and the runtime deletes the file. An unacknowledged file is deleted after five minutes (KASM_RUNTIME_SIDEBAR_TOKEN_TTL changes this). The token itself stays valid while the runtime runs.
Everyone who gets the token has operator rights. A person with the sidebar token can:
- read the live trace, the screenshots and the report;
- send messages and attachments to the agent, and answer, decline or stop what it is doing;
- start the agent, begin a new conversation and raise its terminal, with no way to choose the command or the harness;
- list the home directory and
/tmp(names and sizes, up to 500 entries), read and save playbooks, and start, raise or close applications.
The token does not open shell, proc.*, file transfer, the DevTools proxy or the MCP methods, and it does not let the holder pose as the agent (the agent’s request, acknowledgement and hook routes need the session token).
A message from the sidebar reaches an agent that holds the session token. Anyone viewing the session can read its activity and message its agent, and so can direct it through whatever the agent is allowed to do. Approval cards are answered in the same sidebar, so they check the agent and do not separate a viewer from it. Grant view access to a session as access to the session user’s account.
Recipe helpers
Section titled “Recipe helpers”Some recipes call helper programs (for example an image or document tool). Every helper, whichever layer its package came from, runs through the runtime’s launcher, which applies these before the helper starts:
- an empty environment;
- a seccomp filter that denies every socket family, process creation, new sessions and process groups, and signals to anything but the helper itself, with
no_new_privs; - the helper dies with its parent;
- resource limits on CPU time, memory, file size and open files, and limits on output and run time;
- Landlock filesystem rules, to the extent the kernel supports them.
The Landlock part depends on the host kernel, and the launcher grades it:
| Tier | Host | Helpers get |
|---|---|---|
full |
Landlock ABI 6 or later (Linux 6.12 and later) | Filesystem rules, network rules, signal and abstract-socket scopes, and the seccomp filter |
partial |
Landlock ABI 1 to 5 | Filesystem rules with that ABI’s rights, and seccomp in place of the rights it lacks |
none |
No Landlock: a kernel before 5.13, Landlock disabled, or a container seccomp profile that blocks it | No filesystem confinement. A helper can read and write whatever the session user can. The seccomp floor still applies |
If the seccomp filter cannot be installed, no helper runs and the call returns isolation_unavailable with the reason. Nobody is asked first at a lower tier. The recipe’s receipt records isolation_tier and, below full, isolation_gaps, and the runtime logs reduced isolation at start. kasm-session-runtime sandbox probe --json reports the tier, the Landlock ABI and the reason on a given host and always exits 0.
Packages are trusted by where they are installed: bundled with the runtime, in the image, or in the user’s own recipe directory. Nothing is approved before it runs. A package that the person’s agent writes into the user directory runs at once, with the privileges of the session user, and the agent already holds those.
The recipe worker, the process that runs recipe bodies, is not under this sandbox. It is installed root-owned at image build, and a body is refused when it is missing.
Browser debugging stays on the machine
Section titled “Browser debugging stays on the machine”The runtime’s own DevTools connection for cdp: true scenarios, and the default registration of the dom.* methods and the /cdp/<name>/ proxy, goes to KASM_RUNTIME_CDP_ENDPOINT, default http://127.0.0.1:9222, or on a nix image the port APP_ARGS fixes and none otherwise. The other registrations are loopback ports the applications’ own port files name. The runtime refuses to start with an endpoint that is not loopback (127.x, ::1, localhost) unless KASM_RUNTIME_CDP_ALLOW_REMOTE=true. It also:
- refuses a discovery response that redirects;
- refuses a debug target the browser advertises on a different host from the endpoint;
- refuses a WebSocket handshake that redirects away from that target.
The last two checks still apply with KASM_RUNTIME_CDP_ALLOW_REMOTE set.
This controls where the runtime connects for DevTools. It does not stop another process in the session from connecting to the browser’s debugging port, and it does not restrict any other outbound connection.
File transfer
Section titled “File transfer”The file methods (file.get, directory.get) and streaming routes (/v1/files/, /v1/dirs/) reach two roots: the session user’s home directory and /tmp. A path outside them is refused. downloads.list and downloads.wait read the browsers’ download folder through the same roots, and refuse a download folder configured outside them. They are offered to outside callers in mcp mode, never to the runtime’s own loop.
How it is enforced:
- Each root is opened once as a root handle, and every open, create and rename goes through it. That refuses
..climbing out, absolute components, and symlinks pointing outside the root, including one swapped in between a check and the open. - Reads accept only a regular file, checked after the open, so a FIFO or device node at the path is refused.
- A write goes to a temporary file first, then is linked into place without replacing an existing file, or renamed over it with
overwrite. Setuid, setgid and sticky bits are never set. - Uploaded zip archives are validated whole before anything is written: relative clean names only, regular files and directories only, at most 10,000 entries, and the declared and actually decompressed sizes capped by
KASM_RUNTIME_EXTRACT_MAX_BYTES(default 1 GiB). One upload is capped byKASM_RUNTIME_UPLOAD_MAX_BYTES(default 1 GiB). At most four transfers run at once, and one idle for 60 s is cut off.
Limits:
- The roots stop a caller’s path from leaving them. They do not isolate a hard link already inside a root that points elsewhere, a bind mount under a root, or anything the session user’s filesystem already exposes there.
/tmpis writable by every user in the container.- The roots bound the file methods only. The
shellmethod can move files anywhere the session user can write.