Write a rule without writing Go
A rule names the resources it applies to and describes the bad condition as a query. Drop the file in a rules directory and it loads on the next scan.
StackGuard scans Terraform, Kubernetes, Helm, Docker and CI pipelines against policy as code, then scores every result.
One scanner for the whole stack
Every file becomes a normalized resource, every rule is compiled once, and positions travel with the data so each finding points at the exact line.
No plugin SDK and no embedded scripting language. Rules are YAML, results are a number your pipeline can gate on.
A rule names the resources it applies to and describes the bad condition as a query. Drop the file in a rules directory and it loads on the next scan.
Compose, Dockerfile, Kubernetes, Helm, Terraform, Actions, Jenkins, Ansible and nginx.
Gate on severity, gate on score, or both. The exit code does the rest.
Human output for the terminal, SARIF for code scanning, JSON for everything else.
Rules
Rules carry the message, the reason and the fix, so the output explains itself and tells the reader what to do next.
id: TF_SEC_001 title: Public S3 bucket ACL severity: ERROR category: security target: terraform resource: [resource.aws_s3_bucket, resource.aws_s3_bucket_acl] message: "{{ .Resource.Name }} grants a public ACL ({{ .Value }})" remediation: | Use acl = "private" and enable aws_s3_bucket_public_access_block. query: path: acl regex: '^(public-read|public-read-write|authenticated-read)$'
acl = "private" and enable aws_s3_bucket_public_access_block.
One step scans, gates and uploads to GitHub code scanning. No service to run and nothing to host.
# fail the PR on errors, and on a score under 80 - name: StackGuard run: > stackguard scan . --fail-on error --min-score 80 --format sarif --output stackguard.sarif - uses: github/codeql-action/upload-sarif@v3 with: sarif_file: stackguard.sarif
Code 1 when a finding reaches your severity floor, or when the score drops below min_score.
SARIF annotations point at the exact line, so reviewers see the issue in the diff instead of a log.
An inline stackguard:ignore comment suppresses a rule and the count shows up in the report.
Install the binary, scan a path, and reach for the sub-commands when you need them. Five commands cover the whole surface. The full reference lives in the docs.
A single static binary. No runtime and no daemon.
$ go install \
github.com/nexutils/StackGuard/cmd/stackguard@latest
$ brew install nexutils/tap/stackguard
> scoop bucket add nexutils \
https://github.com/nexutils/scoop-bucket
> scoop install stackguard
Point it at your repo. It detects every target it knows.
$ stackguard scan .
Fail on errors, or on a score below your threshold.
$ stackguard scan . \
--fail-on error --min-score 80
Scan files or directories for issues and emit a report.
Print the production-readiness score, and nothing else.
List the available rules, or validate a rule directory.
Show the details, reason and remediation for one rule.
Print the StackGuard version and build information.
--config
--log-level
-v, --verbose
--no-color
Install the binary, point it at a directory, and read the score. Add the CI step once you trust the output.
Then: stackguard scan .