tiny.sandbox.Policy
Defined in policy.
States what isolation a run has to have before the run starts: the policy records what the caller asks of the filesystem, process, and network dimensions, each judged on its own.
API (7)
Actions
Public operations.
Fields and members
Public fields and members.
Source
Source: lib/sandbox/src/policy.zig:21
zig
/// States what isolation a run has to have before the run starts: the policy/// records what the caller asks of the filesystem, process, and network/// dimensions, each judged on its own. A required dimension rejects an audit/// weaker than isolated, returning `error.UnmetFilesystemIsolation` ,/// `error.UnmetProcessIsolation` , or `error.UnmetNetworkIsolation` before the/// child runs. By contrast, a preferred dimension records what the caller wants/// and admits every audit, which backend selection reads to pick a runner. Both/// filesystem values count as isolated, so requiring the filesystem dimension/// admits every audit the package can produce. The environment dimension/// appears in the audit and has no entry here, so a policy constrains it in no/// way.pub const Policy = struct { filesystem: Preference = .require_isolated, process: Preference = .allow_inherited, network: Preference = .allow_inherited, pub fn validate(self: Policy, audit: audit_data.Audit) !void { if (self.filesystem == .require_isolated and !filesystemIsolated(audit.filesystem)) return error.UnmetFilesystemIsolation; if (self.process == .require_isolated and !processIsolated(audit.process)) return error.UnmetProcessIsolation; if (self.network == .require_isolated and !networkIsolated(audit.network)) return error.UnmetNetworkIsolation; } pub fn prefersFilesystemIsolation(self: Policy) bool { return self.filesystem != .allow_inherited; } pub fn prefersProcessIsolation(self: Policy) bool { return self.process != .allow_inherited; } pub fn prefersNetworkIsolation(self: Policy) bool { return self.network != .allow_inherited; }};Source: lib/sandbox/src/root.zig:58
zig
pub const Policy = policy.Policy;Audit
| Definitions | 5 |
|---|---|
| Public names | 10 |
| Members | 3 |
| Version | 26.7.0 |
| Revision | daab053ee433 |