v2: default mount mode should be read-only
Author: samuelcolvinCreated Sep 27, 2026Updated Sep 30, 2026
LabelsenhancementV2
MountDir and RemoteVolume both default to mode='overlay'. In v2 the default for both should become 'read-only'.
Why
Read-only is the least surprising default for handing data to untrusted code: nothing the sandbox does is kept, and writes fail loudly with PermissionError rather than appearing to succeed and then being discarded. Overlay and read-write remain available as explicit choices.
What changes
MountDir(..., mode=...)andRemoteVolume(..., mode=...)inpydantic_montydefault to'read-only'.- The same default in the JavaScript
MountDir. - An unspecified
MountModeon the wire is read as read-only. - Docs that state the default:
docs/filesystem.md,limitations/filesystem.md, the binding docstrings.
This is a breaking change for code that relies on the default and writes to a mount, so it waits for v2.
Source: pydantic/monty