[Linux] Policy edge case: npm install blocked (403) - registry.npmjs.org not GET-allowed in sandbox
Description
Test Plan - https://docs.google.com/document/d/14bIihtww1Jtzz9eU-FdmFixKRFO9WI_OuGw9yrEP9Cw/edit?pli=1&tab=t.0 #5.4.1
Description
Summary:
Inside the NemoClaw sandbox, npm install lodash fails with 403 Forbidden on GET https://registry.npmjs.org/lodash. The test plan (5.4 Policy Edge Cases) expects the npm registry to be GET-allowed so that npm install succeeds. In practice, egress to registry.npmjs.org is blocked (or the proxy returns 403), so the “npm registry GET-allowed” behaviour is not met. Steps to reproduce:
-
Deploy NemoClaw to a Brev instance and connect to the sandbox: nemoclaw connect my-nemoclaw-test.
-
In the sandbox shell run: npm install lodash.
-
Observe the result.
npm install succeeds (registry.npmjs.org is in the allow list for GET; HEAD also works as needed). Actual:
npm fails with:
pruprakash@700d01b-lcedt:~/Documents/pruprakash/openshell-openclaw-plugin$ nemoclaw connect my-nemoclaw-test sandbox@nemoclaw:~$ curl --connect-timeout 5 http://1.2.3.4:80 sandbox@nemoclaw:~$ npm install lodash (node:82) [UNDICI-EHPA] Warning: EnvHttpProxyAgent is experimental, expect them to change at any time. (Use `node --trace-warnings ...` to show where the warning was created) npm error code E403 npm error 403 403 Forbidden - GET https://registry.npmjs.org/lodash npm error 403 In most cases, you or one of your dependencies are requesting npm error 403 a package version that is forbidden by your security policy, or npm error 403 on a server you do not have access to. npm error A complete log of this run can be found in: /sandbox/.npm/_logs/2026-03-16T00_56_36_292Z-debug-0.log sandbox@nemoclaw:~$ Cause:
Sandbox network policy (or egress proxy) does not allow GET (and/or HEAD) to registry.npmjs.org, or the policy allow list does not include the npm registry. Needs a policy/allow-list update so that registry.npmjs.org is permitted for npm install (GET/HEAD). Environment:
OpenShell 0.0.4, NemoClaw sandbox on Brev VM (my-nemoclaw-test), network policy / egress as configured by NemoClaw deploy. Reference:
Test plan 5.4 Policy Edge Cases, item 1: “npm install a package (requires GET + HEAD to registry) — Succeeds (npm registry is GET-allowed; verify HEAD also works)”.
Steps to reproduce
No steps provided.
[NVB# 5982638]
[NVB#5982638]
Same root cause as #681 — node is missing from the npm_registry binaries in the base policy. PR #669 fixes this.
Same root cause as #481 — node binary missing from npm_registry policy binaries
The fix is the same as the binaries gap in #481: the npm_registry policy preset allows the endpoint but doesn't list the node binary as an authorized caller, so every npm request gets 403'd at the proxy.
Workaround — pull your current policy, add node to the npm_registry binaries block, and push it back:
openshell policy get my-assistant --full > policy.yaml
# Strip metadata header
tail -n +8 policy.yaml > fix-policy.yaml
Then add to the npm_registry section in fix-policy.yaml:
binaries:
- path: /usr/local/bin/node
- path: /usr/bin/node
- path: /usr/local/bin/npm
- path: /usr/bin/npm
Then push:
openshell policy set my-assistant --policy fix-policy.yaml --wait
Hot-reloads in under 5 seconds. Same pattern applies to any other preset where node/npm is the caller — pypi needs /sandbox/.venv/bin/python3 and /sandbox/.uv/python/*/bin/python* for the same reason (see #481).
@jacobtomlinson @ericksoa @drobison00 Reproduced on Ubuntu 22.04 — npm install inside sandbox returns 403 even though the npm policy preset shows as applied (●). The registry.npmjs.org host appears to not be GET-allowed for the npm binary. This blocks a core package management workflow. Suggest reviewing the npm preset to ensure it covers all required npm registry endpoints and binaries.
@hulynn This is fixed on current main — PR #669 merged on Mar 30, adding /usr/local/bin/node to the npm_registry binaries list in openclaw-sandbox.yaml.
Root cause: npm is a Node.js script, so the actual binary making HTTPS CONNECT requests to the proxy is /usr/local/bin/node, not /usr/local/bin/npm. The proxy checked the calling binary against the policy and returned 403 when node wasn't listed.
Our PR https://github.com/NVIDIA/NemoClaw/pull/1358 addresses this — converts npm_registry from access: full (L4 pass-through) to protocol: rest with GET /** enforcement. E2E validated: npm install lodash and npm install axios both succeed inside the sandbox with the updated policy.
Fixed in #1358 (merged Apr 7) — npm_registry was converted from access: full to protocol: rest with GET /** enforcement, which resolves the 403 blocking pattern. Closing as fixed.
This issue is now resolved with Nemoclaw v0.0.23. Bug was closed