Skip to content

Latest commit

 

History

History
62 lines (48 loc) · 2.16 KB

CONTRIBUTING.md

File metadata and controls

62 lines (48 loc) · 2.16 KB

Contributing to KubePosture

Thanks for your interest. KubePosture is a small, dependency-light Go CLI; contributions that keep it that way are the easiest to merge.

Development setup

You need Go 1.24 or newer. The only runtime dependency is gopkg.in/yaml.v3; everything else is the standard library.

git clone https://github.com/RahilSahu/kubeposture.git
cd kubeposture
go build ./...
go test ./...

Before opening a pull request, make sure all three pass:

gofmt -l .        # prints nothing
go vet ./...
go test ./...

Project layout

  • cmd/kubeposture: the CLI (flags, file collection, exit codes).
  • internal/kube: manifest types and the multi-document YAML loader.
  • internal/rules: the rule registry. One file per rule group (container, workload, RBAC), with metadata in registry.go.
  • internal/report: table, JSON and SARIF writers.
  • testdata/: the hardened and insecure fixture manifests used by the end-to-end tests. The same files ship in examples/.

Adding a rule

  1. Pick the next free ID (KP027, and so on). IDs are stable once released; never renumber an existing rule.
  2. Write the check in the matching group file. Checks are functions over kube.Document plus the scan Context; keep them pure.
  3. Register the rule in registry.go with a severity, a CIS reference only where a benchmark control genuinely maps, and a one-line remediation that tells the user exactly what to change.
  4. Add tests: at least one manifest that triggers the rule and one that does not, in internal/rules/per_rule_test.go. Update the registry shape test count and, if the fixture manifests change, the end-to-end expectations.
  5. Add the rule to the README rule table in the same pull request.

Reporting bugs

Open an issue with the smallest manifest that reproduces the problem and the output you expected. For false positives, the manifest is essential; posture checks live and die by their edge cases.

Pull requests

  • One topic per pull request.
  • Describe the behaviour change and how you tested it.
  • Keep user-facing text free of em dashes; this is a house style rule for published text in this project.