base/interface/exec/in_process/sandbox.rs
1//! A sandbox that admits it is not one.
2
3use crate::interface::exec::{
4 Confined, Enforcement, ProcessSpec, Sandbox, SandboxMode, SandboxPolicy,
5};
6
7/// Constrains nothing, and says so.
8///
9/// The honest backend for a provider that does not run real processes: there
10/// is nothing to confine. Reporting `None` rather than `Full` is what keeps
11/// `require_enforcement` meaningful — a deployment that demands an absolute
12/// boundary must not get one from a provider that has no way to impose it.
13pub struct NoSandbox;
14
15impl Sandbox for NoSandbox {
16 fn confine(&self, spec: ProcessSpec, _policy: &SandboxPolicy) -> Confined {
17 Confined {
18 spec,
19 mode: SandboxMode::Unavailable,
20 enforcement: Enforcement::None,
21 unmet: vec!["this provider does not run processes it could confine".into()],
22 }
23 }
24}