Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Safety Levels

Every allowed command is classified into one of three safety levels:

LevelDescriptionExamples
inertPure read/display, no code executioncat, grep, ls, git log
safe-readExecutes code but read-onlycargo test, rspec, npm test
safe-writeMay modify files but considered safecargo build, go build

Use --level to set a threshold. Only commands at or below the threshold pass:

safe-chains --level inert "cat foo"          # exit 0 (inert <= inert)
safe-chains --level inert "cargo test"       # exit 1 (safe-read > inert)
safe-chains --level safe-read "cargo test"   # exit 0 (safe-read <= safe-read)
safe-chains --level safe-read "cargo build"  # exit 1 (safe-write > safe-read)

Without --level, the default threshold is safe-write (all allowed commands pass).

Levels propagate through pipelines, wrappers, and substitutions — a pipeline’s level is the maximum of its components.