pub trait SandboxBackend: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn capabilities(&self) -> SandboxCapabilities;
fn provision<'life0, 'async_trait>(
&'life0 self,
spec: SandboxSpec,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSession>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn attach_filesystem<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
mount: FilesystemMount,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSession>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn apply_network_policy<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
policy: NetworkPolicy,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSession>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn exec<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
request: ExecRequest,
) -> Pin<Box<dyn Future<Output = SandboxResult<ExecResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSnapshot>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn resume<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSession>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn terminate<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
) -> Pin<Box<dyn Future<Output = SandboxResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Pluggable enforcement backend. Implementations make a SandboxSpec
(the runtime lowering of a permission policy) real and run commands
under it.
Required Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Stable backend name (used in SandboxSession::backend).
Sourcefn capabilities(&self) -> SandboxCapabilities
fn capabilities(&self) -> SandboxCapabilities
What this backend can enforce.
Sourcefn provision<'life0, 'async_trait>(
&'life0 self,
spec: SandboxSpec,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSession>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn provision<'life0, 'async_trait>(
&'life0 self,
spec: SandboxSpec,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSession>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Provision a session from a spec.
Sourcefn attach_filesystem<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
mount: FilesystemMount,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSession>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn attach_filesystem<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
mount: FilesystemMount,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSession>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Attach an additional mount to a live session.
Sourcefn apply_network_policy<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
policy: NetworkPolicy,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSession>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn apply_network_policy<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
policy: NetworkPolicy,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSession>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Apply (or update) the egress policy on a live session.
Sourcefn exec<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
request: ExecRequest,
) -> Pin<Box<dyn Future<Output = SandboxResult<ExecResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exec<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
request: ExecRequest,
) -> Pin<Box<dyn Future<Output = SandboxResult<ExecResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run a command inside a session.
Sourcefn snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSnapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSnapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Snapshot a session.
Sourcefn resume<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSession>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn resume<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
) -> Pin<Box<dyn Future<Output = SandboxResult<SandboxSession>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Resume a suspended session.
Sourcefn terminate<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
) -> Pin<Box<dyn Future<Output = SandboxResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn terminate<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SandboxSessionId,
) -> Pin<Box<dyn Future<Output = SandboxResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Tear a session down.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".