pub struct Guard { /* private fields */ }Implementations§
Source§impl Guard
impl Guard
pub fn new(cfg: &GuardConfig) -> Result<Self>
Sourcepub fn check_path(&self, path: &Path) -> Option<Finding>
pub fn check_path(&self, path: &Path) -> Option<Finding>
Why a local path may not be uploaded, if it may not.
Sourcepub fn check_download_target(&self, rel: &Path) -> Option<Finding>
pub fn check_download_target(&self, rel: &Path) -> Option<Finding>
Why a download may not land at this local path (given relative to the allowlisted root), if it may not. Credential-shaped names are refused as on upload, plus anything an editor or agent would trust or execute when opening the folder.
Sourcepub fn check_content(&self, bytes: &[u8]) -> Option<Finding>
pub fn check_content(&self, bytes: &[u8]) -> Option<Finding>
Why these bytes may not be sent, if they may not.
Sourcepub fn ensure_content(&self, what: &str, bytes: &[u8]) -> Result<()>
pub fn ensure_content(&self, what: &str, bytes: &[u8]) -> Result<()>
Refuse if bytes (described as what in the message) carry a secret.
Sourcepub fn ensure_upload(&self, path: &Path, bytes: &[u8]) -> Result<()>
pub fn ensure_upload(&self, path: &Path, bytes: &[u8]) -> Result<()>
Refuse if path or its bytes may not be uploaded.
Sourcepub fn ensure_download(&self, rel: &Path) -> Result<()>
pub fn ensure_download(&self, rel: &Path) -> Result<()>
Refuse if a download may not be written to rel (relative to the
allowlisted root it lands in).
Auto Trait Implementations§
impl Freeze for Guard
impl RefUnwindSafe for Guard
impl Send for Guard
impl Sync for Guard
impl Unpin for Guard
impl UnsafeUnpin for Guard
impl UnwindSafe for Guard
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