pub struct CanonSubcommand {
pub argv: Vec<String>,
pub opaque: bool,
pub write_redirect_targets: Vec<String>,
pub read_redirect_targets: Vec<String>,
}Expand description
One extracted sub-command: its canonicalized argv, and whether it is
“opaque” — a wrapper whose real effect can’t be statically resolved, so
crate::permissions::rules::evaluate_command must never let it resolve
to Allow purely by absence of a matching rule.
Fields§
§argv: Vec<String>The wrapper-stripped, normalized argument vector — argv[0] is the
effective command name, e.g. ["rm", "-rf", "/"] for sudo rm -rf /.
opaque: boolA dynamically-named command ($(...)/backtick used AS the command
name itself, e.g. `echo rm` -rf /) or a documented always-ask
exec wrapper (watch, find -exec, bare xargs, eval/sh -c
family, …), or an argument this canonicalizer could not safely
normalize (F3). Forces a minimum Ask decision — see
crate::permissions::rules.
write_redirect_targets: Vec<String>F4 (Fable-5 adversarial review): every path this sub-command WRITES
to via a shell output redirect directly attached to it (>, >>,
&>, >|, &>>) — see walk_collect_commands’s redirect
handling. crate::permissions::rules::evaluate_command checks each
of these against the write(...) protected-path rules exactly like
a write_file call would, so echo evil > .env can’t silently
bypass protected_paths just because it went through bash.
read_redirect_targets: Vec<String>The input-redirect (<) counterpart of
Self::write_redirect_targets, checked against read(...) rules.
Implementations§
Source§impl CanonSubcommand
impl CanonSubcommand
Sourcepub fn canonical_text(&self) -> String
pub fn canonical_text(&self) -> String
The canonical, space-joined command text a rule’s command-glob
matches against (e.g. "rm -rf /"). Tokens are joined with a single
ASCII space regardless of the source’s original whitespace/quoting —
this IS the normalization risk-1’s mitigation calls for (“normalize
quoting/whitespace”).
Trait Implementations§
Source§impl Clone for CanonSubcommand
impl Clone for CanonSubcommand
Source§fn clone(&self) -> CanonSubcommand
fn clone(&self) -> CanonSubcommand
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CanonSubcommand
impl Debug for CanonSubcommand
Source§impl Default for CanonSubcommand
impl Default for CanonSubcommand
Source§fn default() -> CanonSubcommand
fn default() -> CanonSubcommand
impl Eq for CanonSubcommand
Source§impl PartialEq for CanonSubcommand
impl PartialEq for CanonSubcommand
impl StructuralPartialEq for CanonSubcommand
Auto Trait Implementations§
impl Freeze for CanonSubcommand
impl RefUnwindSafe for CanonSubcommand
impl Send for CanonSubcommand
impl Sync for CanonSubcommand
impl Unpin for CanonSubcommand
impl UnsafeUnpin for CanonSubcommand
impl UnwindSafe for CanonSubcommand
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.