pub struct DefaultPolicy;Expand description
Default permission policy.
§Rules
| Scope/Action | Standard | Elevated |
|---|---|---|
| Global signal | Denied | Allowed |
| Channel signal | Allowed | Allowed |
| Destructive ops | Denied | Allowed |
| Command exec | Denied | Allowed |
| Spawn child/runner | Denied | Allowed |
§Security Model
Command safety is enforced at the OS sandbox layer (SandboxPolicy), not by pattern-matching commands. This policy controls WHO can act (session-based), while SandboxPolicy controls WHERE actions reach.
§Audit Logging
All permission checks are logged for audit:
- Allowed operations: debug level
- Denied operations: warn level
Trait Implementations§
Source§impl Clone for DefaultPolicy
impl Clone for DefaultPolicy
Source§fn clone(&self) -> DefaultPolicy
fn clone(&self) -> DefaultPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DefaultPolicy
impl Debug for DefaultPolicy
Source§impl Default for DefaultPolicy
impl Default for DefaultPolicy
Source§fn default() -> DefaultPolicy
fn default() -> DefaultPolicy
Returns the “default value” for a type. Read more
Source§impl PermissionChecker for DefaultPolicy
impl PermissionChecker for DefaultPolicy
Source§fn check_command(
&self,
session: &Session,
grants: &dyn GrantPolicy,
cmd: &str,
) -> CommandCheckResult
fn check_command( &self, session: &Session, grants: &dyn GrantPolicy, cmd: &str, ) -> CommandCheckResult
Check command with dynamic grants and HIL approval support.
Flow:
- Reject empty commands
- Check dynamic grants (via
GrantPolicy) -> Allowed - Check elevated session -> Allowed
- Otherwise -> RequiresApproval (non-elevated session)
Command safety is enforced at the OS sandbox layer, not here. This method only controls WHO can execute, not WHAT can be executed.
Source§impl PermissionPolicy for DefaultPolicy
impl PermissionPolicy for DefaultPolicy
Source§fn can_signal(&self, session: &Session, scope: &SignalScope) -> bool
fn can_signal(&self, session: &Session, scope: &SignalScope) -> bool
Check if session can send a signal with the given scope.
Source§fn can_destructive(&self, session: &Session, action: &str) -> bool
fn can_destructive(&self, session: &Session, action: &str) -> bool
Check if session can perform a destructive operation. Read more
Source§fn can_execute_command(&self, session: &Session, cmd: &str) -> bool
fn can_execute_command(&self, session: &Session, cmd: &str) -> bool
Check if session can execute a shell command.
Source§fn can_spawn_child(&self, session: &Session) -> bool
fn can_spawn_child(&self, session: &Session) -> bool
Check if session can spawn a child entity.
Source§fn can_spawn_runner(&self, session: &Session) -> bool
fn can_spawn_runner(&self, session: &Session) -> bool
Check if session can spawn a runner (parallel execution).
Source§fn check_command_permission(
&self,
session: &Session,
cmd: &str,
) -> CommandPermission
fn check_command_permission( &self, session: &Session, cmd: &str, ) -> CommandPermission
Check command with granular permission result. Read more
impl Copy for DefaultPolicy
Auto Trait Implementations§
impl Freeze for DefaultPolicy
impl RefUnwindSafe for DefaultPolicy
impl Send for DefaultPolicy
impl Sync for DefaultPolicy
impl Unpin for DefaultPolicy
impl UnsafeUnpin for DefaultPolicy
impl UnwindSafe for DefaultPolicy
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