[Policy] Bundled claude-code preset denies api.anthropic.com for npm-installed Claude Code: binaries allowlist names the npm shim, not the resolved binary
Investigation Summary
- The
claude-codepreset allowlists/tmp/npm-global/bin/claude, but OpenShell enforces on/proc/<pid>/exe, which for a global npm install resolves to/tmp/npm-global/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe— a path the preset does not list, so every request toapi.anthropic.comis DENIED. - Confirmed against the documented behavior: the network policy reference states OpenShell identifies the calling binary via
/proc/<pid>/exe(the kernel-trusted path, "not argv[0]"), so a shim path can never match for an npm-installed CLI. - The denial log itself shows the contradiction:
cmdline: [/tmp/npm-global/bin/claude](allowlisted) while enforcement rejects the resolvedclaude.exe. - Adding the resolved path to the preset's
binariesand re-applying fixes it completely —claude auth loginthen proceeds normally. Verified locally on v0.0.90 / OpenShell 0.0.85. - Unknown: whether other npm-distributed CLIs covered by built-in presets have the same shim-vs-resolved mismatch. I only tested claude-code.
Description
The built-in claude-code policy preset cannot authorize the Claude Code CLI when it is installed the way NemoClaw's own bundled skill documents, because the binaries allowlist names the npm shim rather than the executable OpenShell actually enforces on.
What happened
After policy-add claude-code and installing Claude Code with npm inside the sandbox, every connection to api.anthropic.com is denied — including the initial OAuth login, so the CLI cannot be authenticated at all.
The preset lists these paths:
binaries:
- { path: /usr/local/bin/claude }
- { path: /usr/bin/claude }
- { path: /tmp/npm-global/bin/claude }
- { path: /home/linuxbrew/.linuxbrew/bin/claude }
- { path: /usr/local/bin/node }
- { path: /usr/bin/node }
/tmp/npm-global/bin/claude is the npm shim. A global npm install places the real executable at:
/tmp/npm-global/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe
Per the network policy reference, OpenShell "identifies the calling binary by reading /proc/
What I expected
Applying the claude-code preset and installing Claude Code per the bundled skill's documented method should allow the CLI to reach api.anthropic.com.
Why this matters beyond the one path
- The shipped preset contradicts the shipped skill.
~/.hermes/skills/autonomous-ai-agents/claude-code/SKILL.md(v2.2.0, bundled with Hermes Agent) documentsnpm install -g @anthropic-ai/claude-codeunder "Prerequisites". The preset then denies the binary that method produces. - The preset already anticipates the npm prefix —
/tmp/npm-global/bin/claudeis listed, and/usris read-only in the sandbox so--prefix /tmp/npm-globalis the natural install target. Only the resolution step is wrong. - The failure points users in the wrong direction. It surfaces as a network policy denial for
api.anthropic.com, and the CLI only sees the proxy's 403. The hint printed by nemoclaw suggestspolicy-add <preset>— which is already satisfied. The real cause appears only in the sandbox log line.
Suggested fixes (any one resolves it)
-
Minimal: add the resolved path to the preset's
binaries:- { path: /tmp/npm-global/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe }Verified working locally.
-
Better: resolve symlinks/shims when building the allowlist, so listing a shim also authorizes its target.
-
Also helpful: when a denial's
cmdlinebinary is allowlisted but the resolved/proc/<pid>/exeis not, say so explicitly in the user-facing hint instead of pointing only at egress presets.
Relation to #2748
#2748 concerns the same preset but the opposite failure: /usr/local/bin/claude being absent from the image, causing OPA symlink-resolution WARN logs on policy reload. Here the binary is present and running, and is actively DENIED because the allowlist names the shim rather than the resolved target. The npm path is unaffected by that issue's resolution.
Reproduction Steps
-
nemoclaw <sandbox> policy-add claude-code --yes -
Install Claude Code inside the sandbox using the method documented in the bundled skill.
/usris read-only in the sandbox, so the npm prefix the preset already anticipates is used:nemoclaw <sandbox> exec -- npm install -g --prefix /tmp/npm-global @anthropic-ai/claude-code -
Confirm the binary itself runs (policy is not consulted for local exec):
nemoclaw <sandbox> exec -- /tmp/npm-global/bin/claude --version->2.1.218 (Claude Code) -
Attempt to authenticate:
nemoclaw <sandbox> exec --tty -- /tmp/npm-global/bin/claude auth login --claudeaiThe OAuth URL is printed, but every call to api.anthropic.com is denied and login cannot complete.
claude auth statuscontinues to report{"loggedIn": false, "authMethod": "none"}. -
nemoclaw <sandbox> logs --tail 50shows the denial (see Logs below).
Confirming the cause:
-
Add
- { path: /tmp/npm-global/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe }to thebinarieslist innemoclaw-blueprint/policies/presets/claude-code.yaml, thenpolicy-remove claude-code --yesandpolicy-add claude-code --yes. -
Re-run step 4. The denials stop and login proceeds normally.
Environment
- OS: Windows 11 Pro 26200 + WSL2 (Ubuntu 24.04.4 LTS, kernel 6.6.114.1-microsoft-standard-WSL2)
- Hardware: x86_64 workstation, NVIDIA GeForce RTX 5080 (driver 595.95, CUDA 13.2)
- Node.js: v22.23.1 (host) / v24.16.0 (sandbox)
- npm: 10.9.8 (host) / 11.13.0 (sandbox)
- Docker: Docker Engine 29.4.0
- NemoClaw: v0.0.90 (source HEAD acfa2613c7a645ae1bff21914f25d824e5fbcf62)
- OpenShell: 0.0.85 (docker)
- Hermes Agent: v0.18.0
- Claude Code: 2.1.218
- Preset file: nemoclaw-blueprint/policies/presets/claude-code.yaml
- Sandbox policy revision at time of failure: 15
Debug Output
Excerpt from nemoclaw debug --quick, trimmed to the relevant sections
(the full output includes unrelated provider/channel configuration for this
deployment). Happy to attach the full bundle if useful.
═══ System ═══
Linux 6.6.114.1-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC x86_64 GNU/Linux Mem: 31785 total, 29078 free
═══ Docker ═══
CONTAINER ID IMAGE COMMAND CREATED STATUS 91a2cc95f281 23b9254ddbfc "/opt/openshell/bin/…" 3 days ago Up 9 hours NAMES: openshell-my-hermes-41784e5a-7387-486c-ad24-c5d2ae8240d5
═══ OpenShell ═══
Server Status Gateway: nemoclaw-8990 Server: https://127.0.0.1:8990 Status: Connected Version: 0.0.85
NAME CREATED PHASE my-hermes 2026-07-22 13:14:11 Ready
Sandbox: Id: 41784e5a-7387-486c-ad24-c5d2ae8240d5 Name: my-hermes Phase: Ready Policy source: sandbox Revision: 17 (15 at time of failure; 17 = after adding the resolved path)
Applied policies: npm, pypi, huggingface, brew, local-inference, slack, searxng-search, dgx-agent-a1, dgx-ornith, dgx-nano, models-dev-metadata, opencode-zen, claude-code
═══ Sandbox Internals ═══
UID PID PPID C STIME TTY TIME CMD root 1 0 0 Jul25 ? 00:00:34 /opt/openshell/bin/openshell-sandbox sandbox 79 1 1 Jul25 ? 00:09:30 bash /usr/local/bin/nemoclaw-start sandbox 246652 79 0 Jul25 ? 00:02:12 /opt/hermes/.venv/bin/python /usr/local/bin/hermes.real gateway run
Effective claude_code policy as applied (from policy-add claude-code --dry-run):
policy 'claude_code': - api.anthropic.com:443 (protocol: rest, enforcement: enforce) allow GET /, POST / - statsig.anthropic.com:443 (protocol: rest, enforcement: enforce) allow GET /, POST / - sentry.io:443 (protocol: rest, enforcement: enforce) allow GET /, POST / binaries: - /usr/local/bin/claude - /usr/bin/claude - /tmp/npm-global/bin/claude - /home/linuxbrew/.linuxbrew/bin/claude - /usr/local/bin/node - /usr/bin/node
Logs
[sandbox] [OCSF ] [ocsf] NET:OPEN [MED] DENIED /tmp/npm-global/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe(95326) -> api.anthropic.com:443 [policy:- engine:opa] [reason:binary '/tmp/npm-global/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe' not allowed in policy 'claude_code' (ancestors: [/opt/openshell/bin/openshell-sandbox], cmdline: [/tmp/npm-global/bin/claude]). SYMLINK HINT: the binary path is the kernel-r...]
[sandbox] [INFO ] [openshell_sandbox] Flushed activity summary to gateway denied_action_count=3 network_activity_count=3 sandbox_name=my-hermes
(repeats for every retry; the SYMLINK HINT is truncated in the log output,
which suggests this failure mode is already anticipated upstream)
Client side, the CLI only sees the proxy 403, and nemoclaw prints:
nemoclaw: recent network policy denial detected for api.anthropic.com:443 inside sandbox 'my-hermes'.
The sandbox's egress policy blocked this request; the tool above only saw the proxy's 403.
Allow the host: nemoclaw my-hermes policy-add <preset>
The suggested remediation is already satisfied — claude-code was applied before
the install. Nothing in the user-facing output points at the binaries list.
Checklist
- [x] I confirmed this bug is reproducible
- [x] I searched existing issues and this is not a duplicate
Second gap in the same preset: platform.claude.com is missing, so subscription (Pro/Max) OAuth cannot complete After applying the binaries fix from the original report, claude could reach api.anthropic.com — but logging in still failed. Reporting it here rather than as a separate issue because it is the same root theme: the preset does not cover the install-and-auth path that NemoClaw's own bundled skill documents.
Symptom
$ nemoclaw
Login failed: Socket is closed
Cause
NET:OPEN [MED] DENIED /tmp/npm-global/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe(1202326)
-> platform.claude.com:443 [policy:- engine:opa]
[reason:endpoint platform.claude.com:443 is not allowed by any policy]
platform.claude.com is where the subscription OAuth code exchange happens — it is the redirect_uri host in the authorize URL the CLI prints (redirect_uri=https%3A%2F%2Fplatform.claude.com%2Foauth%2Fcode%2Fcallback). The preset allows only api.anthropic.com, statsig.anthropic.com, and sentry.io, so the exchange is blocked and login can never complete.
Note this is a different failure mode from the binaries mismatch in the original report: the reason string here is endpoint ... is not allowed by any policy rather than binary ... not allowed in policy. Both must be fixed for the documented flow to work.
Why this matters The bundled skill ~/.hermes/skills/autonomous-ai-agents/claude-code/SKILL.md (v2.2.0) documents under Prerequisites:
Auth: run claude once to log in (browser OAuth for Pro/Max, or set ANTHROPIC_API_KEY)
The preset supports the ANTHROPIC_API_KEY path but not the browser-OAuth path listed first. A Pro/Max subscriber following the documented instructions cannot authenticate at all.
Login failed: Socket is closed also gives no indication that a policy is involved — the actual reason appears only in nemoclaw
Suggested fix Add the host, scoped to the OAuth endpoints:
- host: platform.claude.com
port: 443
protocol: rest
enforcement: enforce
rules:
- allow: { method: GET, path: "/v1/oauth/**" }
- allow: { method: POST, path: "/v1/oauth/**" }
Verified working: after adding this and re-applying the preset, claude auth login --claudeai completes and claude -p runs normally against a Pro subscription.
I initially allowed /** on this host, then checked the L7 log to see what the flow actually used:
HTTP:POST [INFO] ALLOWED POST http://platform.claude.com:443/v1/oauth/token [policy:claude_code engine:l7] Only POST /v1/oauth/token (initial exchange, and presumably refresh). Narrowing to /v1/oauth/** keeps the rest of the console surface on that host out of reach of a compromised sandbox, and login still works. Suggesting the narrow scope rather than /** for that reason.
Not needed in the sandbox claude.com (the authorize URL) does not need allowlisting — that URL is opened in the user's own browser on the host, never fetched from inside the sandbox. No denial for it appeared in the logs across several login attempts.
Environment Same as the original report: NemoClaw v0.0.90, OpenShell 0.0.85 (docker), Hermes Agent v0.18.0, Claude Code 2.1.218, Ubuntu 24.04 on WSL2.