pub struct ExecPolicyManager { /* private fields */ }Expand description
Manages execution policies and authorization decisions.
Implementations§
Source§impl ExecPolicyManager
impl ExecPolicyManager
Sourcepub fn new(workspace_root: PathBuf, config: ExecPolicyConfig) -> Self
pub fn new(workspace_root: PathBuf, config: ExecPolicyConfig) -> Self
Create a new policy manager.
Sourcepub fn with_defaults(workspace_root: PathBuf) -> Self
pub fn with_defaults(workspace_root: PathBuf) -> Self
Create with default configuration.
Sourcepub async fn load_policy(&self, path: &Path) -> Result<()>
pub async fn load_policy(&self, path: &Path) -> Result<()>
Load policy from a file.
Sourcepub async fn add_prefix_rule(
&self,
pattern: &[String],
decision: Decision,
) -> Result<()>
pub async fn add_prefix_rule( &self, pattern: &[String], decision: Decision, ) -> Result<()>
Add a prefix rule to the policy.
Sourcepub async fn add_trusted_pattern(&self, amendment: ExecPolicyAmendment)
pub async fn add_trusted_pattern(&self, amendment: ExecPolicyAmendment)
Add a trusted pattern amendment.
Sourcepub async fn set_sandbox_policy(&self, policy: SandboxPolicy)
pub async fn set_sandbox_policy(&self, policy: SandboxPolicy)
Set the sandbox policy.
Sourcepub async fn sandbox_policy(&self) -> SandboxPolicy
pub async fn sandbox_policy(&self) -> SandboxPolicy
Get the current sandbox policy.
Sourcepub async fn check_approval(
&self,
command: &[String],
) -> ExecApprovalRequirement
pub async fn check_approval( &self, command: &[String], ) -> ExecApprovalRequirement
Check if a command requires approval.
Sourcepub async fn check_approval_batch(
&self,
commands: &[Vec<String>],
) -> ExecApprovalRequirement
pub async fn check_approval_batch( &self, commands: &[Vec<String>], ) -> ExecApprovalRequirement
Check multiple commands and return combined approval requirement.
Sourcepub async fn approve_command(&self, command: &[String])
pub async fn approve_command(&self, command: &[String])
Mark a command as approved for this session.
Sourcepub async fn clear_session_approvals(&self)
pub async fn clear_session_approvals(&self)
Clear all session approvals.
Sourcepub async fn evaluate(&self, command: &[String]) -> PolicyEvaluation
pub async fn evaluate(&self, command: &[String]) -> PolicyEvaluation
Evaluate a command against the full policy stack.
Auto Trait Implementations§
impl !Freeze for ExecPolicyManager
impl !RefUnwindSafe for ExecPolicyManager
impl !UnwindSafe for ExecPolicyManager
impl Send for ExecPolicyManager
impl Sync for ExecPolicyManager
impl Unpin for ExecPolicyManager
impl UnsafeUnpin for ExecPolicyManager
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
Mutably borrows from an owned value. Read more