fix(sandbox): Landlock + relative-token block for workspace FS escapes - #74
Draft
cursor[bot] wants to merge 2 commits into
Draft
fix(sandbox): Landlock + relative-token block for workspace FS escapes#74cursor[bot] wants to merge 2 commits into
cursor[bot] wants to merge 2 commits into
Conversation
…kens Allowlist only flagged tokens starting with / ~ ., so relative symlink indirection (python os.sep symlink + cat leak) and interpreter path obfuscation bypassed workspace_only. Namespaces alone do not hide the host FS. Apply Landlock to the configured workspace in sandbox_exec and resolve bare relative tokens against the workspace in the allowlist. Co-authored-by: esadrianno <esadrianno@gmail.com>
Passing REFER/TRUNCATE in handled_access_fs makes create_ruleset fail on ABI 1, skipping the whole FS policy. Probe the ABI, mask unknown bits, and pass the ABI-1 attr size to avoid E2BIG. Co-authored-by: esadrianno <esadrianno@gmail.com>
This was referenced Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CRITICAL workspace escape that survived open PRs #66/#68:
With
sandbox.enabled+workspace_only,has_path_charsonly flags tokens starting with/~.. Concrete trigger on main:python3 -c 'import os; os.symlink(os.path.join(os.sep,"etc","passwd"),"leak")'→ allowlist allow (no absolute/fragment; survives fix(sandbox,gateway): shell allowlist quoted-path bypass + bind to configured host #68 embedded-path scan)cat leak→ allowlist allow (bare relative name)unshare(CLONE_NEWNS)alone does not hide the host FS, so the shell tool could read host secrets.Fix
sandbox_exec: whenworkspace_pathis set, apply a Linux Landlock ruleset (workspace RW + minimal RO system paths for/bin/sh/ interpreters). Blocks symlink andchr(47)/os.sepindirection at execution time.allowlist_check_shell_command: resolve bare relative tokens against the workspace and reject whenrealpathescapes (defense-in-depth forcat leak).Test plan
tests/test_allowlist—test_relative_symlink_indirectiontests/test_sandbox— Landlock symlink + obfuscated python/etc/passwdread blockedcat leakblocked by allowlist; sandbox output has noroot:x: