pub struct Policy {
pub mode: PermissionMode,
pub allowlist: Vec<String>,
pub denylist: Vec<String>,
pub enable_os_sandbox: bool,
pub shell_allow: Vec<String>,
pub shell_deny: Vec<String>,
pub enforce_dangerous_shell: bool,
}Fields§
§mode: PermissionMode§allowlist: Vec<String>§denylist: Vec<String>§enable_os_sandbox: boolWhen true, hosts/Agent should enable OS seatbelt/bwrap for process tools.
shell_allow: Vec<String>Host-owned shell allow globs for process tools, e.g. git *, cargo test*.
When non-empty, every shell segment must match some pattern (after deny/dangerous).
Engine only matches; hosts fill the lists.
shell_deny: Vec<String>Host-owned shell deny globs for process tools (any matching segment → Deny).
enforce_dangerous_shell: boolWhen true (default), apply built-in dangerous-shell hard-deny under non-FullAccess. Hosts that fully own shell policy can set false and use hooks/Authorizer instead.
Implementations§
Source§impl Policy
impl Policy
pub fn full_access() -> Self
pub fn read_only() -> Self
pub fn workspace_write() -> Self
pub fn deny_all() -> Self
Sourcepub fn with_os_sandbox(self, enabled: bool) -> Self
pub fn with_os_sandbox(self, enabled: bool) -> Self
Enable or disable OS sandbox plugin flag (seatbelt/bwrap).
pub fn with_shell_allow( self, patterns: impl IntoIterator<Item = impl Into<String>>, ) -> Self
pub fn with_shell_deny( self, patterns: impl IntoIterator<Item = impl Into<String>>, ) -> Self
pub fn with_enforce_dangerous_shell(self, enabled: bool) -> Self
Sourcepub fn apply_scope(&mut self, scope_policy: &Policy)
pub fn apply_scope(&mut self, scope_policy: &Policy)
Apply a scope/profile policy’s mode (+ sandbox flag) without wiping host-owned fields.
Preserves: shell_allow, shell_deny, enforce_dangerous_shell, allowlist, denylist.
Sourcepub fn with_scope(self, scope_policy: &Policy) -> Self
pub fn with_scope(self, scope_policy: &Policy) -> Self
Builder form of Self::apply_scope.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Policy
impl<'de> Deserialize<'de> for Policy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnsafeUnpin for Policy
impl UnwindSafe for Policy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more