Skip to main content

Module safe_command_registry

Module safe_command_registry 

Source
Expand description

Safe command registry: defines which commands and subcommands are safe to execute.

This module implements the “safe-by-subcommand” pattern from Codex: Instead of blocking entire commands, we maintain granular allowlists of safe subcommands and forbid specific dangerous options.

Example:

git branch     ✓ safe (read-only)
git reset      ✗ dangerous (destructive)
git status     ✓ safe (read-only)

find .         ✓ safe
find . -delete ✗ dangerous (has -delete option)

cargo check    ✓ safe (read-only check)
cargo clean    ✗ dangerous (destructive)

Structs§

CommandRule
A rule for when a command is safe
SafeCommandRegistry
Registry of safe commands and their safe subcommands/options

Enums§

SafetyDecision
Result of a command safety check