claude-code - 💡(How to fix) Fix [FEATURE] sandbox.filesystem needs metadata-only (traverse-only) path grants [2 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#52940Fetched 2026-04-25 06:16:39
View on GitHub
Comments
2
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
commented ×2labeled ×2

Fix Action

Fix / Workaround

  • Problem: sandbox.filesystem.allowRead entries are recursive -- a literal path like "/Users/mikeowens" grants full read on entire subtree AND overrides denyRead entries
  • Desired behavior: metadata-only (traverse-only) grant -- allows getcwd() path traversal without exposing subtree contents
  • Use case: running sandboxed git in /git/ repos when CWD is under ~ (blocked by denyOnly: [""])
  • Workaround: none currently -- any allowRead entry broad enough to fix getcwd() exposes sensitive files
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

sandbox.filesystem needs metadata-only (traverse-only) path grants -- entries that allow getcwd() traversal without granting recursive read access to subtree contents.

  • Problem: sandbox.filesystem.allowRead entries are recursive -- a literal path like "/Users/mikeowens" grants full read on entire subtree AND overrides denyRead entries
  • Desired behavior: metadata-only (traverse-only) grant -- allows getcwd() path traversal without exposing subtree contents
  • Use case: running sandboxed git in /git/ repos when CWD is under ~ (blocked by denyOnly: [""])
  • Workaround: none currently -- any allowRead entry broad enough to fix getcwd() exposes sensitive files

Proposed Solution

add separate sandbox.filesystem.allowReadMetadata

Alternative Solutions

No response

Priority

High - voids sandboxing

Feature Category

CLI commands and flags

Use Case Example

Working in /sandbox sessions but need to run git commands.

Additional Context

No response

extent analysis

TL;DR

Implementing a separate sandbox.filesystem.allowReadMetadata configuration option is likely the most straightforward fix to achieve metadata-only path grants.

Guidance

  • Introduce a new configuration option allowReadMetadata to differentiate between read access and metadata-only access, allowing for more fine-grained control over file system permissions.
  • Update the logic for handling allowRead and denyRead entries to respect the new allowReadMetadata option, ensuring that metadata-only grants do not override deny rules.
  • Test the new configuration option with various scenarios, including the use case of running sandboxed git in ~/git/ repos, to verify that it achieves the desired behavior without exposing sensitive files.
  • Consider adding documentation to clarify the differences between allowRead and allowReadMetadata to help users understand how to use these options effectively.

Example

// Example configuration snippet
sandbox.filesystem = {
  allowReadMetadata: ["/Users/mikeowens"], // Allows traversal without exposing subtree contents
  allowRead: ["/Users/mikeowens/public"], // Allows full read access to specific subtrees
  denyRead: ["~"] // Denies read access to the home directory
}

Notes

The proposed solution assumes that the underlying file system and sandboxing mechanisms support distinguishing between metadata-only access and full read access. The implementation details may vary depending on the specific technologies and frameworks used.

Recommendation

Apply the workaround by implementing the allowReadMetadata configuration option, as it directly addresses the issue of needing metadata-only path grants without exposing sensitive 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

claude-code - 💡(How to fix) Fix [FEATURE] sandbox.filesystem needs metadata-only (traverse-only) path grants [2 comments, 2 participants]