Testland
Browse all skills & agents

kics-policy

Configures KICS (Keeping Infrastructure as Code Secure), Checkmarx's scanner covering Terraform, Kubernetes, Helm, Dockerfile, OpenAPI, Ansible, ARM, CloudFormation, Pulumi, Crossplane - CLI / Docker / GitHub Action / pre-commit, JSON / SARIF / HTML / JUnit output, custom Rego queries. Use for the widest platform breadth, especially OpenAPI / Pulumi / Crossplane; for the broadest built-in checks with Python custom rules use checkov-policy, for Terraform-only scanning use tfsec-policy, and for a consolidated scanner use trivy-config.

Install with skills.sh (any agent)

npx skills add testland/qa --skill kics-policy
View source

kics-policy

Overview

KICS (Keeping Infrastructure as Code Secure) is Checkmarx's IaC scanner. Its distinctive strengths vs sister scanners:

  • OpenAPI scanning (uncommon in other IaC scanners).
  • Pulumi + Crossplane support (Checkov has Pulumi too; KICS broader).
  • Lightweight Docker image; portable in restricted CI.

When to use

  • Need OpenAPI security scanning (security misconfigs in API specs).
  • Pulumi / Crossplane stack.
  • Want a third opinion alongside Checkov + tfsec (different rules catch different things).

Step 1 - Install

Docker is the primary install path per the KICS getting-started docs (opens in new window); there is no install script.

docker pull checkmarx/kics:latest

For a version-pinned binary install, see the Pinned versions + binary-install section in references/kics-policy.md.

Step 2 - Run

# Scan a directory (Docker)
docker run -v "$PWD:/path" checkmarx/kics scan -p /path --output-path /path/results

# Or via binary
kics scan -p . --output-path ./kics-results

# Specific platform
kics scan -p . -t terraform,kubernetes

Step 3 - Output formats

# JSON
kics scan -p . --report-formats json --output-path results/

# SARIF (GitHub Code Scanning)
kics scan -p . --report-formats sarif --output-path results/

# JUnit XML
kics scan -p . --report-formats junit --output-path results/

# HTML (human-readable)
kics scan -p . --report-formats html --output-path results/

# Multiple
kics scan -p . --report-formats json,sarif,html --output-path results/

Step 4 - Severity threshold

# Fail only on HIGH+
kics scan -p . --fail-on high,critical

# Don't fail; just report
kics scan -p . --no-progress --silent

Step 5 - Skip checks

In code:

# main.tf
resource "aws_s3_bucket" "public_data" {
  # kics-scan ignore-line
  acl    = "public-read"
  bucket = "my-public-data"
}

For block-level:

# kics-scan disable=15ffbacc-fa42-4f6f-a57d-2feac7365caa
resource "aws_s3_bucket" "public_logs" {
  acl    = "public-read"
  bucket = "my-public-logs"
}

The disable directive references the specific KICS query ID (visible in the output).

Step 6 - Custom queries (Rego)

KICS queries are written in Rego (same as OPA). Point KICS at a query directory with -q:

kics scan -p . -q ./custom-queries/

For a full query template (package Cx + CxPolicy[result]), see references/kics-policy.md.

Step 7 - CI integration

jobs:
  kics:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: checkmarx/kics-github-action@v2
        with:
          path: .
          fail_on: high,critical
          output_formats: sarif
          output_path: kics-results.sarif
      - uses: github/codeql-action/upload-sarif@v3
        if: always()
        with:
          sarif_file: kics-results.sarif

Step 8 - OpenAPI scanning

KICS's distinguishing feature: scan OpenAPI specs for security issues:

kics scan -p ./api-spec.yaml -t openapi

Catches:

  • Missing authentication on sensitive endpoints.
  • Weak HTTP methods (PUT / DELETE without auth).
  • Missing rate-limit headers.
  • Unrestricted file upload endpoints.

For most teams, this is the unique reason to use KICS alongside Checkov.

Step 9 - Pulumi / Crossplane

kics scan -p ./pulumi-project/ -t pulumi
kics scan -p ./crossplane-config/ -t crossplane

For Pulumi shops, KICS provides scanning that Checkov / tfsec don't.

Anti-patterns

See the anti-patterns table in references/kics-policy.md - covers KICS as the only scanner, unjustified ignore-line, skipping --fail-on in CI, full-output noise, and untested custom queries.

Limitations

  • Dockerized usage adds CI complexity. Smaller teams prefer binary install.
  • Per-platform rule depth varies. Some platforms (Pulumi, Crossplane) have fewer rules than Terraform / K8s.
  • Maintenance pace varies per platform. Newer Crossplane releases may not be covered immediately.
  • Custom query learning curve. Rego is the language; same curve as OPA.

References

  • KICS at kics.io and github.com/Checkmarx/kics.
  • checkov-policy, tfsec-policy - sister scanners.
  • policy-as-code-runner - custom OPA / Rego.

kics-policy - deep reference

View source (opens in new window)

kics-policy - deep reference

Detail moved out of the SKILL.md spine to keep the core scan flow lean.

Pinned versions + binary install

Docker (docker pull checkmarx/kics:latest) is the primary path and carries no version pin. For a binary install, download the version-stamped release archive (v2.1.20 is the latest release as of 2026-07-20 - bump this pin when updating):

curl -sfL -o kics.tar.gz \
  https://github.com/Checkmarx/kics/releases/download/v2.1.20/kics_2.1.20_linux_amd64.tar.gz
tar -xzf kics.tar.gz && sudo mv kics /usr/local/bin/

Custom queries (Rego) - full template

KICS queries are written in Rego (same as OPA). A query lives in its own directory and uses the Cx package with a CxPolicy[result] rule:

# custom-queries/aws/cost_center_tag/query.rego
package Cx

CxPolicy[result] {
    resource := input.document[i].resource.aws_instance[name]
    not resource.tags.cost_center
    result := {
        "documentId": input.document[i].id,
        "searchKey": sprintf("aws_instance[%s]", [name]),
        "issueType": "MissingAttribute",
        "keyExpectedValue": "Should have a cost_center tag",
        "keyActualValue": "tags.cost_center is missing",
    }
}

Point KICS at the directory:

kics scan -p . -q ./custom-queries/

Anti-patterns

Anti-patternWhy it failsFix
KICS as only IaC scannerMisses Checkov / tfsec-specific findings.Use multiple scanners; combine results (CI step).
kics-scan ignore-line without comment justifyingSkips invisible.Always include reason.
Skipping --fail-on severity in CIAll findings (including LOW) fail; team disables.Start --fail-on high,critical.
Running on every PR with full outputOutput overwhelming; team ignores.Severity threshold + JSON/SARIF for triage.
Custom queries without testsBugs let bad config through.Test custom queries via OPA test pattern.

Related skills

checkov-policy

Configures Checkov for IaC security scanning across Terraform, CloudFormation, Kubernetes, Helm, ARM, Serverless, AWS CDK - `pip install checkov`, custom Python checks, SARIF / JUnit output, and `--baseline` gating so CI fails only on new findings in legacy code. Use for the broadest built-in rule set with Python custom checks; for Terraform-only scanning use tfsec-policy, for wider platform breadth (OpenAPI / Pulumi / Crossplane) use kics-policy, and for a consolidated new-project scanner use trivy-config.

helm-chart-tester

Configures helm-unittest for Helm chart unit testing - installs the `helm-unittest` plugin, authors `tests/*.yaml` per template, asserts on rendered manifests (`isKind`, `equal`, `matchRegex`, snapshots), plus `helm lint` and `helm template` render testing. Use to verify a chart's template logic and rendered shape; this is unit-level correctness testing, not security scanning - to enforce policy on rendered manifests use policy-as-code-runner, and to scan charts for misconfigurations use checkov-policy or kics-policy.

policy-as-code-runner

Configures policy-as-code testing using OPA / Conftest / Cedar - authors policies in Rego (OPA's language), runs Conftest against Kubernetes manifests / Terraform plans / Dockerfiles / arbitrary structured data, integrates with CI for PR-time policy gates. Per OPA's docs: "an open source, general-purpose policy engine that unifies policy enforcement across the stack." Use to express + enforce custom policies (cost limits, tagging requirements, security baselines) that Checkov / tfsec / KICS don't cover.

tfsec-policy

Configures tfsec for Terraform-specific security scanning - covers AWS / Azure / GCP / Kubernetes / OpenStack / Oracle / DigitalOcean / CloudStack, custom YAML rules, and SARIF / JUnit / Markdown output. Note: tfsec is transitioning to Trivy per Aqua Security, so new projects evaluate that first. Use for an existing Terraform-only tfsec stack; for the consolidated forward-path scanner use trivy-config, for the broadest multi-framework checks use checkov-policy, and for wider platform breadth use kics-policy.

trivy-config

Runs Trivy's misconfiguration scanner (`trivy config`) against IaC directories to detect security issues across Terraform, CloudFormation, Kubernetes manifests, Helm charts, Dockerfiles, and Azure ARM templates - installs Trivy, scans with severity gating via `--exit-code`, suppresses findings via `.trivyignore` / `.trivyignore.yaml` or inline annotations, extends built-in checks with custom Rego policies, and emits SARIF for GitHub Code Scanning. Trivy is the forward path from tfsec (per Aqua Security's own migration guidance). Use when adopting a consolidated IaC scanner for new projects, migrating away from tfsec, or scanning mixed IaC stacks with a single tool.