diff --git a/.claude/rules/pnpm-usage.md b/.claude/rules/pnpm-usage.md index 66a5330..10ac362 100644 --- a/.claude/rules/pnpm-usage.md +++ b/.claude/rules/pnpm-usage.md @@ -44,6 +44,21 @@ fish -c "" 2. **Binary not found**: Use `pnpm dlx` instead of `pnpm exec` 3. **Permission errors**: Check node_modules permissions +## Security Settings + +The project uses pnpm security settings to protect against supply chain attacks. +These are configured in `pnpm-workspace.yaml`: + +| Setting | Purpose | +| --------------------------- | ------------------------------------------------------------------------------------------------------------------------ | +| `strictDepBuilds: true` | Blocks lifecycle scripts (postinstall, etc.) by default. Only packages in `onlyBuiltDependencies` can run build scripts. | +| `blockExoticSubdeps: true` | Blocks dependencies from non-registry sources (Git repos, tarball URLs). | +| `trustPolicy: no-downgrade` | Prevents trust level downgrades between versions (e.g., from GitHub OIDC to basic auth). | + +If a new dependency requires build scripts, add it to `onlyBuiltDependencies` in `pnpm-workspace.yaml`. + +Reference: https://pnpm.io/settings + ## Publishing & Deployment When ready to release: diff --git a/.cursor/rules/nix-workflow.mdc b/.cursor/rules/nix-workflow.mdc new file mode 120000 index 0000000..cc4b748 --- /dev/null +++ b/.cursor/rules/nix-workflow.mdc @@ -0,0 +1 @@ +../../.claude/rules/nix-workflow.md \ No newline at end of file diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 0750d5b..f421301 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -57,6 +57,20 @@ onlyBuiltDependencies: shellEmulator: true +# Security settings (supply chain attack prevention) +# See: https://pnpm.io/settings + +# Blocks lifecycle scripts (postinstall, etc.) from running in dependencies by default +# Only packages listed in onlyBuiltDependencies can run build scripts +# Prevents Shai-Hulud-style worm attacks that exploit automatic script execution +strictDepBuilds: true + +# Blocks dependencies from non-registry sources (Git repos, tarball URLs) +# Prevents PhantomRaven-style attacks that bypass npm scanning +blockExoticSubdeps: true + +# Prevents trust level downgrades between package versions +# Blocks installations when publisher credentials downgrade from GitHub OIDC to basic auth trustPolicy: no-downgrade trustPolicyExclude: