Skip to content

fix(permissions): skip user/managed-only claudecode sandbox keys at project scope - #2694

Merged
dyoshikawa merged 1 commit into
mainfrom
resolve-issue-2664-claudecode-sandbox-scope
Aug 17, 2026
Merged

dyoshikawa merged 1 commit into
mainfrom
resolve-issue-2664-claudecode-sandbox-scope

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Background

claudecode.sandbox was deep-merged into whatever settings.json was being written, with no key inspection and no scope check — the same subtree for project and global. But Claude Code honors a subset of sandbox.* only from user settings, managed settings and --settings, and ignores it in a repository's .claude/settings.json / .claude/settings.local.json.

Net effect before this change: a user who authors claudecode.sandbox.network.strictAllowlist: true and runs a project-scope generate gets a committed .claude/settings.json that reads as though it enforced a sandbox policy and does nothing. For strictAllowlist and the credential keys that is a security-relevant silent no-op.

Verified against primary sources rather than the issue text — which is why the shipped list is narrower than the one proposed there:

  • https://code.claude.com/docs/en/sandboxing — filesystem.disabled ("Project settings in .claude/settings.json and .claude/settings.local.json can't"), network.strictAllowlist ("Setting it in a repository's ... has no effect"), network.tlsTerminate + credentials.allowPlaintextInject ("all ignored in a repository's ..."), credentials.awsPairs and credentials.sigv4 ("honored only from user settings, managed settings, and the --settings CLI flag"), allowAppleEvents ("Project settings cannot enable it").
  • CHANGELOG v2.1.232 — "Changed sandbox.ripgrep to be honored only from user, managed, and --settings settings".

Two corrections to the issue's proposed list, both recorded in a code comment:

  • bwrapPath / socatPath are not included. The v2.1.232 entry puts them in the managed-settings approval dialog ("requires approval for server-managed sandbox binary overrides"), which is a consent prompt, not a project-scope rejection.
  • credentials.mask is not a settings key. What the docs scope is mask entries inside credentials.files, i.e. a per-entry mode. The same list carries deny entries that project settings do honor, so dropping it would remove real restrictions.

Changes

  • CLAUDECODE_GLOBAL_ONLY_SANDBOX_PATHS + stripGlobalOnlySandboxPaths, applied to the override copy only when generating project scope, warning once per dropped path. A value already hand-written in the target file is left untouched — the qwencode security.allowPrivateNetworkHooks precedent.
  • Global scope emits everything unchanged. Import stays scope-agnostic, as the issue proposes.
  • Scope caveat added to docs/reference/file-formats.md; bwrap added to cspell.json.
  • Tests: project-scope drop (with a sibling deniedDomains restriction surviving beside the dropped strictAllowlist), global-scope passthrough, and hand-written-value preservation. The existing deep-merge test now uses network.allowedDomains, a key project settings do honor, so it still tests the merge rather than the new filter.

e2e-permissions.spec.ts re-run locally (85 passed). This is the only gap the 2026-08-17 re-check added to #2664; the dynamic-workflows and scheduled-task items are unaffected, so the issue stays open.

Part of #2664

@dyoshikawa
dyoshikawa force-pushed the resolve-issue-2664-claudecode-sandbox-scope branch 2 times, most recently from ff333d9 to 9f72367 Compare August 17, 2026 10:06
@dyoshikawa
dyoshikawa force-pushed the resolve-issue-2664-claudecode-sandbox-scope branch from 9f72367 to 8f769a9 Compare August 17, 2026 10:34
@dyoshikawa
dyoshikawa merged commit 6200232 into main Aug 17, 2026
5 checks passed
@dyoshikawa
dyoshikawa deleted the resolve-issue-2664-claudecode-sandbox-scope branch August 17, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants