Skip to content

fix(security): kubeconform and checkov are pinned and their adapters read what those tools write, or the adapters go #2214

Closed

Description

@dan-petty

Problem

The kubeconform and Checkov adapters are in the scanner registry (security/registry.py), and devops scan iac, devops k8s audits and the review use them. But neither tool is in src/devops_cli/tools_lock/tools.lock, devops install-tools does not install them, and command -v finds neither in the devcontainer (2026-10-25). Both adapters set has_builtin_patterns = True. So every scan runs the hand-written fallback checks (_run_native_fallback_k8s_validation in security/kubeconform.py, _run_native_fallback_iac_checks in security/checkov.py) and never the tool.

When a person installs a tool by hand, the adapter misreads its output (moved here from #1434 on 2026-10-25):

  • kubeconform. _parse_kubeconform_line (security/kubeconform.py) expects one JSON object per line, with status set to invalid or error. -output json writes one object, {"resources": [...]}, whose statuses are statusInvalid and statusError [sourced: kubeconform README].
  • Checkov. _parse_checkov_check (security/checkov.py) infers the severity from the check name. "LOW" in check_name.upper() also matches "ALLOW", and the JSON severity field is ignored.

kubeconform reads its schemas from a URL by default [sourced: kubeconform README, -schema-location]. A review runs its tools in a network-less sandbox (#2096), so a pinned kubeconform also needs its schemas fetched before the run, as the OSV and Trivy databases are.

Proposed remedy

Decide one of these, with the evidence:

  1. Pin both tools in tools.lock (kubeconform as a binary with a SHA-256 for each platform, Checkov as a Python tool with hashed requirements, as Semgrep and Bandit are). Fetch the kubeconform schemas before the sandboxed run. Fix both parsers against recorded runs, and delete the hand-written fallbacks.
  2. Delete the adapters and their fallbacks, if Trivy's misconfiguration scan and kube-linter, which are pinned, cover the same checks. kubeconform's schema validation has no pinned equivalent today.

Existing Tool Considered

kubeconform (https://github.com/yannh/kubeconform), Checkov (https://github.com/bridgecrewio/checkov), Trivy misconfiguration scanning and kube-linter (both pinned).

Acceptance criteria

  • Each tool the scanner registry names is in tools.lock, or its adapter is deleted.
  • A kubeconform report recorded at the pinned version yields one HIGH finding for each statusInvalid or statusError resource, and none for statusValid or statusSkipped.
  • A Checkov check named "... allow ingress ..." with severity: HIGH is reported HIGH, and a check with severity: null gets a fixed default.
  • No adapter keeps a hand-written fallback for a tool that is pinned.
  • Tests run offline on recorded output; each new test runs under 1 s.

Related: #1434 (the Pluto, Popeye and Gitleaks parts), #1142 (tools lock), #2096 (network-less review sandbox).

Proposed design

Problem statement

The kubeconform and Checkov adapters in the scanner registry are never exercised because neither tool is pinned in tools.lock nor installed by devops install-tools. Every scan falls through to hand-written fallback checks. When a person installs a tool manually, the adapters misparse its output: the kubeconform parser expects per-line JSON with status invalid or error, but the tool writes one object with statusInvalid and statusError. The Checkov parser infers severity from the check name, which misclassifies checks containing the word ALLOW, and ignores the JSON severity field.

Acceptance criteria

  • Criterion 1: Each tool the scanner registry names is in tools.lock, or its adapter is deleted.
    Verification: Run devops install-tools --check --target-dir /tmp/tools and confirm kubeconform and checkov are present, or confirm the adapter files are removed from src/devops_cli/security/.
  • Criterion 2: A kubeconform report recorded at the pinned version yields one HIGH finding for each statusInvalid or statusError resource, and none for statusValid or statusSkipped.
    Verification: Run uv run pytest tests/test_security_kubeconform.py -v and confirm the recorded-output test passes with the expected finding count and severity.
  • Criterion 3: A Checkov check named containing the word allow with severity HIGH is reported HIGH, and a check with severity null gets a fixed default.
    Verification: Run uv run pytest tests/test_security_checkov.py -v and confirm the recorded-output test asserts the correct severity for both cases.
  • Criterion 4: No adapter keeps a hand-written fallback for a tool that is pinned.
    Verification: Run grep -n _run_native_fallback src/devops_cli/security/kubeconform.py src/devops_cli/security/checkov.py and confirm no matches remain.
  • Criterion 5: Tests run offline on recorded output; each new test runs under 1 second.
    Verification: Run uv run pytest tests/test_security_kubeconform.py tests/test_security_checkov.py --durations=10 with no network access and confirm all tests pass and each duration is under 1 s.

Key questions

  • Which option to take: pin both tools and fix parsers, or delete both adapters and their fallbacks?: Pin both tools and fix the parsers. The issue body states that kubeconform's schema validation has no pinned equivalent today, so deleting the adapter would lose a check that no other pinned tool provides. Checkov's IaC checks overlap with Trivy, but pinning Checkov preserves the adapter's coverage and avoids a coverage gap during the transition. (proposed)
  • Does Trivy's IaC scan and kube-linter cover kubeconform's schema validation?: No. The issue body states explicitly: kubeconform's schema validation has no pinned equivalent today. Trivy is described as an IaC scanner and kube-linter as a static K8s manifest linter, but neither performs schema validation against the Kubernetes API schemas the way kubeconform does. [sources: src/devops_cli/tools_lock/tools.lock]
  • What format does kubeconform -output json actually produce?: One JSON object with a top-level resources array. Each resource has a status of statusValid, statusInvalid, statusError, or statusSkipped. The current parser expects one JSON object per line with a status field set to invalid or error, which does not match. [sources: src/devops_cli/security/kubeconform.py:131]
  • How should Checkov severity be determined?: Read the severity field from the JSON output directly. The current parser infers severity from the check name using a substring match on LOW, which also matches ALLOW and other words. The JSON severity field is the authoritative source. [sources: src/devops_cli/security/checkov.py:308]
  • What is the fixed default severity for a Checkov check whose severity field is null?: MEDIUM. This is a reasonable middle default that avoids over-reporting (LOW) or under-reporting (HIGH) when the tool does not assign a severity. A person can adjust this in the implementation if a different default is preferred. (proposed)
  • How are OSV and Trivy databases fetched before the sandboxed run, so that kubeconform schemas can use the same mechanism?: The issue body states that a pinned kubeconform needs its schemas fetched before the run, as the OSV and Trivy databases are. This implies an existing pre-fetch step in the review pipeline that downloads tool databases before the network-less sandbox runs. The kubeconform schema fetch should be added to that same step. [sources: src/devops_cli/tools_lock/tools.lock]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/security
    on Oct 25, 2026
  2. dan-petty commented on Oct 25, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.

    • Type: type/security. The candidate deals with security scanning tools and their configurations.
    • Priority: P1-High. Security tools must be properly pinned and their outputs correctly parsed to avoid false positives or negatives.
    • Value: High. Fixing security tool integrations improves overall project security posture and scan accuracy.
    • Effort: Medium. Requires pinning tools, fixing parsers, and updating tests to reflect new behavior.
    • Related: fix(security): the pluto, popeye and gitleaks adapters read what those tools actually write #1434, which asks for a different change. Both items fix adapters that read tool outputs, but the candidate focuses on pinning tools and fixing parsers while #1434 addresses Pluto, Popeye and Gitleaks adapters.
  3. dan-petty commented on Oct 27, 2026

    @dan-petty
    OwnerAuthor

    Status set to Ready at 520e8b8 (see proposed design in issue body).

  4. added a commit that references this issue on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    source/agenttype/security

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions