Skip to main content

Crate hyprstream_containedfs

Crate hyprstream_containedfs 

Source
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 pathrs with openat2(RESOLVE_IN_ROOT) for kernel-enforced containment. This is atomic and TOCTOU-proof.
  • Unix non-Linux (macOS, FreeBSD): Uses safe-path with 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

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§

ContainedFs
Trait abstracting path-contained filesystem operations.

Functions§

open
Open best available ContainedFs for root path.