claude-code - 💡(How to fix) Fix Sandbox blocks Unix domain socket IPC with credential managers (rbw/Bitwarden CLI) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52471Fetched 2026-04-24 06:06:20
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Error Message

failed to listen on socket: Operation not permitted (os error 1)

Fix Action

Fix / Workaround

Current workaround

Code Example

failed to listen on socket: Operation not permitted (os error 1)
RAW_BUFFERClick to expand / collapse

Problem

The macOS Seatbelt sandbox blocks Unix domain socket operations (connect(), bind(), listen()), preventing CLI tools that communicate with local daemon processes via Unix sockets from working inside Claude Code sessions.

Specific case: rbw (unofficial Bitwarden CLI) communicates with rbw-agent via a Unix domain socket at /var/folders/.../rbw-501/socket. Any rbw get call from inside a sandboxed Claude Code session fails with:

failed to listen on socket: Operation not permitted (os error 1)

This affects autonomous agent workflows where agents need runtime access to secrets (API keys, tokens) stored in a password manager.

Reproduction

  1. Install rbw (brew install rbw) and configure with a Bitwarden vault
  2. Unlock rbw from a terminal: rbw unlock
  3. Start a Claude Code session (sandbox enabled in settings.json)
  4. Ask Claude to run: rbw get "any-entry"
  5. Result: Operation not permitted — socket connection blocked by Seatbelt

What doesn't work

  • excludedCommands: ["rbw"] — only bypasses filesystem restrictions, not Seatbelt IPC restrictions (#16076, #31551)
  • allowUnixSockets — only covers connect(), not bind()/listen() (#41817)
  • allowUnsandboxedCommands: true — does not actually disable the built-in Seatbelt profile for Bash subprocesses
  • Starting rbw-agent before Claude Code launch — agent runs fine, but Claude's process still can't connect() to its socket

Current workaround

Cache secrets to files at shell startup (before Claude launches), inject via $RBW_CACHE_DIR env var. Hooks and agents read cached files instead of calling rbw. This works but is a security downgrade — secrets sit as plaintext files instead of being vault-on-demand.

Impact

This blocks the recommended security pattern for autonomous agents: using a credential manager for runtime secret access with audit logging. The only alternative is pre-caching secrets to disk, which:

  • Eliminates vault-on-demand security (secrets persist as files until reboot)
  • Requires knowing upfront which secrets agents need
  • Can't handle short-lived or rotated tokens

Proposed solutions (any of these would fix it)

  1. Path-scoped allowUnixSockets that covers connect() + bind() + listen() — let users allowlist specific socket paths
  2. Fix excludedCommands to fully bypass Seatbelt for named binaries, including IPC restrictions (#31551)
  3. Add allowedSocketPaths as a new sandbox config option in settings.json
  4. Native secret reference resolution in settings.json (similar to #23642 for 1Password op:// references)

Related issues

  • #40209 — 1Password op CLI blocked by sandbox (Mach IPC variant of same problem)
  • #41817 — allowUnixSockets doesn't cover bind()
  • #50165 — Socket creation blocked in TMPDIR
  • #31551 — excludedCommands should bypass Mach port / IPC restrictions
  • #16076 — excludedCommands and allowUnixSockets silently ignored
  • #29533 — gh CLI TLS failures (Go Security.framework blocked by sandbox)
  • #44195 — Keychain access blocked (closed as not_planned)
  • #23642 — Native 1Password secret references in settings.json

Environment

  • macOS 15.x (Sequoia), Apple Silicon
  • Claude Code 2.1.x
  • rbw 1.15.0 (Rust Bitwarden CLI with background agent)
  • sandbox.enabled: true, allowUnsandboxedCommands: true

extent analysis

TL;DR

Implementing a path-scoped allowUnixSockets configuration to cover connect(), bind(), and listen() operations for specific socket paths could resolve the issue.

Guidance

  • Investigate the proposed solutions, focusing on implementing allowedSocketPaths as a new sandbox config option in settings.json to allowlist specific socket paths.
  • Verify the effectiveness of each proposed solution by testing rbw functionality within a Claude Code session after applying the respective configuration changes.
  • Consider the security implications of each potential fix, weighing the benefits of resolving the issue against potential security downgrades.
  • Review related issues (#40209, #41817, #50165, #31551, #16076, #29533, #44195, #23642) to understand the broader context and potential interactions with other system components.

Example

No code snippet is provided due to the lack of specific implementation details in the issue description.

Notes

The solution may require updates to Claude Code's sandbox configuration or the implementation of new features to support secure Unix socket operations. The effectiveness of each proposed solution should be evaluated in the context of the specific environment and requirements.

Recommendation

Apply a workaround by implementing a path-scoped allowUnixSockets configuration or adding allowedSocketPaths as a new sandbox config option, as these solutions directly address the root cause of the issue and provide a more secure alternative to the current workaround of caching secrets to files.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING