Repository navigation
Version 2 rulebooks can now declare which command options take a value, and a rulebook's fixtures are checked the way the hook actually reads a command.
Added
- Added
options_with_valuestorulebook_version2 rulebooks, declared once per command at the rulebook level, so a rule'scommand_pathstill matches when a value-taking option comes first: with"options_with_values": { "kubectl": ["-n", "--namespace", "--context"] },kubectl -n payments delete pod apinow matches"command_path": ["delete"]. Declared options add to the built-in AWS, gcloud, and Azure CLI tables. (#374, #369) - Added validation for the new key: each key must be the
commandof a rule, and each value a non-empty list of unique options that start with-. Arulebook_version1 rulebook that carries it is rejected, and a list placed inside a rule'smatchis reported as belonging at the rulebook level. An older client ignores the key, so it keeps missing those commands, and it refuses a rulebook whoseblockedfixture depends on a declared option.
Changed
- Changed which fixtures pass as a result of the new evaluation: a function that is defined and never called no longer counts as blocked, a
blockedfixture that a built-in rule blocks first now fails and names that rule (for examplerm -rf /), and an empty or comment-only fixture reportsno rule matchedin place ofcould not parse. Configuredtransparent_wrappersare still not applied, so a rulebook verifies the same for everyone who adds it. - Improved
rule docto documentoptions_with_valuesand how version 2 fixtures are evaluated.
Fixed
- Fixed
rule verify,rule add, andrule updaterejecting a version 2 rulebook whose fixture used a wrapped spelling the hook does block. Each fixture now runs through the same analyzer the hook uses, against that rulebook's rules only, sosudo docker system prune,env FOO=1 docker system prune,timeout 30 docker system prune, andbash -c 'docker system prune'are validblockedfixtures. (#375, #372)
Security
- Fixture evaluation no longer touches the filesystem, so a fetched rulebook cannot make the CLI read a path its fixtures name. A fixture that runs a script by path, such as
bash deploy.sh, is judged on its command line alone. The hook reads scripts exactly as before.