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

MGS2001: path read denied by sandbox

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

[MGS2001] fs read denied: /home/user/.aws/credentials

Why

The sandbox confines every magus subprocess and every in-process spell to the workspace plus a curated allowlist of cache and system paths. Reads of dotfile-style credential stores in $HOME are exactly what compromised supply-chain packages target, so they are denied by default.

Resolution

  1. If this is a malicious spell (the path is a credential file you never asked the spell to touch): do not lift the restriction. This is the system working as intended. Uninstall the spell and report it.

  2. If this is a legitimate spell that needs to read an external path (e.g. it reads ~/.terraform.d/plugins to discover providers): add the path to your workspace's magus.yaml:

    sandbox:
      allow:
        - path: ~/.terraform.d/plugins
          mode: ro
    

    mode: ro is read-only; mode: rw permits writes. Use the narrowest mode that lets the workflow succeed.

  3. If you want to disable sandbox for one invocation while you investigate:

    MAGUS_SANDBOX_ENABLED=0 magus run build
    

    Do not set sandbox.enabled: false in magus.yaml to silence a real warning.

MGS2001sandboxsecuritypermissionsreadallowlistcredentials
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

This page uses none of the site's convention markers. The full set is on the conventions page.