Repository navigation
feat(cli): E6 approval gates — Approver trait, glob allowlist, interactive CLI - #21
Merged
Merged
Conversation
…ctive CLI Core: - Add `Approver` trait (decide per tool/risk/input, interactive marker) - `AllowlistApprover`: glob patterns, always Deny for Destructive - `ToolRegistry`: holds `Box<dyn Approver>`; refuses Destructive registration behind a non-interactive approver (structural rule) - `Tool::describe()` for human-readable approval prompts - `Risk::as_str` public for prompt labels CLI: - clap host: run/resume/status subcommands, --sessions-dir - `InteractiveApprover` (y/N over stdio, injectable PromptFn): Destructive always prompts; --allow glob and --yes cover Write only - `write_file` tool (Write risk) jailed to cwd: per-component parent walk refusing symlinks, O_NOFOLLOW leaf open via libc (TOCTOU-safe) Tests: 77 passing (6 new approval-flow e2e over the real turn loop: denied/allowed/pattern-skip/destructive-always-prompts/registry- refusal/prompt-fields), clippy clean
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
3 tasks
This was referenced Sep 22, 2026
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.
What
Approvertrait (tole-core/src/approval.rs): policy engine decoupled from hosts —decide(&ToolRequest) -> Verdict+interactive()marker.AllowlistApprovernow implements it with glob patterns (glob_match, no new deps) and enforces the PRD rule: Destructive is always Deny regardless of pattern ("cannot be allowlisted").tole-core/src/tool.rs):ToolRegistryrefuses to register a Destructive tool behind a non-interactive approver — wiring-time enforcement instead of runtime hope.tole-cli): clap withrun/resume/statussubcommands and--sessions-dir.InteractiveApproverprompts y/N over stdio (injectablePromptFnfor tests): Destructive always prompts;--allow <glob>and--yesonly ever cover Write risk.write_filetool (Write risk) jailed to the cwd: per-component parent walk that refuses symlinked components (viasymlink_metadata),O_NOFOLLOWleaf open vialibc— TOCTOU-safe against symlink escapes.Why
E6 (issue #6, Phase 2 W4) ships the approval-gate UX: the CLI is the first real consumer of
tole-coreand needs to gate Write/Destructive tools on human y/N per call, with a limited-automatic mode (--allowglobs) for trusted workflows. The PRD risk table mandates Destructive can never be auto-allowed, so the enforcement lives in three layers (trait contract, allowlist deny, interactive prompt) instead of one hope-based check.Testing
cargo test --workspace: 77/77 passing (was 71) — 6 new integration tests incrates/tole-cli/tests/approval_flow.rsover the real turn loop + JSONL storage:approval requiredrecord--allow write_*skips the prompt entirely (denying canned human never asked)--allow '*'+--yesAllowlistApproverat wiring timeToolRequestcarries tool/risk/input/description for the promptcargo clippy --workspace --all-targets: 0 warningscargo fmt: cleancora reviewon the branch diff: No issues found (2 MAJOR fixed pre-commit: TOCTOU path-jail hardening,libc::O_NOFOLLOWper-platform constant)