magus v0.3.0 is out. See what's new
¶ View markdown source · ✎ Suggest an edit

MGS2002: path write denied by sandbox

A spell tried to write to a file outside the workspace and outside the configured allowlist.

[MGS2002] fs write denied: /home/user/.bashrc

Why

The sandbox denies writes outside <workspace> and /tmp by default. This blocks the supply-chain attack pattern of modifying shell startup files, sudoers, or cron tables for persistence.

Resolution

  1. If the write target is a legitimate cache (e.g. a Rust spell writing to ~/.cargo/registry/cache): add it to magus.yaml:

    sandbox:
      allow:
        - path: ~/.cargo
          mode: rw
    
  2. If the spell should be writing inside the workspace but is using an absolute path: the spell has a bug. File an issue with the spell author; in the meantime grant the path explicitly or disable sandbox mode.

  3. If this is a malicious spell: do not grant the path. Uninstall.

MGS2002sandboxsecuritypermissionswriteallowlistpersistence
Last updated (b022d75e)
Glossary

Workspace

The magus root directory that owns a set of projects and shared config; the unit magus operates over. See workspace.

Target

A named operation (build, test, ...) you invoke with magus run <target>; it may compose a spell's tool-native operations and depend on other targets. See targets.

Spell

A language/runtime adapter (e.g. go, md) that maps generic targets onto a toolchain's real commands. See spells.

Cache

The content-addressed store magus consults before running a target, so unchanged work is skipped. See cache.

Sandbox

The restricted filesystem and environment a target runs in, so builds stay reproducible and side-effect-free. See sandbox.

CI

An ordinary magusfile-defined target you compose yourself with magus\needs - magus does not hardcode its stages. Magus.RunCI treats it specially only in that it strips the rw charm, it is the anchor magus affected ci keys off, and a selected scope with no project declaring it is a load error rather than a silent no-op. See targets.

Conventions

Placeholders

Angle brackets mark a value you replace with your own - never type the brackets:

magus run <target>
magus completion <shell>    # e.g. bash, zsh, fish

<target>, <path>, <shell>, <name> and the like are stand-ins, not literal text.