rules/README.md
This directory is a development and validation area for policy rules that are maintained alongside Kubescape. It is not a policy source for normal scans. Kubescape obtains the controls and frameworks used by default scans from the regolibrary, so merging a rule here does not publish it to users.
Each rule directory contains raw.rego, rule.metadata.json, and test cases
under test/<case>/. A test case has Kubernetes manifests in input/ and the
expected rule responses in expected.json.
Run all in-tree fixtures with:
go run . policy test ./rules
To iterate on one rule, pass its directory instead:
go run . policy test ./rules/<rule-name>
The Go test suite runs the full-directory command, so a pull request fails CI when an in-tree rule no longer matches its fixtures.
To make an in-tree rule available to default scans:
rules/<rule-name> directory in
kubescape/regolibrary.rulesNames field and include that control in any intended frameworks.The rule becomes part of Kubescape's default policy data only after the regolibrary change is merged and published.