workpen 0.7.0

Workpen dest-deny and a per-child process jail (Landlock, Seatbelt, Windows).
Documentation
//! Workpen dest-deny and a per-child process jail. The parent is trusted.
//!
//! Hosts call dest-deny with an explicit [`DenyPolicy`]. There is no
//! process-wide deny slot; a session wrapper can hold the policy:
//!
//! ```
//! use std::path::Path;
//! use workpen::{DenyPolicy, dest_deny_message, is_path_denied};
//!
//! let policy = DenyPolicy::default();
//! assert!(is_path_denied(Path::new(".env"), &policy));
//! assert!(dest_deny_message(Path::new(".env"), ".env", &policy).is_some());
//! ```
//!
//! Leftover worktree GC is behind `feature = "gc"`. Hosts pass
//! `leftover_dir` and `saved_ref_prefix` on `GcConfig`.

mod agent_lock;
mod deny;
#[cfg(feature = "gc")]
mod gc;
mod guard;
pub mod threat_model;
mod why;
#[cfg(feature = "nono")]
mod wrap;

pub use agent_lock::{AGENT_LOCK_NAME, AgentLockError, load_agent_lock, load_agent_lock_file};
pub use deny::{
    CheckDestError, DenyPolicy, DestDeny, DestDenyError, DestDenyKind, check_command_argv,
    check_command_dests, check_dest, classify_dest, default_secret_denies, deny_patch_dests,
    deny_patch_dests_with_display, dest_deny_glob_regex, dest_deny_message, dest_under_root,
    is_env_template_basename, is_path_denied, open_verified_read, path_is_denied_glob,
    path_is_denied_under_root, path_matches_deny_glob, reject_command_secret_path_tokens,
    validate_deny_glob, verify_post_open,
};
#[cfg(feature = "gc")]
pub use gc::{
    GcConfig, GcDecision, GcError, KeepReason, classify_for_age_gc,
    classify_for_age_gc_with_policy, classify_worktree, classify_worktree_with_policy,
    parse_max_age, remove_explicit, remove_explicit_with_policy, run_gc, run_gc_with_policy,
    worktree_last_used,
};
pub use guard::{
    AbsolutePathPolicy, ExtraRootError, PathGuard, PathGuardBuilder, PathGuardDeny, PathGuardError,
    PathGuardKind, check_dests, resolve_extra_root, resolve_extra_root_pair,
    resolve_workspace_root,
};
pub use why::{Why, explain};
#[cfg(feature = "nono")]
pub use wrap::{
    DoctorFacts, KernelAccess, KernelApply, KernelError, KernelGrant, KernelPolicy,
    child_env_deny_names, collect_doctor_facts, collect_workspace_dest_denies,
    collect_workspace_dest_denies_limited, doctor_fails, is_denied_child_env, kernel_supported,
    process_jail, process_jail_with_policy, require_applied, require_dest_hide,
    scrub_child_command, spawn_after_setup, with_bash_noprofile,
};

/// Crate version from Cargo.toml.
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

#[cfg(test)]
mod tests {
    #[test]
    fn version_matches_package() {
        assert_eq!(super::VERSION, env!("CARGO_PKG_VERSION"));
    }
}