Conversation
Greptile SummaryImplements Linux-native build jail enforcement using Landlock filesystem write restrictions (ABI v2, kernel ≥ 5.19) and a seccomp network filter that blocks Confidence Score: 5/5Safe to merge; all previously flagged P1s are resolved and the remaining finding is a minor documentation gap about seccomp coverage scope. The three P1s from prior review rounds (PR_SET_NO_NEW_PRIVS placement, ABI V3 vs V2, /tmp write access) are all addressed. The only new finding is a P2 about connect/send syscalls being unfiltered — exploitable only via inherited non-O_CLOEXEC socket FDs, which Tokio's O_CLOEXEC discipline makes highly unlikely. P2-only result leaves confidence at 5. crates/aube-scripts/src/linux_jail.rs — the seccomp filter scope note; no blocking issue. Important Files Changed
Reviews (3): Last reviewed commit: "fix(scripts): harden linux build jail pe..." | Re-trigger Greptile |
| pub fn apply_landlock(jail: &ScriptJail, home: &Path) -> Result<(), String> { | ||
| let abi = ABI::V3; | ||
| let read_access = AccessFs::from_read(abi); | ||
| let full_access = read_access | AccessFs::from_write(abi); | ||
| let mut ruleset = Ruleset::default() | ||
| .set_compatibility(CompatLevel::HardRequirement) | ||
| .handle_access(full_access) | ||
| .map_err(|e| format!("failed to create jail ruleset: {e}"))? | ||
| .create() | ||
| .map_err(|e| format!("failed to create jail ruleset: {e}"))?; |
There was a problem hiding this comment.
Landlock ABI::V3 requires kernel ≥ 6.2, blocking common LTS distros
ABI::V3 was introduced in Linux 6.2 (it added LANDLOCK_ACCESS_FS_TRUNCATE). Combined with CompatLevel::HardRequirement, any kernel between 5.13 and 6.1 will fail the handle_access call, causing all jailed builds to fail-close. This covers widely deployed distributions: Ubuntu 22.04 LTS ships kernel 5.15, Debian 12 ("Bookworm") ships 6.1, RHEL/Rocky/AlmaLinux 9 ship 5.14. Users on those systems who enable jailBuilds: true will see a hard error even though Landlock is fully available and capable of enforcing the meaningful access controls (V1/V2 rights cover almost all of the policy). At minimum the required kernel version (≥ 6.2) should be documented in jailed-builds.md; optionally consider downgrading to ABI::V2 (kernel ≥ 5.19) which is sufficient for the write-restriction goal and covers more of the installed base.
0c83150 to
751729b
Compare
- set PR_SET_NO_NEW_PRIVS before landlock restrict_self() and on every code path so a setuid exec cannot escape, including network: true - add std::env::temp_dir() to the writable allowlist for parity with the macOS Seatbelt /tmp + /private/tmp rules - target Landlock ABI v2 (kernel >= 5.19) so Ubuntu 22.04, Debian 12, RHEL 9 stop fail-closing; v3 only added LANDLOCK_ACCESS_FS_TRUNCATE Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
network: trueas the package-level escape hatch and fail closed when the Linux jail cannot be fully enforcedValidation
cargo check -p aube-scriptscargo test -p aube-scriptscargo test -p aube-settings meta::tests::workspace_yaml_keys_deserialize_onto_workspace_configcargo build -p aubemise run test:bats test/allow_builds.batscargo fmt --checkcargo clippy --all-targets -- -D warningsgit diff --checkAUBE_ENABLE_GLOBAL_VIRTUAL_STORE=false mise run docs:buildNote: plain
mise run docs:buildfailed before VitePress because docs install hit the existing global virtual store missing-index path for@algolia/abtesting@1.16.2; rerunning with the documented per-project install override passed.Note
Medium Risk
Adds Linux-native sandboxing for dependency lifecycle scripts using
landlockand seccomp, which is security-sensitive and could break builds on kernels/architectures that can’t fully enforce the policy.Overview
Adds Linux-native enforcement for
jailBuildsby applying Landlock filesystem rules and a seccomp network filter in the child process viapre_exec, so the parentaubeprocess stays unrestricted and scripts fail closed if the jail can’t be fully enforced.Updates the jailed-build environment to point
TMPDIR/TMP/TEMPat the temporary jail home, wires in new Linux-only deps (landlock,seccompiler,libc), and refreshes docs/settings/tests to treat native jail enforcement as supported on macOS and Linux (including BATS coverage for write/network denial and permission grants).Reviewed by Cursor Bugbot for commit cd29edf. Bugbot is set up for automated code reviews on this repo. Configure here.