Expand description
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.
Modules§
- threat_
model - Crate threat model. Not a launch README.
Structs§
- Deny
Policy - Portable dest-deny policy. Same globs on every OS. Hosts hold this value. There is no process-wide default slot. Clone is cheap.
- Dest
Deny - Doctor
Facts - Inputs for
doctor_fails. Remount is Linux-only. WFP is Windows-only. - GcConfig
- Host knobs. Bline passes leftover_dir = “.bline-worktrees”, saved_ref_prefix = “refs/bline/reclaimed”.
- Kernel
Grant - One grant we will hand to the kernel backend.
- Kernel
Policy - Process-jail policy. Workspace RW, extra roots RW, existing system dirs Read.
- Path
Guard - Allowed roots plus an absolute-path policy.
- Path
Guard Builder - Builder default policy is
AbsolutePathPolicy::Reject. - Path
Guard Deny - PreExec
Report - Owns the reaper report for one
KernelPolicy::apply_pre_exec_report.
Enums§
- Absolute
Path Policy - Policy for absolute dests. Extra roots apply to absolute inputs only.
- Agent
Lock Error - Check
Dest Error - Host composition error. Dest-deny vs PathGuard; do not parse messages.
- Dest
Deny Error - Dest
Deny Kind - Why dest-deny rejected a path. Hosts branch on this; do not parse messages.
- Extra
Root Error - Extra-root resolution. Separate from PathGuardError so hosts can match variants.
- GcDecision
- GcError
- Keep
Reason - Why a worktree must be kept. Hosts branch on this; do not parse messages.
- Kernel
Access - Access granted for one path. Hosts branch on this; do not parse messages.
- Kernel
Apply - Result of applying the jail. Hosts match the variant, not English.
- Kernel
Error - Hosts match the variant, not English. New variants are breaking for exhaustive hosts even in 0.x.
- Path
Guard Error - Path
Guard Kind - Why PathGuard rejected a path. Hosts branch on this; do not parse messages.
- Why
Constants§
- AGENT_
LOCK_ NAME - Committed dest-deny file name under the workspace.
- VERSION
- Crate version from Cargo.toml.
Functions§
- check_
command_ argv - Dest-deny each raw argv dest under
root. - check_
command_ dests - Join extracted command dests under
rootand dest-deny each. - check_
dest - Dest-deny raw; if
guardisSome, PathGuard; dest-deny resolved. - check_
dests - Refuse if any host-extracted dest leaves the workspace.
- child_
env_ deny_ names - Names
run_childstrips from the child environment. - classify_
dest - Classify one dest. Glob vs hardlink only. Does not jail
... - classify_
for_ age_ gc - Age filter then classify. Untracked trees are never age-gc’d.
- classify_
for_ age_ gc_ with_ policy - Like
classify_for_age_gc, usingpolicyfor glob-only cache name checks. - classify_
worktree - Classify keep vs reclaim (age already applied by the caller when relevant).
- classify_
worktree_ with_ policy - Like
classify_worktree, usingpolicyfor glob-only cache name checks. - collect_
doctor_ facts - Probe this machine. Uses a private temp directory, not the user
workspace, and does not plant
.envor start a user command. - collect_
workspace_ dest_ denies - Existing dest-deny files and glob directories under
workspace, including hardlink siblings. Each directory is read once per call, not once per hardlinked name. - collect_
workspace_ dest_ denies_ limited - Same as
collect_workspace_dest_denieswith a host-chosen entry cap. - default_
secret_ denies - v1 list is byte-identical to Bline
default_secret_denies(). Do not add**/.azure/**or**/.config/gh/**. - deny_
patch_ dests - Refuse if any host-extracted dest is a secret glob or hardlink sibling.
- deny_
patch_ dests_ with_ display - Like
deny_patch_dests, with a host-chosen display string per dest. - dest_
deny_ glob_ regex - Seatbelt regex for one dest-deny glob under an RW prefix.
- dest_
deny_ message - dest_
under_ root - Join a relative dest to
root. Absolute dests stay as given. - doctor_
fails - Exit 1 when the kernel is missing, Linux remount is unavailable, or Windows jail setup failed. WFP skip alone is not a failure.
- explain
- is_
denied_ child_ env - True when
namemust not be inherited by the child. - is_
env_ template_ basename - Committed dotenv templates, not live env files.
- is_
path_ denied - kernel_
supported - Whether this OS can apply a kernel jail.
- load_
agent_ lock - Load dest-deny globs from
workspace/agent.lock. - load_
agent_ lock_ file - Load dest-deny globs from an explicit path.
- open_
verified_ read check_dest, refuse directories, open for read, thenverify_post_open.- parse_
max_ age - Parse a duration token (
7d,24h,60m,30s). Number must be> 0. Does not peel quotes. Hosts strip'7d'/"7d"first. - path_
is_ denied_ glob - path_
is_ denied_ under_ root - Glob match for
pathrelative torootwhenrootis set. - path_
matches_ deny_ glob - process_
jail - Build a process-jail policy. Does not apply it.
- process_
jail_ with_ policy - Same as
process_jailwith a hostDenyPolicy. - reject_
command_ secret_ path_ tokens - Argv / command token scan. Does not parse a full shell.
- remove_
explicit - Remove one worktree after the unique-work check.
- remove_
explicit_ with_ policy - Like
remove_explicit, usingpolicyfor glob-only cache name checks. - require_
applied - Refuse a userspace-only inspect result on the spawn path.
- require_
dest_ hide - Refuse a spawn when Linux dest-deny remount did not hide in-tree dests.
- resolve_
extra_ root - Resolve one extra write dir against
cwd. Fail closed on missing, not-a-dir, canonicalize failure, the current user’s home directory, or implicit escape to/or host temp unless the caller named that root explicitly. A subdirectory of home (for example~/.cache) is still allowed. - resolve_
extra_ root_ pair - Same as
resolve_extra_root, plus the absolute path before canonicalize. - resolve_
workspace_ root - Resolve
--rootagainstcwd. Must exist and be a directory. A relative../wsbecomes the absolute workspace, not a PathGuard escape. Implicit canonicalize to/or the host temp root is refused unless asked. - run_gc
- Age-gc registered worktrees under
leftover_dir. Skip the primary checkout, locked worktrees, and a live cwd. A registered worktree outsideleftover_diris left alone. Untracked directories underleftover_dirare Keep(UntrackedWorktree) and never removed. - run_
gc_ with_ policy - Like
run_gc, usingpolicyfor glob-only cache name checks. - scrub_
child_ command - Remove denied inherited names. An explicit
cmd.envis kept, except loaders. - spawn_
after_ setup - Call
spawnonly when token or job setup succeeded. - validate_
deny_ glob - Gitignore-style dest-deny glob subset.
- verify_
post_ open - Unix inode/dev; Windows file index + volume serial. Re-runs hardlink dest-deny when nlink / nNumberOfLinks > 1.
- with_
bash_ noprofile - Insert
--noprofileand--norcafter argv0 when the program is bash. - worktree_
last_ used - Newest of HEAD committer time (
git log -1 --format=%ct), index mtime, and a bounded tree walk. Git CLI, not gix. - write_
timeout_ notice - The deadline line. A full
2>&1pipe must not block this write.