github kenryu42/cc-safety-net v2.8.1

37 minutes ago

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_values to rulebook_version 2 rulebooks, declared once per command at the rulebook level, so a rule's command_path still matches when a value-taking option comes first: with "options_with_values": { "kubectl": ["-n", "--namespace", "--context"] }, kubectl -n payments delete pod api now 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 command of a rule, and each value a non-empty list of unique options that start with -. A rulebook_version 1 rulebook that carries it is rejected, and a list placed inside a rule's match is reported as belonging at the rulebook level. An older client ignores the key, so it keeps missing those commands, and it refuses a rulebook whose blocked fixture 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 blocked fixture that a built-in rule blocks first now fails and names that rule (for example rm -rf /), and an empty or comment-only fixture reports no rule matched in place of could not parse. Configured transparent_wrappers are still not applied, so a rulebook verifies the same for everyone who adds it.
  • Improved rule doc to document options_with_values and how version 2 fixtures are evaluated.

Fixed

  • Fixed rule verify, rule add, and rule update rejecting 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, so sudo docker system prune, env FOO=1 docker system prune, timeout 30 docker system prune, and bash -c 'docker system prune' are valid blocked fixtures. (#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.

Don't miss a new cc-safety-net release

NewReleases is sending notifications on new releases.