From 33a67140155d8c2a0bfcf44099b0ccf2f1d3e7cb Mon Sep 17 00:00:00 2001 From: Aleksy Siek Date: Wed, 2 Sep 2026 13:37:05 +0100 Subject: [PATCH] fix(policy): remove blanket /Volumes read grant from system_read_macos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The system_read_macos group granted read access to the entire /Volumes mount namespace (all external drives, disk images, and network shares), described only as paths "required for executables to function." No executable or system path resolution actually needs this — unlike /System/Volumes, which stays in the list because its required to match APFS firmlink-resolved paths (see docs/cli/internals/seatbelt.mdx). This mirrors the fix already applied to the macOS runtime baseline in a9263ed3, which removed an analogous overbroad /System/Volumes grant for the same reason: it could inadvertently expose user data. The system_read_macos policy group never got the same scrutiny. Reported in discussion #1482, where an external drives contents were readable by every sandboxed process by default with no way to opt out short of a custom deny + --bypass-protection workaround. Adds a regression test asserting /Volumes is absent from system_read_macos while /System/Volumes remains present. Signed-off-by: Aleksy Siek --- crates/nono-cli/data/policy.json | 1 - crates/nono-cli/src/policy.rs | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/crates/nono-cli/data/policy.json b/crates/nono-cli/data/policy.json index 4b89b4b66..1195d0e23 100644 --- a/crates/nono-cli/data/policy.json +++ b/crates/nono-cli/data/policy.json @@ -179,7 +179,6 @@ "/Applications", "/cores", "/opt", - "/Volumes", "/run", "/nix" ] diff --git a/crates/nono-cli/src/policy.rs b/crates/nono-cli/src/policy.rs index b5b6c21f4..1227edf2a 100644 --- a/crates/nono-cli/src/policy.rs +++ b/crates/nono-cli/src/policy.rs @@ -4327,4 +4327,30 @@ mod tests { assert_eq!(result, vec![root.join("weird{name}.json")]); } + + #[test] + fn test_system_read_macos_does_not_grant_plain_volumes() { + // Regression for the overbroad grant reported in discussion #1482: + // `/Volumes` is where external drives, disk images, and network + // shares mount, and unlike `/System/Volumes` (needed only to match + // APFS firmlink-resolved paths, see docs/cli/internals/seatbelt.mdx), + // no executable needs it to function. Granting it by default handed + // every sandboxed process read access to the contents of any mounted + // volume, regardless of what the invocation actually touches. + let policy = load_embedded_policy().expect("load embedded policy"); + let group = policy + .groups + .get("system_read_macos") + .expect("system_read_macos group must exist"); + let read_paths = &group.allow.as_ref().expect("allow ops").read; + + assert!( + !read_paths.iter().any(|p| p == "/Volumes"), + "system_read_macos must not grant plain /Volumes: {read_paths:?}" + ); + assert!( + read_paths.iter().any(|p| p == "/System/Volumes"), + "system_read_macos should still grant /System/Volumes for firmlink resolution: {read_paths:?}" + ); + } }