Skip to main content
The rules on this page apply to every file operation, to watches, and to process working directories, in every API axed serves.

The root

Every path is confined to one directory, set with axed --root-dir (default /workspace). axed creates it if it is missing. axectl info and System.Info report it as root_dir. Confinement protects the rest of the sandbox from requests, which matters when axed is more privileged than the code in the sandbox. It does not stop processes you start from reading or writing outside the root; that is the job of the sandbox around axed. See Security.

How a path resolves

1

Clean the path

axed cleans the request path lexically first, like Go’s filepath.Clean: it drops . and empty components and folds a/../b into b. axed refuses a path that still climbs above the start, such as ../etc. Because axed cleans the path before it expands symlinks, link/.. always means the directory that holds link.
2

Strip the root from absolute paths

axed takes an absolute path under the root, such as /workspace/src/main.rs, relative to the root. See absolute paths for other absolute paths.
3

Walk one component at a time

axed opens each component with openat(O_PATH | O_NOFOLLOW) against a directory descriptor it already holds, starting from a descriptor of the root. It never reopens the path by name after checking it, so sandboxed code that swaps a directory for a symlink mid-request cannot redirect the operation.
4

Expand symlinks itself

When a component is a symlink, axed reads the link and continues resolving its target with the same rules, as described below.
axed follows a symlink only while its target stays inside the root. An absolute link target must start with the root’s real path, after resolving any symlinks in --root-dir itself. Operations treat the last component differently:
  • Stat, read, list, write and watch follow a final symlink. A write through a dangling link that stays inside the root creates its target.
  • Remove, move and copy act on the link itself, never its target.
  • List reports a symlink with its target’s metadata, never descends into it, and leaves out broken and escaping links.
Tar extraction is stricter: no entry may pass through any symlink, including one the archive created.

Absolute paths

REST paths come from the URL, so /v1/files/etc/passwd names etc/passwd under the root. An absolute destination for :move or :copy, such as /etc/moved.txt, lands at /workspace/etc/moved.txt. This follows sandboxd’s convention. Watches follow the file rules of their API. The native Files.Watch refuses an absolute path outside the root, and the Agent Sandbox WatchDir takes it relative to the root, like the REST API.

Depth limit

Resolution holds a descriptor for each directory level, so a very deep path could use up the descriptors other operations need. axed refuses paths more than 256 directories deep. Writes that create parents stop at the same depth. Directory walks, such as recursive list, copy, remove and watch, keep only the current directory open and are not bound by this limit.

What is refused, and with which error

For process working directories, the same cases fail the start: PERMISSION_DENIED for an escape, NOT_FOUND for a missing directory, and INVALID_ARGUMENT for a path that is not a directory.
Errors lists the full mapping, and Compatibility with sandboxd lists where these rules differ from sandboxd.