WorkspaceSandboxConfig

org.llm4s.shared.WorkspaceSandboxConfig
See theWorkspaceSandboxConfig companion object
final case class WorkspaceSandboxConfig(limits: WorkspaceLimits, excludePatterns: List[String], shellAllowed: Boolean, defaultCommandTimeout: FiniteDuration, readOnlyPaths: List[String], allowedPaths: List[String], networkAllowed: Boolean, allowedCommands: Set[String], trustedLaunchers: Set[String], readExecPaths: List[String], inheritedVariables: Set[String], maxConcurrentCommands: Option[Int])

Explicit sandbox configuration for workspace operations.

Describes allowed/blocked paths, resource limits, shell access, and timeouts. When provided, this config is validated at startup and enforced by the runner.

'''Phase 1:''' Config structure, validation, and documentation. '''Phase 2:''' Enforcement in runner and tools. '''Phase 3:''' Advanced policies (profiles, allowlists).

Value parameters

allowedCommands

Set of bare executable names permitted by executeCommand. Defaults to WorkspaceSandboxConfig.ReadOnlyCommands. Use WorkspaceSandboxConfig.ReadWriteCommands to also permit write-capable commands (cp, mv, rm, mkdir, …). Held to the checks WORKSPACE_EXTRA_COMMANDS gets (#3064): bare names, no batch file, nothing on WorkspaceSandboxConfig.NeverAllowedCommands unless also in trustedLaunchers.

allowedPaths

If non-empty, only these paths are accessible; if empty, whole workspace

defaultCommandTimeout

Default timeout for shell commands (more than zero, at most an hour)

excludePatterns

Glob patterns for paths to exclude from explore/search (e.g. node_modules, .git)

inheritedVariables

Names of the runner's environment variables a command also inherits, besides the fixed list (PATH, HOME, the locale, ...) (#3064): SBT_OPTS, COURSIER_CACHE. ContainerisedWorkspace passes each into the container (docker run -e NAME) from its own process's environment. Never a LD_ or DYLD_ loader variable, nor an LLM4S_ one (the runner's own, its token among them)

limits

Resource limits (file size, directory entries, search results, output size)

maxConcurrentCommands

The most commands that run at once (#3064); one more waits at the command gate, then is refused WORKSPACE_BUSY. None, the default, is no cap

networkAllowed

Whether commands may open network sockets; on Linux the runner enforces it (design §4.39)

readExecPaths

Absolute directories outside the workspace that a confined command may also read and execute from, besides the system ones (/usr, /opt, ...): a toolchain under /nix or /snap, which a PATH entry resolves but Landlock would refuse (exit 126) (#3064). Never /, nor a path holding ..; a grant over the workspace, or over the runner's own temporary directories, is dropped by the runner. Read and execute only: nothing there becomes writable

readOnlyPaths

Paths under workspace root that are read-only (writes denied)

shellAllowed

Whether executeCommand is allowed (false = read-only file ops only)

trustedLaunchers

Programs on WorkspaceSandboxConfig.NeverAllowedCommands - interpreters and launchers, each of which runs any code it is given - that allowedCommands may name anyway: an operator's explicit opt-in, as for a workspace that must run java. Naming one makes the allowlist no bound on what commands run; confinement (paths, network) still applies. Empty by default; never read from WORKSPACE_EXTRA_COMMANDS.

Attributes

Companion
object
Source
WorkspaceSandboxConfig.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

This config with more programs on its allowlist, as the runner's WORKSPACE_EXTRA_COMMANDS adds them.

This config with more programs on its allowlist, as the runner's WORKSPACE_EXTRA_COMMANDS adds them.

Each name must be a bare program name (letters, digits, ., _, +, -), not a Windows batch file (.bat, .cmd, which Windows runs through cmd.exe) and not one of WorkspaceSandboxConfig.NeverAllowedCommands, in any case, with or without a .exe / .com extension and with or without a version (BASH.EXE is bash, python3.12 is python).

'''An added program is trusted code execution.''' It is held to the same checks as the built-in ones (no shell, forbidden characters, path arguments inside the workspace, the environment allowlist), but it has no per-program option rules (bar those that stop tar, zip, rsync, scp and sftp running a program, #1805, and tar and rsync naming a file on another host, #1845), so it can do whatever its own arguments let it - and a build tool such as sbt runs the code in the workspace by design. The denylist only stops the obvious ways to run anything (shells, interpreters, launchers, loaders); it is not a boundary. Add only what the agent needs.

A config that does not run commands at all (shellAllowed = false, the locked profile) refuses any name, rather than report programs added that can never run (#1761).

Value parameters

names

program names separated by commas or whitespace

Attributes

Returns

the widened config, or why a name was refused

Source
WorkspaceSandboxConfig.scala

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product