feat(guard): make command allowances configurable - #286
Merged
Conversation
Replace the built-in development-tool whitelist with eval-authored tool and command allowances plus composable packaged profiles. Auto-detect profiles only when no explicit guard policy is present. Freeze the expanded policy into dispatch tasks and guard markers so live enforcement and stray-write auditing make the same decision, while keeping containment checks non-overridable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #259.
Summary
This PR makes the following changes:
guardpolicies.Strategy
The ticket identifies false positives from applying command-text heuristics to realistic development work. Making each common tool a special case would address the immediate examples, but it would also make eval-magic responsible for predicting every build system, package manager, and project-specific workflow an eval might need.
This change separates two concerns:
teetargets, remote Git mutations, repository-routing escapes, and recognized package or build destinations are checked before any allowance. Relative and implicit destinations resolve from the tool invocation cwd. An eval cannot configure its way around this boundary.allow_tools, narrow token prefixes withallow_commands, or include packagedprofiles. A claimed tool has unmatched subcommands denied, while commands outside the recognized development-command surface remain best-effort rather than turning the guard into an incomplete shell allowlist.Configuration can be declared once at the top level or replaced per eval. Replacement is intentional: a narrow per-eval policy should not accidentally inherit broader config-level permissions. Even an empty per-eval object is meaningful and disables both the config default and automatic profile detection.
When no explicit
guardblock exists, eval-magic recursively detects and joins packaged profiles from the fully staged task tree. Packaged profiles cover Rust, JavaScript, Next.js, and Python. They live as TOML files underguard-profiles/and are discovered by the build script, so additional languages or framework-specific defaults do not require editing a central Rust registry.The effective policy is expanded before execution. The complete policy is recorded on each
dispatch.jsontask and copied into the armed guard marker.detect-stray-writesreads that frozen task policy instead of redetecting the project later, keeping live denials and post-run evidence on the same decision path even if task files change during the eval.Configuration examples
Allow every Cargo invocation for a Rust maintenance eval:
{ "guard": { "allow_tools": ["cargo"] } }Allow only the lifecycle commands expected by a Next.js eval:
{ "guard": { "allow_commands": [ "npm run dev", "npm run build", "npm run start" ] } }With no explicit block, a task tree containing a Next.js frontend and Python backend composes
language/javascript,framework/nextjs, andlanguage/pythonautomatically.Verification
The following checks pass:
cargo fmt --checkcargo buildcargo test --quiet— 1,253 tests passedcargo clippy --all-targets -- -D warningscargo package --allow-dirtygit diff --check origin/dev