Per-session mount role grants (read/write/exec)#436
Open
zechengz wants to merge 4 commits into
Open
Conversation
Sessions can now be granted per-mount roles: create_session(id, mounts={'/data': 'read', '/scratch': 'write'}). The mount mode stays the ceiling; a grant only narrows it. List form keeps the old allowlist behavior. Exposed on the SDK, server, and CLI (-m /data:read) in both languages, with integ truth coverage. A user-defined root mount is now governed by grants instead of bypassing them, and the python capability error gained the GNU-style command prefix to match TS. The mirage runtime package is renamed to mirage/context (core/src/context).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Sessions can be restricted to per-mount roles. The mount's configured mode is the ceiling; a session grant can only narrow it on the READ < WRITE < EXEC lattice.
ws.create_session("agent", mounts={"/data": "read", "/scratch": "write"}); a plain list keeps the previous allowlist behavior (mount's own mode). TS:ws.createSession(id, { mounts }).mirage session create WS -m /data:read -m /scratch:write(bare-m /datainherits).POST /sessions {"mounts": {...}}, dict or list; invalid role returns 422.effective_mount_mode, so a session-denied write produces the same stderr as a read-only mount. Thepythonbuiltin exec gate is per-session now. Grants survive fork, background jobs, and snapshots.Behavior changes
/mount is now governed by grants instead of bypassing the allowlist (the documented escape hatch). The implicit scratch root stays auto-granted so pathless commands keep working in restricted sessions.cat: session 'x' not allowed ...), matching TS.mirage/runtimeis renamed tomirage/context(TScore/src/context).Testing
integ/grants.py/integ/grants.tswith byte-identical output againsttruth_grants.txt, wired into both integ legs.