Skip to content

Conversation

@ddworken
Copy link
Collaborator

@ddworken ddworken commented Jan 6, 2026

Summary

Adds defense-in-depth for sandbox deny path handling. Previously, non-existent paths in the deny list were skipped since bwrap cannot ro-bind a file that doesn't exist. This change mounts /dev/null at the first non-existent path component, preventing the path from being created.

Changes

  • Add findFirstNonExistentComponent helper to find the appropriate mount point
  • Mount /dev/null read-only at the first missing component to block path creation
  • Add tests for non-existent deny path protection

Test plan

  • Build passes
  • Unit tests pass
  • Linux integration tests (CI)

🤖 Generated with Claude Code

ddworken and others added 3 commits January 6, 2026 14:31
Previously, non-existent paths in the deny list were skipped since
bwrap cannot ro-bind a file that doesn't exist. This change adds
defense-in-depth by mounting /dev/null at the first non-existent
path component, which prevents creation of the denied path.

- Add findFirstNonExistentComponent helper to locate mount point
- Mount /dev/null at first missing component to block path creation
- Add tests for non-existent deny path protection

Bump version to 0.0.24

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Detect symlinks in protected paths and mount /dev/null over them
to prevent attackers from deleting the symlink and creating a real
directory with malicious content.

If any component of a protected path is a symlink within an allowed
write path, mount /dev/null there to block deletion.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add enableWeakerNestedSandbox: true for non-existent deny path tests
- Update assertions to check for empty content instead of non-existence
  (bwrap creates empty mount point files when setting up /dev/null binds)
@ddworken ddworken marked this pull request as ready for review January 7, 2026 01:00
Copy link
Collaborator

@ollie-anthropic ollie-anthropic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice thank you!

@ddworken ddworken merged commit e468387 into main Jan 7, 2026
8 checks passed
@caspark
Copy link

caspark commented Jan 11, 2026

This PR seems to have caused a bunch of misc dotfiles to be created after any bash tool use in a /sandboxed claude code, which is extremely annoying (since they persist after the bash tool use and after exiting claude code).

See #85 and #86 for possible fix.

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.

4 participants