MGS2004: sandbox config failed to resolve
A sandbox declaration could not be turned into rules: a sandbox.allow entry or a
sandbox.env.passthrough pattern in magus.yaml, a spell's mgs_getSandbox(), or a
target's sandbox policy. magus stops before running anything: the workspace's when
the policy is built, a spell's when the spell loads, a target's when its magusfile
loads.
[MGS2004] sandbox config for /home/user/project: sandbox: "$NONEXISTENT_VAR/cache": variable is unset or empty: NONEXISTENT_VAR
[MGS2004] spell "tool": mgs_getSandbox: allow[0]: path "../cache" must be a relative path that stays under base userCache
Why
A literal sandbox.allow path in magus.yaml supports ~ for the home directory and
$VAR references resolved against the current environment. An unset or empty variable
expands to nothing, and $UNSET/ would then grant /. A mode outside ro, rw, rx
and rwx (a typo such as RW) would grant something other than what was written. A
base magus does not know, a path that leaves its base, or a base with no path
under it (all of ~/.cache) grants something nobody meant. A passthrough pattern such
as GO* matches more than it names (GOOGLE_APPLICATION_CREDENTIALS). Each of these is
refused rather than skipped: a sandbox that silently grants less breaks builds nobody
can trace, and one that grants more is not a sandbox.
A spell and a target may not write $VAR into a path: a variable unset on one host
would fail every run there. They name it in env, or use a $VAR base, which grants
nothing while the variable is unset.
Every bad entry is reported at once.
Resolution
- Check that any
$VARreferenced in amagus.yamlpath is set, and not empty, in the environment magus runs in, or replace it with an absolute path or anenvandbase. - Use
ro,rw,rxorrwxformode. Exec is never implied, so a directory of tools needsrx. - Use a base from the sandbox model,
with a relative
pathunder it. - Write a passthrough prefix as at least three characters ending in
_(MISE_*,LC_*), or list the variables by name. - Remove the entry if it was a typo.
Also fires
When the job store cannot be read while narrowing the sandbox to a lease, magus logs this code as a warning and keeps the workspace's write grant, matching the guard: a lease that stops resolving must not brick the checkout a person is working in.