pub struct ProtectedPaths {
home: Option<PathBuf>,
data_root: Option<PathBuf>,
install_dirs: Vec<PathBuf>,
system_roots: Vec<PathBuf>,
exempt_roots: Vec<PathBuf>,
}Expand description
What a mutation must never touch (spec §9, “Security”): a filesystem
root, the home folder itself, AgentMux’s own data and installation, the
OS’s system folders, and the inside of a macOS app bundle. Nor anything
that CONTAINS one of those: deleting C:\Users would delete the home
folder too.
Every path held here is in path_key form.
Fields§
§home: Option<PathBuf>§data_root: Option<PathBuf>~/.agentmux. Inside it only agents’ own workspaces
(agents/<name>/…) may be changed; the rest is AgentMux’s state.
install_dirs: Vec<PathBuf>§system_roots: Vec<PathBuf>§exempt_roots: Vec<PathBuf>Inside these the system list doesn’t apply: the temp folder, which
on macOS lives under /var.
Implementations§
Source§impl ProtectedPaths
impl ProtectedPaths
Sourcepub fn current() -> Self
pub fn current() -> Self
The protected set for this machine, computed afresh so a check made right before a mutation reflects the filesystem as it is then.
Sourcepub fn check(&self, target: &Path) -> Result<(), String>
pub fn check(&self, target: &Path) -> Result<(), String>
Ok if a mutation may act on target (a resolve_entry_path
result). The error is a sentence for the user.
Sourcefn check_in_distro(&self, share: &SharePath) -> Result<(), String>
fn check_in_distro(&self, share: &SharePath) -> Result<(), String>
Self::check for a WSL distro’s file through \\wsl.localhost
(remote::wsl_fs). Its /mnt/<letter> is a Windows drive, so the
Windows rules decide; its own system folders and home folders are
protected as this machine’s are.
Trait Implementations§
Source§impl Clone for ProtectedPaths
impl Clone for ProtectedPaths
Source§fn clone(&self) -> ProtectedPaths
fn clone(&self) -> ProtectedPaths
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 ProtectedPaths
impl Debug for ProtectedPaths
Source§impl Default for ProtectedPaths
impl Default for ProtectedPaths
Source§fn default() -> ProtectedPaths
fn default() -> ProtectedPaths
Auto Trait Implementations§
impl Freeze for ProtectedPaths
impl RefUnwindSafe for ProtectedPaths
impl Send for ProtectedPaths
impl Sync for ProtectedPaths
impl Unpin for ProtectedPaths
impl UnsafeUnpin for ProtectedPaths
impl UnwindSafe for ProtectedPaths
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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