pub enum ConfinementTarget<'a> {
Directory(&'a OsStr),
File(&'a OsStr),
}Expand description
The terminal path component a resolve_confined_path walk resolves and confinement-checks
but deliberately does not create.
§Examples
use mcp_execution_core::ConfinementTarget;
use std::ffi::OsStr;
let target = ConfinementTarget::File(OsStr::new("SKILL.md"));
assert!(matches!(target, ConfinementTarget::File(_)));Variants§
Directory(&'a OsStr)
The caller publishes the directory itself (e.g. via an atomic staged rename), so the resolved directory is confinement-checked and canonicalized but not created.
File(&'a OsStr)
The caller writes the file itself, so the resolved path is confinement-checked but
neither created nor canonicalized. write_confined_file closes the symlink-planting
race at this exact terminal path between that check and the write itself (issue #496); a
plain tokio::fs::write does not. It does not defend against a symlink swapped in for a
parent directory after the check, nor a hardlink at the target — see its own doc comment
for the residual.
Trait Implementations§
Source§impl<'a> Clone for ConfinementTarget<'a>
impl<'a> Clone for ConfinementTarget<'a>
Source§fn clone(&self) -> ConfinementTarget<'a>
fn clone(&self) -> ConfinementTarget<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for ConfinementTarget<'a>
Source§impl<'a> Debug for ConfinementTarget<'a>
impl<'a> Debug for ConfinementTarget<'a>
impl<'a> Eq for ConfinementTarget<'a>
Source§impl<'a> PartialEq for ConfinementTarget<'a>
impl<'a> PartialEq for ConfinementTarget<'a>
impl<'a> StructuralPartialEq for ConfinementTarget<'a>
Auto Trait Implementations§
impl<'a> Freeze for ConfinementTarget<'a>
impl<'a> RefUnwindSafe for ConfinementTarget<'a>
impl<'a> Send for ConfinementTarget<'a>
impl<'a> Sync for ConfinementTarget<'a>
impl<'a> Unpin for ConfinementTarget<'a>
impl<'a> UnsafeUnpin for ConfinementTarget<'a>
impl<'a> UnwindSafe for ConfinementTarget<'a>
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