pub struct PathClassifier { /* private fields */ }Expand description
Classifies paths for the file tools: secrets a read refuses, and the
wider set of sensitive paths a write refuses. Beyond the built-in
patterns, an app adds its own files (its config, its env file) as
protected; they count as both.
Implementations§
Source§impl PathClassifier
impl PathClassifier
pub fn new(protected: Vec<PathBuf>) -> Self
Sourcepub fn protected_paths(&self) -> &[PathBuf]
pub fn protected_paths(&self) -> &[PathBuf]
The app’s own files, as given.
Sourcepub fn is_protected(&self, path: &Path) -> bool
pub fn is_protected(&self, path: &Path) -> bool
One of the app’s own files (compared after resolving symlinks).
Sourcepub fn is_secret(&self, path: &Path) -> bool
pub fn is_secret(&self, path: &Path) -> bool
A file that holds secrets: keys, credentials, env files, the app’s own files.
Sourcepub fn is_secret_ignoring_name_shape(&self, path: &Path) -> bool
pub fn is_secret_ignoring_name_shape(&self, path: &Path) -> bool
PathClassifier::is_secret without the .env.* / *.key
name-shape rules, so a template file is judged by where it lives.
Sourcepub fn is_sensitive(&self, path: &Path) -> bool
pub fn is_sensitive(&self, path: &Path) -> bool
A path the file tools must not write: everything secret, plus repository internals and infrastructure state.
Trait Implementations§
Source§impl Clone for PathClassifier
impl Clone for PathClassifier
Source§impl Debug for PathClassifier
impl Debug for PathClassifier
Source§impl Default for PathClassifier
impl Default for PathClassifier
impl Eq for PathClassifier
Source§impl PartialEq for PathClassifier
impl PartialEq for PathClassifier
impl StructuralPartialEq for PathClassifier
Auto Trait Implementations§
impl Forget for PathClassifier
impl Freeze for PathClassifier
impl Move for PathClassifier
impl RefUnwindSafe for PathClassifier
impl Send for PathClassifier
impl Sync for PathClassifier
impl Unpin for PathClassifier
impl UnsafeUnpin for PathClassifier
impl UnwindSafe for PathClassifier
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