Files
pmg/sandbox/profiles
788a031003 Fix glob parent directory allowance for patterns with glob characters (#331)
* fix(sandbox): support pnpm workspaces and macOS cache dir in pnpm profile

pnpm in a workspace (monorepo) creates a node_modules directory inside
every workspace package to symlink direct dependencies. The profile only
allowed writes to the root node_modules, so installs failed with EPERM
on mkdir of e.g. apps/mobile/node_modules.

pnpm on macOS also writes its cache (lockfile verification, metadata)
under ~/Library/Caches/pnpm, while the base profile only covers the XDG
path ~/.cache/pnpm.

Fixes are scoped to the pnpm leaf profile, not the shared
npm-restrictive base.

Ref: https://github.com/safedep/pmg/issues/329

* fix(sandbox): emit regex parent rule for nested-glob allow patterns on Seatbelt

For allow patterns ending in /**, the translator auto-allows the parent
directory so mkdir/stat of the directory itself succeeds. The rule was
always emitted as a literal, which can never match when the parent still
contains glob characters (e.g. ${CWD}/**/node_modules from a workspace
allowance) — silently leaving the directory's own creation denied.

Emit a regex rule for glob-bearing parents instead. This stays strictly
narrower than the Linux drivers (Bubblewrap binds the prefix before the
first /** read-write; Landlock grants the glob expansion or its parent),
and deny rules are emitted after allows, so mandatory credential denies
still override.

Ref: https://github.com/safedep/pmg/issues/329

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-12 12:11:12 +05:30
..

PMG Sandbox Profiles

This directory contains built-in sandbox policies for PMG package managers.

Available Profiles

npm-restrictive

Restrictive policy for the npm ecosystem (npm, pnpm, yarn, bun).

pypi-restrictive

Restrictive policy for the PyPI ecosystem (pip, pip3, poetry, uv).

Custom Policies

You can create custom sandbox policies by:

  1. Copying one of the built-in profiles
  2. Modifying the rules to suit your needs
  3. Referencing the custom profile in your PMG config:
sandbox:
  enabled: true
  policies:
    npm:
      enabled: true
      profile: /path/to/custom-npm-policy.yml

Policy Schema

See the Policy Schema Documentation for details on the YAML structure.

Supported Variables

  • ${HOME}: User home directory
  • ${CWD}: Current working directory
  • ${TMPDIR}: Temporary directory

Policy Enforcement

All policy violations will block execution. This provides defense-in-depth protection against malicious install scripts and supply chain attacks.