Expand description
Path-contained filesystem operations with 9P-aligned naming.
Provides a ContainedFs trait that abstracts path-safe filesystem operations.
All operations are contained within a root directory — paths cannot escape via
symlinks, .. traversal, or other techniques.
- Linux: Uses
pathrswithopenat2(RESOLVE_IN_ROOT)for kernel-enforced containment. This is atomic and TOCTOU-proof. - Unix non-Linux (macOS, FreeBSD): Uses
safe-pathwith per-component symlink resolution constrained within root. Better than canonicalize but not kernel-enforced. - Non-Unix (Windows): Uses
canonicalize+ prefix check. Best-effort (TOCTOU-vulnerable), acceptable for development.
§Path utilities
contained_join: Clamps..traversal (for path construction).validate_relative_path: Rejects..traversal (for I/O validation).validate_ref_name: Git ref name validation (matchesgit check-ref-format).
Re-exports§
pub use canonical_root::CanonicalRoot;pub use error::FsError;pub use path::contained_join;pub use path::validate_ref_name;pub use path::validate_relative_path;pub use pathrs_root::PathrsRoot;pub use types::DirEntry;pub use types::FsHandle;pub use types::OpenMode;pub use types::Stat;pub use types::QTDIR;pub use types::QTFILE;
Modules§
- canonical_
root - Canonicalize-based path containment (cross-platform fallback).
- error
- Filesystem error types.
- path
- Path construction and validation utilities.
- pathrs_
root - Linux pathrs-based containment (kernel-enforced via openat2).
- types
- Core types for contained filesystem operations.
Traits§
- Contained
Fs - Trait abstracting path-contained filesystem operations.
Functions§
- open
- Open best available ContainedFs for root path.