Skip to main content

Enforcement

Struct Enforcement 

Source
pub struct Enforcement {
    pub fs: Filesystem,
    pub egress: Egress,
    pub secrets: Vec<BrokeredSecret>,
    pub limits: Vec<ProcessLimit>,
    pub decide_only: Vec<DecideOnly>,
    pub losses: Vec<Loss>,
    pub allowances: Vec<Allowance>,
}
Expand description

What an OS layer may enforce for one policy in one context.

Fields§

§fs: Filesystem

File reads and writes.

§egress: Egress

Outbound network.

§secrets: Vec<BrokeredSecret>

Secrets the egress proxy and Claude Code’s own broker inject for the agent (ADR-020). One entry per policy secrets: item; OS backends consume these without reading the policy again.

§limits: Vec<ProcessLimit>

Limits on the agent’s processes. Always empty: no policy key sets one yet.

§decide_only: Vec<DecideOnly>

Rules only the hook can apply, by kind. Shell semantics, environment variables, MCP tool names and executable pins name things an OS layer cannot see (a command line, a variable, a tool), so they are not lowered and stay with the hook decision (ADR-018). The file paths of a deny group marked hook_only stay with it too (ADR-034): OS layers leave them to the other rules, so these are the one place the IR’s own verdicts may be wider than the hook’s.

§losses: Vec<Loss>

Where the IR is stricter than the hook decision, with the reason.

§allowances: Vec<Allowance>

Where OS layers may be wider than the hook decision, listed in the policy (sandbox.read_roots). The hook keeps deciding these accesses; deny rules still win over them. Not part of Filesystem, so the IR’s own verdicts stay the hook’s or stricter.

Implementations§

Source§

impl Enforcement

Source

pub fn checker(&self) -> Result<Checker, PolicyError>

Compile the IR’s globs for Checker::check.

Trait Implementations§

Source§

impl Clone for Enforcement

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Enforcement

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Enforcement

Source§

impl PartialEq for Enforcement

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Enforcement

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Enforcement

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.