fix(interface): refuse container-runtime dirs and docker.sock mounts - #1059
fix(interface): refuse container-runtime dirs and docker.sock mounts#1059SashaMIT wants to merge 1 commit into
Conversation
check_mountable_dir already blocks system trees and .docker credential dirs, but still admitted /var/run and directories that hold docker.sock. Those bind-mount writable into the sandbox and expose the host container runtime API. Expand the denylist and refuse runtime socket children. Fixes usestrix#1058.
Greptile SummaryThis PR strengthens local-target admission to reject container-runtime directories and directories containing recognized runtime socket names.
Confidence Score: 3/5This PR should not merge until directory-inspection failures reject the mount rather than allowing a potentially privileged runtime socket into the sandbox. The new socket guard silently accepts directories when enumeration raises OSError, after which the accepted source is mounted writable into the sandbox. Files Needing Attention: strix/interface/utils.py
|
| Filename | Overview |
|---|---|
| strix/interface/utils.py | Adds container-runtime path and socket admission checks, but enumeration errors bypass the new socket protection. |
| tests/test_local_sources.py | Covers forbidden runtime trees and readable direct-child socket files, but not the fail-open enumeration-error path. |
Prompt To Fix All With AI
### Issue 1
strix/interface/utils.py:1444-1445
**Socket inspection fails open**
If a target directory outside the forbidden trees contains a runtime socket but directory enumeration raises `OSError`, this branch treats the failed inspection as if no socket exists. The accepted directory is then mounted writable into the sandbox, exposing the host container-runtime API. **How this was verified:** The enumeration error is converted to `socket_child = None`, while accepted local sources become writable bind mounts.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(interface): refuse container-runtime..." | Re-trigger Greptile
| None, | ||
| ) |
There was a problem hiding this comment.
If a target directory outside the forbidden trees contains a runtime socket but directory enumeration raises OSError, this branch treats the failed inspection as if no socket exists. The accepted directory is then mounted writable into the sandbox, exposing the host container-runtime API. How this was verified: The enumeration error is converted to socket_child = None, while accepted local sources become writable bind mounts.
Knowledge Base Used: CLI and Runner: from strix invocation to a running scan
Prompt To Fix With AI
This is a comment left during a code review.
Path: strix/interface/utils.py
Line: 1444-1445
Comment:
**Socket inspection fails open**
If a target directory outside the forbidden trees contains a runtime socket but directory enumeration raises `OSError`, this branch treats the failed inspection as if no socket exists. The accepted directory is then mounted writable into the sandbox, exposing the host container-runtime API. **How this was verified:** The enumeration error is converted to `socket_child = None`, while accepted local sources become writable bind mounts.
**Knowledge Base Used:** [CLI and Runner: from `strix` invocation to a running scan](https://app.greptile.com/strix-org-3/-/custom-context/knowledge-base/usestrix/strix/-/docs/cli-and-runner.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary
Fixes #1058.
check_mountable_diralready refuses system trees and credential directory names (including.docker), but still admitted:/run,/var/run, and Darwin/private/var/run(/varis exact-root only)/var/lib/{docker,containers,containerd}docker.sock/podman.sock/containerd.sock/crio.sockThose paths are bind-mounted writable into the sandbox. Mounting a host Docker/Podman API socket is classic host control from inside the sandbox.
Attacker model
An operator (or poisoned target list) points
--targetat/var/runor a directory that containsdocker.sock. The sandbox already has shell and elevated network caps, so the socket becomes host Docker API access.Threat-model note
This tightens an admission control the product already claims to enforce for system mounts. Distinct from #1054 / #1055 (workspace mounts skipping admission).
Test plan
test_check_mountable_dir_rejects_var_runtest_check_mountable_dir_rejects_runtime_socket_dirtests/test_local_sources.pygreen locally (28 passed)Made with Cursor