Repository navigation
test(tui): verify the Landlock layer of pi-sandbox (plan 0.9) - #58
Merged
Merged
Conversation
Add landlock_enforcement_e2e (workspace, read-only, strict profiles; parent control; child inheritance) and record the 0.9 Landlock result and three plan/code mismatches in the plan and execution log. Co-authored-by: z123385708 <[email protected]>
Co-authored-by: z123385708 <[email protected]>
This was referenced Oct 30, 2026
Owner
Author
|
Stack #66, bottom to top: #58, #59, #56, #57, #60, #61, #62, #63, #64, #65. One atomic squash merge ( This PR is position 1 of 10. The branch is not changed (head |
This was referenced Oct 31, 2026
Merged
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.
结论
计划 0.9 里「沙箱的 Landlock 层(内核 ≥ 5.13)」在这台云 VM 上验证通过:Landlock 真的限制了文件访问。没有发现产品代码缺陷,没有改产品代码。
计划与代码有三处不一致(以代码为准,已写进计划):
return」。对deny_paths_e2e不完整:它在 Linux 上还要bwrap。这台 VM 有 Landlock 但没有bwrap:不设SANDBOX_E2E_REQUIRE_ENFORCEMENT时 101 个测试「通过」(8 个deny_paths_e2e用例各 3 到 7 ms,空转);设了以后 8 个用例 panic:bwrap unavailable。deny_paths_e2e在 Linux 上测的是bwrap,不是 Landlock。变异检查:把Sandbox::apply(&caps)换成空操作,它的 8 个用例仍全部通过。原来只有read_write_trailing_glob_e2e一个用例真的测 Landlock。pi-sandbox不在scripts/tui_baseline.toml与tui-ci.yml里,CI 从不跑它。证据(内核 6.12.94+,Ubuntu 24.04.5,x86_64)
sandbox_smoke_test的workspace/read-only/strict~/被拒(EACCES);read-only写 CWD 被拒;strict读~/被拒landlock_enforcement_e2e,REQUIRE=1Sandbox::apply空操作)bwrap,REQUIRE=1pi-sandbox,REQUIRE=1#[ignore]的子进程入口)完整输出:
/opt/cursor/artifacts/landlock-verification-evidence.txt(随本次运行上传)。命令:
改了什么
tui/crates/codegen/pi-sandbox/tests/landlock_enforcement_e2e.rs(只在 Linux 上编译;内核不支持时跳过,设SANDBOX_E2E_REQUIRE_ENFORCEMENT=1则失败;不需要bwrap)。docs/PLAN/PLAN-RUST-AGENT-RUNTIME-REMOVAL.md、执行记录 §10.27(r24)与docs/baselines/tui.md:用实测结论替换「未验证」。副作用检查
已有测试留下东西(这一轮没有改):
deny_paths_e2e在/tmp留下grok-sandbox-e2e-exact-grok-*目录,并写真实的~/.pi-python/(hooks/、hooks-paths、sandbox-blocked.*);read_write_trailing_glob_e2e留下空目录~/.cache/grok-starstar-e2e。新测试不留任何东西。没验证的
zypi --sandbox <profile>真机运行(没有构建zypi);bwrap加 Landlock 叠加时 Landlock 一半的断言。restrict_network(代码里是 seccomp,不是 Landlock TCP)。pi-sandbox加进清单或 workflow;GitHub 的ubuntu-24.04runner 是否有 Landlock、bwrap、用户命名空间,没有查。ruff check .与ruff format --check .通过。这台 VM 一开始没有
bwrap,用apt-get install bubblewrap(0.9.0)装上后才跑已有的deny_paths_e2e。