Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
211fd0e
test(native_jail): cover explicit disk limit refusal on linux
senamakel Oct 19, 2026
2487a3c
feat(jail): add contract 2.1 native jail resource request types
senamakel Oct 19, 2026
0d2613d
feat(tinybox-bus): add resource-aware native jail contract members
senamakel Oct 19, 2026
a37c209
test(tinybox-bus): update contract version assertions to 2.1
senamakel Oct 19, 2026
b52091a
test(jail): cover native jail 2.1 resource round trip
senamakel Oct 19, 2026
f6f5c3d
feat(tinybox-bus): add helper to detect native jail resource support
senamakel Oct 19, 2026
4fc1201
fix(sandbox): preserve fractional CPU quota in systemd property
senamakel Oct 19, 2026
91d84de
feat(sandbox): add native jail command builder
senamakel Oct 19, 2026
33d240e
feat(tinybox-linux): export native jail command and argv helper
senamakel Oct 19, 2026
b6a37ed
style: apply rustfmt formatting across tinybox crates
senamakel Oct 19, 2026
1673f68
fix(sandbox): handle canonicalize errors when validating jail root
senamakel Oct 19, 2026
16f9fd7
test(sandbox): reformat native jail command test
senamakel Oct 19, 2026
fed50ae
feat(jail): add native resource request field
senamakel Oct 19, 2026
f34fc28
fix(tinybox-jail): validate native resource limits in jail backend
senamakel Oct 19, 2026
8c4f3f0
fix(tinybox-jail): report unsupported constraints for empty native re…
senamakel Oct 19, 2026
0220f4e
test: cover native resource subset constraint selection
senamakel Oct 19, 2026
2021b27
feat(sandbox): support resource-limited native jail subset requests
senamakel Oct 19, 2026
18e39b2
feat(tinybus_module): add jailed exec with resources
senamakel Oct 19, 2026
dee4170
feat(tinybus): add resource-aware native jail collector
senamakel Oct 19, 2026
61cd1cd
feat(tinybus): expose StartJailedExecWithResources member
senamakel Oct 19, 2026
376f4ca
test(tinybus_module): qualify Error path in native jail test
senamakel Oct 19, 2026
9bffdf0
fix(sandbox): harden native jail path validation and network isolation
senamakel Oct 19, 2026
393aad0
Merge remote-tracking branch 'origin/main' into tinybox-native-limits
senamakel Oct 19, 2026
afea900
Merge remote-tracking branch 'origin/pr-102' into tinybox-native-limits
senamakel Oct 19, 2026
4771b80
feat(native_jail): support contract 2.1 resource requests
senamakel Oct 19, 2026
72a635f
style: format native jail sources with rustfmt
senamakel Oct 19, 2026
2623fd8
chore(sandbox): remove duplicate PathBuf import
senamakel Oct 19, 2026
4b8cc5d
refactor(tinybus_module): simplify jail spawn argument handling
senamakel Oct 19, 2026
14463e4
test(native_jail): drop stale address family property from expected args
senamakel Oct 19, 2026
1a1ce7c
test(native_jail): verify cgroup limits on jailed launcher
senamakel Oct 19, 2026
756782f
test(tinybox-module): locate launcher cgroup by walking the user slice
senamakel Oct 19, 2026
9d26387
test(tinybus_module): add diagnostic to cgroup memory limit assertion
senamakel Oct 19, 2026
828f8da
test(native_jail): log parent and launcher pids in namespace jail test
senamakel Oct 19, 2026
f678592
test(tinybus_module): check cgroup.procs after visiting subdirectories
senamakel Oct 19, 2026
5243096
test(native_jail): remove debug pid logging from jail test
senamakel Oct 19, 2026
a722446
test(native_jail): drop cgroup resource assertions from namespace jai…
senamakel Oct 19, 2026
d537f17
feat(sandbox): give native jail scopes unique unit names
senamakel Oct 19, 2026
55f9f8d
test(sandbox): verify native jail cgroup limits via transient scope
senamakel Oct 19, 2026
65f9384
test(native-jail): cover memory overrun and pids exhaustion
senamakel Oct 19, 2026
6dc6a2d
test(tinybox-module): reformat native jail test source
senamakel Oct 19, 2026
b240eec
test(tinybox-module): synchronize jail fixture on readiness and pids …
senamakel Oct 19, 2026
b12133f
test(tinybox-module): make jail test child binding mutable
senamakel Oct 19, 2026
97c35b2
test(native_jail): correct CPU quota expectations in resource-aware j…
senamakel Oct 19, 2026
e3e1682
test(native_jail): verify memory limit via cgroup oom_kill counter
senamakel Oct 19, 2026
b434ecb
test(native_jail): cover fractional CPU throttling in a live scope
senamakel Oct 19, 2026
ea7bd1b
style(tinybox-module): reformat native jail tests to rustfmt layout
senamakel Oct 19, 2026
b58c7a3
test(tinybox-module): verify jailed process cannot reach manager socket
senamakel Oct 19, 2026
c7fbb5b
test(native_jail): import FileTypeExt for unix file type checks
senamakel Oct 19, 2026
c1f94b7
build(deps): add linux-only libc dependency
senamakel Oct 19, 2026
127ac43
test(native_jail): verify inherited manager fd is closed before exec
senamakel Oct 19, 2026
0d27207
fix(tinybox-module): escape braces in native jail test script
senamakel Oct 19, 2026
e6e5fe9
test(tinybox-module): report launcher output on probe failure
senamakel Oct 19, 2026
a2c44b1
fix(sandbox): close inherited file descriptors in scope launcher
senamakel Oct 19, 2026
4cf55ce
test(native-jail): cover double-forked setsid descendant cleanup
senamakel Oct 19, 2026
456abcb
fix(sandbox): stop the transient systemd unit after the jailed comman…
senamakel Oct 19, 2026
335036e
fix(sandbox): harden native jail launcher fd cleanup
senamakel Oct 19, 2026
55bb5c7
test(native_jail): remove unused import and fix formatting
senamakel Oct 19, 2026
163da46
test(native_jail): verify descendant exit by pid namespace identity
senamakel Oct 19, 2026
86f49d9
test(native_jail): use closure instead of Result::ok in proc scan
senamakel Oct 19, 2026
1670c5b
test(native_jail): wait for non-empty pid file in double-fork test
senamakel Oct 19, 2026
63b7631
fix(sandbox): surface systemd stop failures in native jail
senamakel Oct 19, 2026
0724ada
fix(sandbox): tolerate already-stopped unit after native jail exit
senamakel Oct 19, 2026
69bac4e
test(native_jail): cover cancellation of detached descendants
senamakel Oct 19, 2026
f1cd51c
test(tinybox-module): include journal chunks in native exec assertion
senamakel Oct 19, 2026
0e2cecc
test(native_jail): relax stream readiness assertions to prefix match
senamakel Oct 19, 2026
6ab5a82
test(native_jail): drop redundant cancellation state assertion
senamakel Oct 19, 2026
3a70ba3
test(native_jail): add runtime availability probe for native resource…
senamakel Oct 19, 2026
3e0deaf
test(native_jail): skip runtime tests when namespaces unavailable
senamakel Oct 19, 2026
3062f41
test(tinybox-module): add lib symlinks to native jail probe
senamakel Oct 19, 2026
61ff6d0
test(native_jail): extract pid namespace lookup into a helper
senamakel Oct 19, 2026
e4c9388
test(tinybus_module): extract pid namespace lookup helper in native j…
senamakel Oct 19, 2026
23ac630
refactor(jail): remove native_resources field and its constraint logic
senamakel Oct 19, 2026
fac87dc
fix(native_jail): validate resource limits at request time
senamakel Oct 19, 2026
dc5776e
test(tinybox-module): assert cgroup path is present before reading me…
senamakel Oct 19, 2026
6c5b813
fix(tinybus_module): accept SIGKILL status in native memory limit test
senamakel Oct 19, 2026
67e8622
test(tinybus_module): include unit and status in cgroup assertion
senamakel Oct 19, 2026
1b18fd0
fix(sandbox): keep scope alive after OOM kill
senamakel Oct 19, 2026
bba4e13
test(native_jail): gate descendant check on fixture readiness
senamakel Oct 19, 2026
9995a5e
test(native_jail): add missing pid file argument to scope exit test
senamakel Oct 19, 2026
f22114c
test(tinybus-module): cover bus exec cancellation and descendant reaping
senamakel Oct 19, 2026
89d16b8
test(tinybus_module): fix cwd type in cancellation test
senamakel Oct 19, 2026
c431fd0
test(tinybox-module): cover descendant reaping on resource destroy
senamakel Oct 19, 2026
d920cc1
style(tinybus_module): reformat native jail tests and resource stream…
senamakel Oct 19, 2026
2ab9460
docs(sandbox): document errors and lint rationale for native_jail_argv
senamakel Oct 19, 2026
2ee1a93
refactor(tinybus-module): simplify argument mapping and error handling
senamakel Oct 19, 2026
d1b42f3
test(tinybus): annotate long lifecycle tests and clarify variable names
senamakel Oct 19, 2026
ac4918f
test(tinybus): wrap long assertion arguments for readability
senamakel Oct 19, 2026
5603d82
docs(tinybox-module): correct comment on descriptor closing
senamakel Oct 19, 2026
72f5de6
test(native_jail): extract process disappearance check into helper
senamakel Oct 19, 2026
fbe242a
refactor(sandbox): split native jail argv construction into helpers
senamakel Oct 19, 2026
b908a04
chore(test): remove stale clippy allow attribute
senamakel Oct 19, 2026
c10a92b
chore(tests): remove stale clippy allow attributes
senamakel Oct 19, 2026
cd4467b
refactor(sandbox): drop infallible result from native bwrap argv
senamakel Oct 19, 2026
65be24c
test(native_jail): fix swapped time imports in native jail tests
senamakel Oct 19, 2026
b2c0575
test(native_jail): extract active scope cgroup lookup into helper
senamakel Oct 19, 2026
2a8d27d
style(tinybox-module): collapse multi-line expressions in native jail…
senamakel Oct 19, 2026
c8227a1
test(tinybox-bus): expect START_JAILED_EXEC_WITH_RESOURCES in method …
senamakel Oct 19, 2026
cbc40d8
test(sandbox): swap expected argv prefixes in two assertions
senamakel Oct 19, 2026
135b539
ci: add native resource live test job
senamakel Oct 19, 2026
6a8de02
ci: pin actions to SHAs and use systemd user session for tests
senamakel Oct 19, 2026
11e6ddc
test(native_jail): cover single validated launcher plan
senamakel Oct 19, 2026
667ee47
refactor(native_jail_tests): extract resource escape helpers
senamakel Oct 19, 2026
afb2915
test(tinybus_module): extract native jail and stream test fixtures
senamakel Oct 19, 2026
4b5288b
test(tinybus_module): reformat native resource tests
senamakel Oct 19, 2026
cec2ac9
test(native_jail): consolidate MetadataExt import into fixture
senamakel Oct 19, 2026
01fd230
Merge remote-tracking branch 'origin/main' into tinybox-native-limits
senamakel Oct 19, 2026
5f86101
test(sandbox): gate native jail command test to linux
senamakel Oct 19, 2026
d5dfc72
test(native_jail): cover non-Linux resource request refusal
senamakel Oct 19, 2026
51fd6cf
test(sandbox): cover invalid native jail requests
senamakel Oct 19, 2026
5b54840
feat(sandbox): resolve native jail launchers from trusted paths
senamakel Oct 19, 2026
777d4a7
fix(tinybox-module): resolve jail programs through trusted paths
senamakel Oct 19, 2026
e267356
Merge branch 'tinybox-p5-v2' of /home/enamakel/work/openhuman/worktre…
senamakel Oct 19, 2026
32cfa9e
test(sandbox): assert systemd and bubblewrap commands are absolute
senamakel Oct 19, 2026
82f9a52
test(bwrap): cover deny-read for paths created after sandbox start
senamakel Oct 19, 2026
c6b3cbb
fix(bwrap): mask missing deny_read paths prospectively
senamakel Oct 19, 2026
b95bfaf
test(bwrap): assert jail reserves denied mountpoint
senamakel Oct 19, 2026
910f69a
fix(native_jail): gate linux launcher checks behind cfg
senamakel Oct 19, 2026
b7c966a
refactor(sandbox): extract resource launcher setup into a helper
senamakel Oct 19, 2026
3024f01
docs(sandbox): document trusted_systemd_run_program errors
senamakel Oct 19, 2026
2eacf27
test(sandbox): assert trusted systemd-run path in jail argv
senamakel Oct 19, 2026
f13ae3c
test: cover refusal of missing deny_read paths
senamakel Oct 19, 2026
59a56ea
fix(bwrap): reject missing deny_read paths instead of pre-creating them
senamakel Oct 19, 2026
271cf59
test(bwrap_isolation): fix command mutability in isolation tests
senamakel Oct 19, 2026
74f594e
docs(bwrap): document NotFound for missing deny_read targets
senamakel Oct 19, 2026
bb864e8
test(bwrap-isolation): wrap long assertion to satisfy formatting
senamakel Oct 19, 2026
6002d04
test(bwrap_isolation): avoid panicking on unexpected spawn success
senamakel Oct 19, 2026
0d3a356
fix(sandbox): gate trusted program validation on unix
senamakel Oct 19, 2026
ba620c6
test(sandbox): gate tests to linux and use injectable launcher paths
senamakel Oct 21, 2026
2a6e1bb
test(tinybox-linux): make launcher tests portable
senamakel Oct 21, 2026
7e4f8b8
chore: files changed .github/workflows/ci.yml,crates/tinybox-linux/sr…
senamakel Oct 21, 2026
de0aa68
chore: files changed Cargo.lock
senamakel Oct 21, 2026
cfce17e
chore: files changed crates/tinybox-module/tests/grants_manifest_e2e.rs
senamakel Oct 21, 2026
03ea4c3
chore: files changed crates/tinybox-module/tests/grants_manifest_e2e.rs
senamakel Oct 21, 2026
bc79024
chore: files changed crates/tinybox-module/tests/grants_manifest_e2e.rs
senamakel Oct 21, 2026
d5d8aed
chore: files changed crates/tinybox-module/tests/grants_manifest_e2e.rs
senamakel Oct 21, 2026
c07cd4f
Merge remote-tracking branch 'origin/main' into tinybox-native-limits
senamakel Oct 21, 2026
fe41ee4
Merge remote-tracking branch 'origin/main' into tinybox-native-limits
senamakel Oct 22, 2026
873f978
Merge remote-tracking branch 'origin/pr-103' into 7328-storage-approv…
senamakel Oct 22, 2026
586e883
test(tinybox): provide storage for native cancellation proof
senamakel Oct 22, 2026
5110ce7
test(tinybox): run storage-backed proof on multithread runtime
senamakel Oct 22, 2026
c4a2ebf
Merge upstream main into native jail limits
senamakel Oct 22, 2026
3c3490c
Merge remote-tracking branch 'origin/main' into tinybox-103-conflicts
senamakel Oct 22, 2026
97e82cf
Merge remote-tracking branch 'origin/main' into tinybox-103-conflicts
senamakel Oct 22, 2026
98b541c
Merge remote-tracking branch 'origin/main' into tinybox-native-limits
senamakel Oct 23, 2026
d344acd
Merge branch 'main' into tinybox-native-limits
senamakel Oct 23, 2026
347a498
Merge remote-tracking branch 'origin/main' into tinybox-native-limits
senamakel Oct 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,27 @@ jobs:
coverage-script: scripts/check-coverage.sh
module-e2e-script: scripts/test-e2e.sh
feature-test-script: scripts/test-features.sh
apt-packages: bubblewrap
native-resource-live:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249
- name: Install rootless native jail prerequisites
run: |
source scripts/ci/prepare-rootless-native-resources.sh
- name: Run required Linux native resource proofs
shell: bash
run: |
set -euo pipefail
uid="$(id -u)"
runtime_dir="/run/user/${uid}"
export XDG_RUNTIME_DIR="$runtime_dir"
export DBUS_SESSION_BUS_ADDRESS="unix:path=$runtime_dir/bus"
TINYBOX_REQUIRE_NATIVE_RESOURCE_TESTS=1 cargo test -j1 -p tinybox-module native_
TINYBOX_REQUIRE_NATIVE_RESOURCE_TESTS=1 cargo test -j1 -p tinybox-module resource_aware_bus_exec_cancellation_reports_events_and_reaps_descendants
docker-network-live:
name: Docker Egress and denied network connectivity
runs-on: ubuntu-22.04
Expand Down
30 changes: 30 additions & 0 deletions crates/tinybox-bus/src/jail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,36 @@ pub struct NativeJailConfig {
pub resources: Option<crate::ResourceLimits>,
}

/// Hard resource limits requested by the contract 2.1 native jail members.
/// Each dimension is independently optional so a backend can enforce a real
/// supported subset without weakening a requested limit. Disk is represented
/// explicitly so implementations must refuse it when they cannot enforce it.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub struct NativeJailResourceRequest {
/// CPU budget in thousandths of one CPU (for example, 1 is 0.1%).
#[serde(default, skip_serializing_if = "Option::is_none")]
pub cpu_millis: Option<u64>,
/// Maximum resident memory in bytes.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub memory_bytes: Option<u64>,
/// Maximum number of processes and threads.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub pids_max: Option<u64>,
/// Maximum writable disk bytes. Backends without a hard disk quota refuse.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub disk_bytes: Option<u64>,
}

/// Source-compatible extension of [`NativeJailConfig`] for contract 2.1.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct NativeJailRequest {
/// Existing filesystem, network and process jail configuration.
pub jail: NativeJailConfig,
/// Additional hard resource dimensions; any explicit unsupported one fails closed.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub resources: Option<NativeJailResourceRequest>,
}

#[cfg(test)]
#[path = "jail_tests.rs"]
mod tests;
34 changes: 34 additions & 0 deletions crates/tinybox-bus/src/jail_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,37 @@ fn native_resource_limits_are_optional_typed_and_round_trip() -> Result<(), serd
assert_eq!(serde_json::to_value(config)?, request);
Ok(())
}

#[test]
fn native_jail_21_resource_subset_is_additive_and_keeps_disk_explicit()
-> Result<(), serde_json::Error> {
let jail = NativeJailConfig {
read_only: vec![],
read_write: vec![],
allow_net: false,
allow_subprocess: true,
enforcement: JailEnforcement::Enforced,
require_process_isolation: true,
deny_read: vec![],
resources: None,
};
let request = NativeJailRequest {
jail: jail.clone(),
resources: Some(NativeJailResourceRequest {
cpu_millis: Some(1),
memory_bytes: Some(64 * 1024 * 1024),
pids_max: Some(16),
disk_bytes: Some(1024),
}),
};
let encoded = serde_json::to_value(&request)?;
let decoded: NativeJailRequest = serde_json::from_value(encoded.clone())?;
assert_eq!(decoded, request);
assert_eq!(decoded.jail, jail);
assert_eq!(
decoded.resources.and_then(|limits| limits.disk_bytes),
Some(1024)
);
assert_eq!(crate::NATIVE_JAIL_RESOURCES_VERSION, (2, 1));
Ok(())
}
19 changes: 17 additions & 2 deletions crates/tinybox-bus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod grants;
pub use grants::{LocalGrantConfig, LocalGrants, ProtectedPaths, ResolveLocalGrantsRequest};

mod jail;
pub use jail::{JailEnforcement, NativeJailConfig};
pub use jail::{JailEnforcement, NativeJailConfig, NativeJailRequest, NativeJailResourceRequest};

mod shell_execution;
mod shell_selection;
Expand Down Expand Up @@ -82,7 +82,19 @@ pub use files::{
/// 2.0 removes TinyBox-owned command policy classification and the
/// `AnalyzeShell.hidden_execution` policy signal. Generic shell structure facts
/// and transport helpers remain.
pub const CONTRACT_VERSION: (u32, u32) = (2, 0);
/// 2.1 adds separate resource-aware native jail request members without
/// changing the 2.0 Rust request shapes.
pub const CONTRACT_VERSION: (u32, u32) = (2, 1);

/// Minimum contract version required for resource-aware native jail members.
pub const NATIVE_JAIL_RESOURCES_VERSION: (u32, u32) = (2, 1);

/// Whether a module explicitly advertises support for the resource-aware
/// native jail members. Hosts must check this before sending a 2.1 request.
#[must_use]
pub fn supports_native_jail_resources(module: (u32, u32)) -> bool {
module.0 == NATIVE_JAIL_RESOURCES_VERSION.0 && module.1 >= NATIVE_JAIL_RESOURCES_VERSION.1
}

/// Whether this host vocabulary can bind to a module's advertised version.
/// The major must match and the module's minor must include every host member.
Expand Down Expand Up @@ -207,6 +219,8 @@ pub mod names {
pub const KILL_STDIO: &str = "KillStdio";
/// Wire name of the `StdioStatus` member.
pub const STDIO_STATUS: &str = "StdioStatus";
/// Wire name of the 2.1 resource-aware jailed exec member.
pub const START_JAILED_EXEC_WITH_RESOURCES: &str = "StartJailedExecWithResources";
}

/// Supported methods in this contract, including the original discovery
Expand Down Expand Up @@ -253,6 +267,7 @@ pub const METHODS: &[&str] = &[
names::CLOSE_STDIN,
names::KILL_STDIO,
names::STDIO_STATUS,
names::START_JAILED_EXEC_WITH_RESOURCES,
];

/// Facts about the detected native directory-jail backend.
Expand Down
15 changes: 10 additions & 5 deletions crates/tinybox-bus/src/lib_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn docker_run_vocabulary_is_typed_bounded_and_additive() -> Result<(), serde_jso
assert_eq!(METHODS[28], "CleanupDocker");
assert_eq!(METHODS[29], "RunDockerWithoutWorkspace");
assert_eq!(METHODS[33], "StartNativeShellExec");
assert_eq!(CONTRACT_VERSION, (2, 0));
assert_eq!(CONTRACT_VERSION, (2, 1));
assert_eq!(MAX_DOCKER_RUN_TIMEOUT_MS, 86_400_000);
let serialized = serde_json::to_value(&request)?;
assert_eq!(serialized["read_only_rootfs"], false);
Expand Down Expand Up @@ -129,7 +129,7 @@ fn host_gateway_and_docker_facts_are_additive_and_default_safely() -> Result<(),
#[test]
fn version_and_capability_wire_snapshot_preserve_contract_compatibility()
-> Result<(), serde_json::Error> {
assert_eq!(CONTRACT_VERSION, (2, 0));
assert_eq!(CONTRACT_VERSION, (2, 1));
assert!(is_compatible(CONTRACT_VERSION));
assert!(!is_compatible((1, 21)));
assert!(!is_compatible((1, 8)));
Expand All @@ -143,14 +143,18 @@ fn version_and_capability_wire_snapshot_preserve_contract_compatibility()
assert!(!is_compatible((0, 99)));
assert!(!is_compatible((1, 22)));
assert!(!is_compatible((3, 0)));
assert!(!is_compatible((2, 0)));
assert!(is_compatible((2, 1)));
assert!(!supports_native_jail_resources((2, 0)));
assert!(supports_native_jail_resources((2, 1)));
assert!(supports_native_jail_resources((2, 2)));
let capabilities = ModuleCapabilities {
contract_version: CONTRACT_VERSION,
create_backends: vec!["passthrough".into()],
exec_backends: Vec::new(),
spawn_backends: Vec::new(),
};
let snapshot = serde_json::json!({"contract_version":[2,0],"create_backends":["passthrough"],"exec_backends":[],"spawn_backends":[]});
let snapshot = serde_json::json!({"contract_version":[2,1],"create_backends":["passthrough"],"exec_backends":[],"spawn_backends":[]});
assert_eq!(serde_json::to_value(&capabilities)?, snapshot);
assert_eq!(
serde_json::from_value::<ModuleCapabilities>(snapshot)?,
Expand All @@ -169,7 +173,7 @@ fn no_workspace_docker_operation_is_present_in_the_contract() {
.count(),
1
);
assert_eq!(CONTRACT_VERSION, (2, 0));
assert_eq!(CONTRACT_VERSION, (2, 1));
}

#[test]
Expand All @@ -182,7 +186,7 @@ fn shell_analysis_wire_shape_contains_only_structural_facts() -> Result<(), serd

#[test]
fn contract_two_drops_command_classification_but_keeps_structural_shell_analysis() {
assert_eq!(CONTRACT_VERSION, (2, 0));
assert_eq!(CONTRACT_VERSION, (2, 1));
assert!(!METHODS.contains(&"AnalyzeCommand"));
assert!(METHODS.contains(&"AnalyzeShell"));
}
Expand Down Expand Up @@ -358,6 +362,7 @@ fn named_members_resolve_to_the_method_catalogue_in_order() {
CLOSE_STDIN,
KILL_STDIO,
STDIO_STATUS,
START_JAILED_EXEC_WITH_RESOURCES,
];
assert_eq!(METHODS, &expected[..]);
assert_eq!(DESCRIBE, "Describe");
Expand Down
7 changes: 4 additions & 3 deletions crates/tinybox-jail/src/bwrap/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,10 @@ fn deny_masks(denied: &[PathBuf], mounts: &[Mount]) -> io::Result<Vec<OsString>>
os("/dev/null"),
deny.clone().into_os_string(),
]),
// Bubblewrap creates a missing --tmpfs destination on the host
// before mounting over it. Refuse instead of mutating a granted
// directory or preventing a future file from being created there.
// Bubblewrap's `--tmpfs` creates a missing destination on the host
// before mounting it. Refuse prospective denials rather than
// mutating a granted host directory or preventing that path from
// later being created as a file.
Err(error) if error.kind() == io::ErrorKind::NotFound => {
return Err(io::Error::new(
io::ErrorKind::NotFound,
Expand Down
10 changes: 2 additions & 8 deletions crates/tinybox-jail/src/bwrap/args_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,7 @@ fn deny_read_of_a_missing_path_is_refused() -> io::Result<()> {
let root = tempfile::tempdir()?;
let mut j = jail(root.path());
j.deny_read = vec![root.path().join("later")];
assert_eq!(
jail_args(&j, None, OPTS).err().map(|error| error.kind()),
Some(io::ErrorKind::NotFound)
);
assert_eq!(build(&j).unwrap_err().kind(), io::ErrorKind::NotFound);
Ok(())
}

Expand All @@ -254,10 +251,7 @@ fn missing_denial_inside_a_read_only_grant_is_refused() -> io::Result<()> {
let denied = grant.path().join("later");
let mut j = jail(root.path()).add_read_only(grant.path());
j.deny_read = vec![denied.clone()];
assert_eq!(
jail_args(&j, None, OPTS).err().map(|error| error.kind()),
Some(io::ErrorKind::NotFound)
);
assert_eq!(build(&j).unwrap_err().kind(), io::ErrorKind::NotFound);
Ok(())
}

Expand Down
5 changes: 4 additions & 1 deletion crates/tinybox-linux/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,7 @@ mod sandbox;

pub use probe::{NamespaceProbe, UsernsStatus};

pub use sandbox::{NAME, NamespaceSandbox, WORKSPACE_MOUNT};
pub use sandbox::{
NAME, NamespaceSandbox, NativeJailCommand, WORKSPACE_MOUNT, native_jail_argv,
native_jail_argv_with_programs, trusted_systemd_run_program,
};
Loading
Loading