Skip to main content

Crate keel_enforce

Crate keel_enforce 

Source
Expand description

Enforce: turn a keel_policy::Policy into a real execution boundary.

Backends:

  • NullBackend — records + soft checks only
  • ProcessGuardBackend — soft process spawn / FS guard
  • LocalProcessBackend — Landlock (Linux) / Seatbelt (macOS) via nono; default isolate_apply sandboxes children only (host stays clean). Linux read-deny uses bubblewrap bind-over.

Structs§

BackendInfo
EgressProxy
Running egress proxy bound to 127.0.0.1.
LocalProcessBackend
Landlock / Seatbelt enforce backend.
LocalProcessOptions
Options for LocalProcessBackend.
MapOptions
Options when mapping policy → kernel capabilities.
NullBackend
ProcessGuardBackend
ResolvedCredential
A resolved secret ready to inject (kept out of Debug).
SpawnRequest
SpawnedProcess
WorktreeBackend
Worktree isolation backend (optionally layered on another backend).
WorktreeOptions
Options for WorktreeBackend.

Enums§

CredentialSourceKind
How a grant source is interpreted.
EnforceError

Constants§

DENY_GLOB_MAX_MATCHES
Maximum matches per glob (fail closed if exceeded under require_kernel).
EGRESS_PROXY_PORT_ENV
Env var: proxy port written for child pre_exec / kernel ProxyOnly mode.

Traits§

EnforceBackend
A live enforcement context for one space.

Functions§

apply_kernel_here
Apply Landlock/Seatbelt for the current process (call only in child / helper).
apply_policy_file_and_ready
Load policy JSON from path and apply (used by keel sandbox-exec).
expand_deny_globs
Expand policy deny globs to concrete paths under the workspace (and absolute roots).
glob_to_seatbelt_regex
Translate a gitignore-style glob to a Seatbelt-oriented regex (anchored).
grant_names
Snapshot grant names for recording without secret values.
inject_into_env
Merge resolved credentials into a spawn env list (does not overwrite existing keys).
local_process
Local-process only (no worktree).
path_matches_deny_glob
Soft check: does path match any deny glob in the policy?
policy_to_capability_set
Build a nono capability set from a Keel policy.
prepare_kernel
Validate that the policy can be mapped and the platform supports sandboxing.
process_guard
Soft process-guard only.
resolve_credentials
Resolve all grants on a policy. Missing optional sources are skipped with a warning unless strict is true.
revoke_resolved
Zeroize-ish drop helper: overwrite strings then drop.
worktree_sandboxed
Worktree + LocalProcess (kernel FS on children) — closest to Grok’s “isolated tree + OS sandbox” stack for coding agents.
worktree_soft
Worktree isolation only (soft process-guard inside).
write_spawn_policy_file
Write policy JSON for child spawn; returns path.

Type Aliases§

EnforceResult