pub fn shell_sandbox_unenforceable(
policy: SandboxPolicy,
platform: &str,
tools_enabled: &[&str],
landlock_available: bool,
) -> boolExpand description
True when the requested sandbox policy cannot be enforced for shell
subprocesses: a confining policy, a platform without an OS sandbox
primitive wired up (only macOS/seatbelt is, via sandbox-exec), and at
least one shell tool ("bash" or "shell") enabled.
This is a pure function so it’s mechanically testable on any host OS:
callers pass the platform (typically std::env::consts::OS) and the set
of enabled tool names rather than relying on cfg!/target_os. It does
not itself sandbox anything — it only tells embedders/CLIs whether the
gap documented on SandboxPolicy applies right now, so they can warn.
P5-10 (§2 module 12): landlock_available is the caller’s REAL Linux
Landlock-availability probe (crate::sandbox::landlock_available(),
typically) — a PARAMETER, not an internal cfg!/probe call, same “pure,
mechanically testable” contract this function already had. Before
P5-10, platform == "linux" always meant “unenforceable” (no OS
primitive existed yet); now it means “unenforceable UNLESS Landlock is
actually available on this kernel” — a confining tier on a
Landlock-capable Linux box is REAL enforcement, not a gap, so this must
say false for it (never claim a gap that no longer exists).
platform == "macos" is unconditionally false regardless of this
parameter (seatbelt, a separate primitive, always exists there); every
other platform (including platform == "linux" with
landlock_available == false) is unaffected by this parameter and
keeps the pre-P5-10 “no primitive” answer.