magus v0.4.3 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 magus's subprocesses and in-process spells to the workspace plus a curated allowlist of toolchain, 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 is ro, rw, rx or rwx. Use the narrowest mode that lets the workflow succeed.

  3. If you want to turn the sandbox off for one invocation while you investigate:

    magus --sandbox=off run build
    

    The flag, not MAGUS_SANDBOX: the variable is a floor that magus.yaml can raise and never lower.

    Do not set sandbox.mode: off in magus.yaml to silence a real denial.

MGS2001sandboxsecuritypermissionsreadallowlistcredentials
Last updated (a9ff8609)
Earlier changes on this page (1)

Full history ↗ · Blame source ↗

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.

Invocation

One magus process's recorded facts - the targets it finished, their outcomes, the lease it acted as, and the session it ran in when a host delivered one - kept in a repo-scoped store every worktree shares. magus session lists them; the store prunes itself by last-fact age.

Run

One target executing under one magus invocation, such as magus run test web or magus affected ci. A run keeps its captured output behind an output reference. Every magus run is a run whether or not any job asked for it; see Job for how the two relate.

Conventions

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