sandbox: workspace confinement accepts /, $HOME, and symlink aliases of $HOME
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Start with sandbox/box_linux.go at line 63 and sandbox/linux.go around lines 236–245, then read the existing workspace validation and workspaceRules code. Add tests for /, the home directory, and a symlink alias of home; run the relevant Go tests. Done means those roots are rejected and the symlink comparison is covered by tests.
Written by the indexing model from the issue text.
Description
Problem
Three related confinement gaps across packages/sandbox:
box_linux.go:63— the workspace-path validation accepts/and the literal value of$HOMEas valid workspace roots, rather than rejecting roots that are (or resolve to) the filesystem root or the user's home directory.linux.go:245— the check that compares a candidate path against the home directory does a plain string comparison, so a symlink that points at the home directory but has a different literal path string bypasses the comparison.linux.go:236—workspaceRuleshas no test coverage, so regressions in this confinement logic would not be caught by CI.
Impact
An agent configured (or tricked) into using / or $HOME as its workspace root effectively runs unconfined against the whole filesystem or the user's full home directory, defeating the purpose of workspace sandboxing. The symlink gap means even a correct literal-path check can be routed around by aliasing the home directory through a symlink elsewhere in the filesystem.
Repro
- Configure the sandbox workspace root to
/(or to the exact value of$HOME) and observe the validation accepts it instead of rejecting an unreasonably broad root. - Create a symlink elsewhere that points at the home directory, configure that symlink path as the workspace root, and observe the home-directory comparison does not catch it because the literal path differs.
Suggested fix
In box_linux.go, explicitly reject workspace roots that resolve (after filepath.EvalSymlinks and filepath.Clean) to / or to the current user's home directory, rather than relying on literal string matches. In linux.go:245, resolve both the candidate path and the home directory with filepath.EvalSymlinks before comparing, so symlink aliases are caught. Add unit tests for workspaceRules covering the root, home-directory, and symlink-alias cases.
- Dominant language
- Go
- Stars
- 157
- Forks
- 19
- Avg merge
- 4h 43m
- Merged PRs (30d)
- 68
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from solongate/agent-security
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
solongate/agent-security#154 ·
Maintainers usually reply within 1 day
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
solongate/agent-security#153 ·
Maintainers usually reply within 1 day
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
solongate/agent-security#148 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
solongate/agent-security#147 ·
Maintainers usually reply within 1 day
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
solongate/agent-security#143 ·
Maintainers usually reply within 1 day
All issues in solongate/agent-security
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area/frontend/library-panels automated-triage type/bug type/ux
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug raised-by:verifier
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
medici-finance/assay#4554 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
microsoft/azure-linux-image-tools#954 ·
Maintainers usually reply within 1 day
-
help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day