fix: repair pypi and npm policy presets for package manager traffic#356
Conversation
Closes #19. Two problems prevented pip install and npm install from working inside the sandbox even after applying the presets: 1. Presets used tls: terminate with REST method rules, which breaks CONNECT tunneling that package managers need. Switched to access: full (matching the working github preset pattern). Credit: @futhgar (PR #36) identified this fix. 2. Presets had no binaries section. Without it, OpenShell's proxy can't match pip/npm/node traffic to the policy and returns 403. Added binary paths covering system installs, venv, and uv-managed Python installations. Adds 2 regression tests verifying access: full and binaries sections.
OpenShell resolves symlinks before matching binaries. /usr/bin/python3 is a symlink to /usr/bin/python3.11 on Debian, so the exact path didn't match. Use python3* and node* globs to cover all versions.
📝 WalkthroughWalkthroughThe npm and pypi policy presets are simplified by replacing granular per-endpoint rules (protocol, enforcement, tls) with a unified Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
nemoclaw-blueprint/policies/presets/npm.yaml (1)
18-24: Consider adding missing/usr/binpatterns foryarnandnpx.The binaries section covers
yarn*andnpx*under/usr/local/binbut not under/usr/bin. Meanwhile,npm*andnode*are covered in both locations. This asymmetry could cause 403 errors when yarn or npx is installed via system package managers (e.g.,apt install yarnpkg).Proposed fix to add missing patterns
- { path: /usr/bin/npm* } - { path: /usr/bin/node* } + - { path: /usr/bin/yarn* } + - { path: /usr/bin/npx* }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@nemoclaw-blueprint/policies/presets/npm.yaml` around lines 18 - 24, The binaries list in the npm.yaml preset misses /usr/bin patterns for yarn and npx, creating an asymmetry with npm/node entries; update the binaries array (the entries for yarn* and npx* in the same "binaries" mapping) to include corresponding /usr/bin patterns (add entries for { path: /usr/bin/yarn* } and { path: /usr/bin/npx* }) so all four tools (npm, npx, node, yarn) are covered in both /usr/local/bin and /usr/bin.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@nemoclaw-blueprint/policies/presets/npm.yaml`:
- Around line 18-24: The binaries list in the npm.yaml preset misses /usr/bin
patterns for yarn and npx, creating an asymmetry with npm/node entries; update
the binaries array (the entries for yarn* and npx* in the same "binaries"
mapping) to include corresponding /usr/bin patterns (add entries for { path:
/usr/bin/yarn* } and { path: /usr/bin/npx* }) so all four tools (npm, npx, node,
yarn) are covered in both /usr/local/bin and /usr/bin.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a391c31f-21a7-4e02-9b45-b1a7514a2591
📒 Files selected for processing (3)
nemoclaw-blueprint/policies/presets/npm.yamlnemoclaw-blueprint/policies/presets/pypi.yamltest/policies.test.js
…ng fix Package managers use CONNECT tunneling which breaks under tls: terminate. Align with ericksoa's PR NVIDIA#356 which switches npm/pypi to access: full for the same reason.
…discord policies All 9 presets and the default telegram/discord entries in openclaw-sandbox.yaml lacked binaries sections, causing OpenShell's OPA rego to deny every request with 403 regardless of endpoint match. - Add binaries to all presets (discord, docker, huggingface, jira, npm, outlook, pypi, slack, telegram) - Add binaries to default telegram and discord policies - Switch pypi/npm from tls:terminate to access:full for CONNECT tunneling compatibility - Add test ensuring every preset includes a binaries section Closes NVIDIA#676 Related: NVIDIA#19, NVIDIA#356, NVIDIA#585 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cv
left a comment
There was a problem hiding this comment.
LGTM — access: full is the right call for CONNECT tunneling, and the glob patterns for binaries handle symlink resolution. Good tests.
…ng fix Package managers use CONNECT tunneling which breaks under tls: terminate. Align with ericksoa's PR NVIDIA#356 which switches npm/pypi to access: full for the same reason.
Add network policy presets for Rust Cargo, Go modules, Debian/Ubuntu apt repositories, and GitHub Container Registry. Each follows the existing YAML schema with access: full and binary restrictions, consistent with upstream direction (PR NVIDIA#356). Signed-off-by: Brian Taylor <brian.taylor818@gmail.com>
PR #356 added tests using node:assert which is not compatible with the vitest runner. Converts to vitest expect() to fix test-unit on main. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PR #356 added tests using node:assert which is not compatible with the vitest runner. Converts to vitest expect() to fix test-unit on main. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…VIDIA#356) * fix: repair pypi and npm policy presets for package manager traffic Closes NVIDIA#19. Two problems prevented pip install and npm install from working inside the sandbox even after applying the presets: 1. Presets used tls: terminate with REST method rules, which breaks CONNECT tunneling that package managers need. Switched to access: full (matching the working github preset pattern). Credit: @futhgar (PR NVIDIA#36) identified this fix. 2. Presets had no binaries section. Without it, OpenShell's proxy can't match pip/npm/node traffic to the policy and returns 403. Added binary paths covering system installs, venv, and uv-managed Python installations. Adds 2 regression tests verifying access: full and binaries sections. * fix: use glob patterns for binary paths in pypi/npm presets OpenShell resolves symlinks before matching binaries. /usr/bin/python3 is a symlink to /usr/bin/python3.11 on Debian, so the exact path didn't match. Use python3* and node* globs to cover all versions.
…IDIA#752) PR NVIDIA#356 added tests using node:assert which is not compatible with the vitest runner. Converts to vitest expect() to fix test-unit on main. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…VIDIA#356) * fix: repair pypi and npm policy presets for package manager traffic Closes NVIDIA#19. Two problems prevented pip install and npm install from working inside the sandbox even after applying the presets: 1. Presets used tls: terminate with REST method rules, which breaks CONNECT tunneling that package managers need. Switched to access: full (matching the working github preset pattern). Credit: @futhgar (PR NVIDIA#36) identified this fix. 2. Presets had no binaries section. Without it, OpenShell's proxy can't match pip/npm/node traffic to the policy and returns 403. Added binary paths covering system installs, venv, and uv-managed Python installations. Adds 2 regression tests verifying access: full and binaries sections. * fix: use glob patterns for binary paths in pypi/npm presets OpenShell resolves symlinks before matching binaries. /usr/bin/python3 is a symlink to /usr/bin/python3.11 on Debian, so the exact path didn't match. Use python3* and node* globs to cover all versions.
…IDIA#752) PR NVIDIA#356 added tests using node:assert which is not compatible with the vitest runner. Converts to vitest expect() to fix test-unit on main. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…VIDIA#356) * fix: repair pypi and npm policy presets for package manager traffic Closes NVIDIA#19. Two problems prevented pip install and npm install from working inside the sandbox even after applying the presets: 1. Presets used tls: terminate with REST method rules, which breaks CONNECT tunneling that package managers need. Switched to access: full (matching the working github preset pattern). Credit: @futhgar (PR NVIDIA#36) identified this fix. 2. Presets had no binaries section. Without it, OpenShell's proxy can't match pip/npm/node traffic to the policy and returns 403. Added binary paths covering system installs, venv, and uv-managed Python installations. Adds 2 regression tests verifying access: full and binaries sections. * fix: use glob patterns for binary paths in pypi/npm presets OpenShell resolves symlinks before matching binaries. /usr/bin/python3 is a symlink to /usr/bin/python3.11 on Debian, so the exact path didn't match. Use python3* and node* globs to cover all versions.
…IDIA#752) PR NVIDIA#356 added tests using node:assert which is not compatible with the vitest runner. Converts to vitest expect() to fix test-unit on main. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…VIDIA#356) * fix: repair pypi and npm policy presets for package manager traffic Closes NVIDIA#19. Two problems prevented pip install and npm install from working inside the sandbox even after applying the presets: 1. Presets used tls: terminate with REST method rules, which breaks CONNECT tunneling that package managers need. Switched to access: full (matching the working github preset pattern). Credit: @futhgar (PR NVIDIA#36) identified this fix. 2. Presets had no binaries section. Without it, OpenShell's proxy can't match pip/npm/node traffic to the policy and returns 403. Added binary paths covering system installs, venv, and uv-managed Python installations. Adds 2 regression tests verifying access: full and binaries sections. * fix: use glob patterns for binary paths in pypi/npm presets OpenShell resolves symlinks before matching binaries. /usr/bin/python3 is a symlink to /usr/bin/python3.11 on Debian, so the exact path didn't match. Use python3* and node* globs to cover all versions.
…IDIA#752) PR NVIDIA#356 added tests using node:assert which is not compatible with the vitest runner. Converts to vitest expect() to fix test-unit on main. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…VIDIA#356) * fix: repair pypi and npm policy presets for package manager traffic Closes NVIDIA#19. Two problems prevented pip install and npm install from working inside the sandbox even after applying the presets: 1. Presets used tls: terminate with REST method rules, which breaks CONNECT tunneling that package managers need. Switched to access: full (matching the working github preset pattern). Credit: @futhgar (PR NVIDIA#36) identified this fix. 2. Presets had no binaries section. Without it, OpenShell's proxy can't match pip/npm/node traffic to the policy and returns 403. Added binary paths covering system installs, venv, and uv-managed Python installations. Adds 2 regression tests verifying access: full and binaries sections. * fix: use glob patterns for binary paths in pypi/npm presets OpenShell resolves symlinks before matching binaries. /usr/bin/python3 is a symlink to /usr/bin/python3.11 on Debian, so the exact path didn't match. Use python3* and node* globs to cover all versions.
…IDIA#752) PR NVIDIA#356 added tests using node:assert which is not compatible with the vitest runner. Converts to vitest expect() to fix test-unit on main. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Closes #19.
Summary
tls: terminate+ REST rules toaccess: full(enables CONNECT tunneling)binariessections with glob patterns so OpenShell's proxy can match pip/npm/node traffic to the policypython3*,node*) because OpenShell resolves symlinks before matching —/usr/bin/python3is a symlink to/usr/bin/python3.11on DebianCredit to @futhgar (PR #36) for identifying the
access: fullfix.Problem
The onboard wizard suggests pypi and npm presets, but
pip installandnpm installfail with 403 errors inside the sandbox. Two issues:tls: terminatebreaks CONNECT tunneling that package managers needbinariessection means OpenShell's proxy can't match pip/npm traffic to the policyTest plan
pip install requestssucceeds inside sandbox after applying pypi presetSummary by CodeRabbit
Refactor
Tests