Skip to content

release: v0.4.0 — guard API, GuardedFile, error model cleanup#3

Merged
aimable100 merged 1 commit into
mainfrom
release/v0.4.0
May 21, 2026
Merged

release: v0.4.0 — guard API, GuardedFile, error model cleanup#3
aimable100 merged 1 commit into
mainfrom
release/v0.4.0

Conversation

@aimable100

@aimable100 aimable100 commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • guard featureFdJail pins the jail root as a live dirfd and opens files via a single openat2(RESOLVE_BENEATH | RESOLVE_NO_MAGICLINKS) syscall on Linux 5.6+ (x86_64/aarch64), making validate-and-open atomically kernel-enforced. Falls back to O_NOFOLLOW on macOS/BSD and unsupported Linux arches (riscv64, s390x, …) with attestation().toctou_safe = false advertising the weaker guarantee.
  • GuardedFile (renamed from JailFile) wraps the open File + an Attestation snapshot (inode, device, nlink, timestamp, optional Ed25519 signature). Implements Read/Write/Seek/Deref/AsFd/AsRawFd. Pluggable Signer/Verifier traits — no vendored crypto.
  • FdJail now implements Clone (via dup(2) on Linux) + Send + Sync.

API stability fixes

Before After
guard::JailFile guard::GuardedFile
JailError::InvalidRoot(PathBuf) + InvalidJailRoot { path, source } JailError::InvalidRoot { path, source: Option<io::Error> }
FdJail::check FdJail::check_path
Attestation / KernelVersion (exhaustive) Both are now #[non_exhaustive]
O_NOFOLLOW = 0 on unknown Unix (silent security bug) compile_error!
compile_error! on riscv64 + guard Graceful O_NOFOLLOW fallback

Other

  • MSRV bumped to 1.85; cargo-semver-checks un-suppressed in CI; SHA-pinned actions.
  • DESIGN.md fully rewritten; SECURITY.md versioning section updated.
  • docs/fd_first_spec.md deleted (stale fd-first → guard rename artifact).

Test plan

  • CI passes on all matrix legs (Ubuntu/macOS/Windows × stable/beta/nightly)
  • MSRV build at 1.85 passes
  • aarch64 + armv7 cross-compile passes
  • cargo-deny passes
  • cargo-semver-checks passes against v0.3.1 baseline

Adds the guard API (FdJail / GuardedFile / Attestation / openat2), tightens
the error model, and fixes several pre-1.0 API stability issues.

Key changes
-----------
- guard feature: FdJail pins the jail root as a dirfd; FdJail::open uses a
  single openat2(RESOLVE_BENEATH | RESOLVE_NO_MAGICLINKS) syscall on Linux
  5.6+ (x86_64 + aarch64); O_NOFOLLOW fallback on macOS/BSD and unsupported
  Linux arches (riscv64, s390x, …) with attestation().toctou_safe = false.
- GuardedFile (renamed from JailFile): wraps the opened File + Attestation;
  implements Read/Write/Seek/Deref/AsFd/AsRawFd. sign_attestation() via
  pluggable Signer/Verifier traits.
- Attestation and KernelVersion are now #[non_exhaustive].
- JailError::InvalidRoot is now a struct variant { path, source: Option<io::Error> },
  replacing both the old tuple variant and the guard-only InvalidJailRoot.
- FdJail::check renamed to check_path.
- secure-open: O_NOFOLLOW = 0 silent fallback replaced with compile_error!
  on unknown Unix platforms.
- FdJail implements Clone (dup(2) on Linux) + Send + Sync.
- MSRV bumped to 1.85; CI matrix hardened (semver-checks un-suppressed,
  SHA-pinned actions, cargo-deny, aarch64/armv7 cross tests).
- DESIGN.md rewritten; SECURITY.md versioning section updated for pre/post-1.0.
- docs/fd_first_spec.md deleted (stale artifact from fd-first → guard rename).
@aimable100 aimable100 merged commit 335706f into main May 21, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant