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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Wire format shared between [`crate::BirdcageSandbox`] and the
//! `nyx-sandbox-shim` helper binary.
//!
//! The shim cannot be invoked safely from inside the daemon process
//! (birdcage sandboxes the *current* process before spawning) so we
//! always exec a fresh shim and pass it the full sandbox configuration
//! as a single JSON blob on stdin.
use PathBuf;
use ;
/// Out-of-band status frame the shim writes inside [`ShimReport`].
/// Lets the parent reconstruct `SandboxStatus::Signaled(sig)` the same
/// way `ProcessSandbox` already does via `ExitStatusExt::signal()`.
/// Out-of-band report the shim writes to fd 3 once, after the sandboxee
/// exits. Wraps the structured [`ShimStatus`] plus the list of birdcage
/// exception refusals collected during sandbox setup. A `refusals` line
/// is a human-readable description of an exception the shim asked
/// birdcage to honour but birdcage rejected (typical reason: the
/// allow_read path does not exist on the host, or the kernel does not
/// expose the requested seccomp filter). The parent surfaces them on
/// [`crate::SandboxOutcome::refusals`] so callers can flag a sandbox
/// whose declared exceptions did not all take effect.
///
/// The shim also emits the same refusals on stderr for older parents
/// (pre-status-fd builds) and for operators running the shim by hand.