Skip to main content

Module command_risk

Module command_risk 

Source

Re-exports§

pub use crate::semantics::PermissionMode;
pub use crate::semantics::RiskLevel;

Structs§

ShellInvocation
One executable invocation recovered from shell syntax. program preserves the executable token (including an absolute path); arguments are parsed argv values. This is a syntax tree projection, not a natural-language classifier.

Functions§

approval_floor_reason
Return a concrete protected-path reason that semantic assessment cannot downgrade. This recognizes explicit parsed path segments only; it is not a general executable, subcommand, or natural-language risk classifier.
persistence_floor_reason
Why a command that changes things must ask the owner because it names a persistence path (crate::path_class::is_persistence_path): a shell start-up file, a launch agent, a cron entry, a git hook, the daemon’s own instructions. Every argument word counts (a redirection target glued to > too), and extra paths (the call’s declared write paths and roots); relative ones resolve against working_dir when it is absolute. A command that only observes is never asked about here.
split_by_operators
Explicit credential/private-key path segments form a narrow deterministic floor. Open-ended command danger is assessed semantically elsewhere. Split a command string by shell operators while respecting quotes. Returns (segment, operator_after) pairs.
structural_shell_invocations
Parse top-level and nested shell -c executable invocations through one shared shell-grammar boundary. Runtime dependency discovery and workload classification consume this same projection so wrapper depth cannot make their views drift.