code and embedded-python only.Expand description
Filesystem mounting system for sandboxed execution.
Provides MountTable, which maps virtual paths to real host directories
with configurable access modes. When sandbox code calls filesystem methods
like Path.read_text(), the mount table intercepts the operation, resolves
the virtual path, and executes it according to the mount mode.
This crate is HOST-side code: it performs real std::fs I/O and is linked
only by host/parent crates (monty-pool, the CLI, bindings). The monty
interpreter crate deliberately does not depend on it — sandboxed code can
only request filesystem operations by suspending with an
OsFunctionCall, which a host holding a
MountTable services via MountTable::handle_os_call.
§Security
The monty runtime MUST NEVER read, write, or obtain any information about any file or directory outside the specific directory that is mounted.
Enforced by path_security::resolve_path via path canonicalization,
boundary checks, and symlink escape detection.
Each mount has an aggregate memory budget, defaulting to
DEFAULT_MEMORY_USAGE_LIMIT, for retained overlay data and results.
§Mount Modes
MountMode::ReadWrite— full read/write access to the host directoryMountMode::ReadOnly— reads work, writes raisePermissionErrorMountMode::OverlayMemory— reads fall through to host; writes stored in memory
Structs§
- Mount
- A single mount point mapping a virtual path to a host directory.
- Mount
Table - A collection of mount points mapping virtual paths to host directories.
- Overlay
State - In-memory overlay state for
super::MountMode::OverlayMemory.
Enums§
- Mount
Call Outcome - Outcome of
MountTable::handle_os_call. - Mount
Error - Errors from mount configuration or filesystem operations.
- Mount
Mode - Access policy for a mount point.
Constants§
- DEFAULT_
MEMORY_ USAGE_ LIMIT - Default aggregate memory budget for one mount: 100 MB in decimal bytes.