1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2024 Logan Magee
//
// SPDX-License-Identifier: MPL-2.0
//! Sandboxing utilities for Ina operations.
//!
//! This module contains functions to enable platform-specific sandboxing that is guaranteed to be
//! compatible with Ina's operations. They are abstract over the platform targeted, enabling
//! appropriate sandboxing on platforms with supported sandboxing methods on a best-effort basis,
//! so it's recommended to call the respective sandboxing functions on all targets whenever
//! possible to automatically take advantage of additional platform sandbox support.
//!
//! The methods are separated by the operation being performed since patching and diffing may use
//! different platform capabilities.
//!
//! # Examples
//!
//! ```no_run
//! use std::fs::File;
//! use ina::sandbox;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Perform setup for patching before enabling the sandbox
//! let old = File::open("app-v1.exe")?;
//! let patch = File::open("app-v1-to-v2.ina")?;
//! let mut new = File::create("app-v2.exe")?;
//!
//! // Enable the platform's sandbox for patching
//! sandbox::enable_for_patching()?;
//!
//! // Patch the blob
//! ina::patch(old, patch, &mut new)?;
//! # Ok(())
//! # }
//! ```
pub use seccompiler;
pub use SandboxError;
pub use enable as enable_for_patching;