Skip to main content

PathGuard

Trait PathGuard 

Source
pub trait PathGuard:
    Send
    + Sync
    + Debug {
    // Required methods
    fn restore_check<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 ToolContext,
        target: &'life2 Path,
    ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn command_writes(
        &self,
        globs: &[String],
        root: &Path,
    ) -> (Arc<dyn WriteScope>, Vec<String>);
    fn host_writes(&self, globs: &[String], cwd: &Path) -> Arc<dyn WriteScope> ⓘ;
    fn reaches_configuration(
        &self,
        path: &str,
        cwd: &Path,
        paths: &SensitivePaths,
    ) -> bool;
    fn admits(&self, grant: &Grant) -> Result<(), GrantError>;
}

Required Methods§

Source

fn restore_check<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 ToolContext, target: &'life2 Path, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Whether a rewind may write target back, judged from ctx: Ok(true) when it lies outside the session’s writable roots, Err with why when it must not be written at all.

Source

fn command_writes( &self, globs: &[String], root: &Path, ) -> (Arc<dyn WriteScope>, Vec<String>)

A plugin command’s writes globs below root: the scope kept, and the globs left out because they reach beyond the project.

Source

fn host_writes(&self, globs: &[String], cwd: &Path) -> Arc<dyn WriteScope> ⓘ

A host-started delegate’s writes, every glob kept, a relative one anchored at cwd.

Source

fn reaches_configuration( &self, path: &str, cwd: &Path, paths: &SensitivePaths, ) -> bool

Whether writing path from cwd reaches configuration under any of its spellings.

Source

fn admits(&self, grant: &Grant) -> Result<(), GrantError>

Err(TooBroad) for a narrow-only grant that reaches as far as the bare tool, or out of the directory it is narrow within.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§