#21665: fix(sandbox): add /home and /Users to bind-mount denylist
agents
size: XS
Cluster:
Sandbox Path Management Fixes
## Summary
- Add `/home` and `/Users` to the `BLOCKED_HOST_PATHS` array in `validate-sandbox-security.ts` so that user home directories containing SSH keys and cloud credentials cannot be bind-mounted into sandbox containers.
- Update the error message to suggest `/srv` or `/opt` paths instead of `/home` paths.
- Update existing tests that expected `/home` mounts to succeed, and add new test cases verifying that `/home` and `/Users` mounts are blocked.
## Test plan
- [x] Existing test suite passes (21 tests)
- [x] New tests verify `/home` and `/Users` bind mounts are rejected with correct error messages
- [x] Formatter and linter pass with no warnings
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added `/home` and `/Users` to the bind-mount denylist to prevent SSH keys and cloud credentials from being exposed in sandbox containers. Updated error messages to suggest `/srv` or `/opt` paths instead of `/home`. Test suite updated to verify the new blocks work correctly.
**Critical Issue**: Multiple documentation files contain examples using `/home/user/*` paths that will now be rejected by this security change:
- `docs/gateway/sandboxing.md` (lines 70, 87)
- `docs/help/faq.md` (line 1197)
- `docs/gateway/configuration-reference.md` (line 896)
- `docs/channels/groups.md` (line 108)
- `docs/install/docker.md` (lines 125, 156)
These docs need updating to use `/srv` or `/opt` examples instead, or users following the documentation will encounter validation errors.
<h3>Confidence Score: 3/5</h3>
- Safe implementation but incomplete - documentation updates are missing
- The code changes are well-implemented with proper tests and clear security benefits. However, the PR introduces a breaking change that invalidates examples in at least 8 documentation files across the repository. Users following current docs will encounter validation errors. Score would be 5 if documentation was updated to match the new path restrictions.
- Documentation files outside this PR need updating to replace `/home/*` examples with `/srv/*` or `/opt/*` paths
<sub>Last reviewed commit: 77d2e92</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#16509: Fix sandbox path validation rejecting Docker bind mount paths
by Clawborn · 2026-02-14
84.2%
#3907: fix(sandbox): use absolute /bin/sh path + add allowedReadPaths config
by pvoo · 2026-01-29
79.8%
#8186: fix(sandbox): validate setupCommand to prevent shell injection
by yubrew · 2026-02-03
79.7%
#11820: fix(sandbox): remap container paths in sandboxed file tools
by steflsd · 2026-02-08
79.4%
#17402: fix:sandbox path issue
by luckylhb90 · 2026-02-15
79.2%
#16922: fix: remove incorrect sandbox file tool guidance
by carrotRakko · 2026-02-15
77.9%
#16929: fix(security): block access to sensitive directories from within sa...
by CornBrother0x · 2026-02-15
77.7%
#8161: fix(sandbox): block dangerous environment variables from Docker con...
by yubrew · 2026-02-03
77.1%
#17944: fix(security): fail-closed for local media paths without sandboxRoot
by Operative-001 · 2026-02-16
77.1%
#4226: Fix/sandbox containerworkdir rw access
by ozgur-polat · 2026-01-29
76.6%