Skip to content

fix(security): tflint and dive are pinned in tools.lock, or their adapters and the tflint fallback go #2427

Closed

Description

@dan-petty

Problem

The tflint and dive adapters are in the scanner registry (security/registry.py), and devops scan report runs every scanner of the registry. 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-28).

  • tflint. The adapter sets has_builtin_patterns = True. With no tflint on PATH, each scan runs the hand-written check _run_native_fallback_tf_lint in security/tflint.py, which reads each .tf file line by line for a security group open to 0.0.0.0/0. The scan status is then built-in patterns: a hand-written check, not tflint.
  • dive. The adapter has no fallback, so each scan with no dive on PATH is unavailable.

The fix of #2214 made the same decision for kubeconform (pinned, fallback deleted) and Checkov (adapter deleted, Trivy's misconfiguration scan trivy-config in its place). It did not change tflint and dive.

Proposed remedy

Decide one of these for each tool, with the evidence:

  1. Pin the tool in tools.lock as a binary with a SHA-256 for each platform, as kubeconform and Pluto are. Record a run at the pinned version, fix the parser against it, and delete the hand-written fallback of tflint.
  2. Delete the adapter, if a pinned tool covers its checks. Trivy 0.75.0's misconfiguration scan (trivy config, pinned) reported an ingress rule from 0.0.0.0/0 to port 22 as AWS-0107 (HIGH), but it reported nothing for the same rule to port 8080. The tflint fallback reports both.

Existing Tool Considered

tflint (https://github.com/terraform-linters/tflint), dive (https://github.com/wagoodman/dive), and Trivy's misconfiguration scan (pinned).

Acceptance criteria

  • Each tool the scanner registry names is in tools.lock or is a pinned dev dependency, or its adapter is deleted.
  • No adapter keeps a hand-written fallback.
  • Each pinned tool has a run with findings recorded at the pinned version in tests/fixtures/scanner_runs/runs_with_findings.json.
  • Tests run offline on recorded output; each new test runs under 1 s.

Related: #2214 (kubeconform and Checkov), #1142 (tools lock).

Source: #2214

Proposed design

Problem statement

The tflint and dive adapters are in the scanner registry, but neither tool is in tools.lock. Without tflint on PATH, each scan runs a hand-written fallback that only checks one rule. Without dive on PATH, each scan is unavailable. The fix of #2214 pinned kubeconform and deleted the Checkov adapter, but it did not change tflint or dive.

Acceptance criteria

  • Criterion 1: Each tool the scanner registry names is in tools.lock or its adapter is deleted.
    Verification: Run grep -c 'tflint\|dive' src/devops_cli/tools_lock/tools.lock and confirm both appear, or confirm their adapters are absent from security/registry.py.
  • Criterion 2: No adapter keeps a hand-written fallback.
    Verification: Run grep -rn '_run_native_fallback' src/devops_cli/security/ and confirm no results.
  • Criterion 3: Each pinned tool has a run with findings recorded at the pinned version in tests/fixtures/scanner_runs/runs_with_findings.json.
    Verification: Run python -c "import json; d=json.load(open('tests/fixtures/scanner_runs/runs_with_findings.json')); print(list(d.keys()))" and confirm tflint and dive are present with a version field matching tools.lock.
  • Criterion 4: Tests run offline on recorded output and each new test runs under 1 second.
    Verification: Run uv run pytest tests/test_tools_lock.py tests/test_install_tools.py -x --timeout=1 and confirm all pass.

Key questions

  • For tflint, pin it in tools.lock or delete its adapter?: Pin tflint in tools.lock. Trivy 0.75.0 does not report a 0.0.0.0/0 rule to port 8080, but the tflint fallback reports both. No pinned tool covers all tflint checks. (proposed)
  • For dive, pin it in tools.lock or delete its adapter?: Pin dive in tools.lock. No pinned tool in tools.lock performs container image layer analysis. Trivy performs vulnerability scanning, which is a different check. (proposed)
  • Is tflint currently in tools.lock?: No. The tools.lock file lists kubectl, kustomize, helm, argo, argocd, cloudflared, kubectl-argo-rollouts, trivy, kube-linter, popeye, pluto, k9s, gh-dash, tuicr, gitleaks, osv-scanner, golangci-lint, semgrep, bandit, openspec, and devcontainers-cli. tflint is absent. [sources: src/devops_cli/tools_lock/tools.lock]
  • Is dive currently in tools.lock?: No. The tools.lock file does not contain a dive entry. [sources: src/devops_cli/tools_lock/tools.lock]
  • Does the tflint adapter have a hand-written fallback?: Yes. The function _run_native_fallback_tf_lint at line 92 of src/devops_cli/security/tflint.py reads each .tf file line by line for a security group open to 0.0.0.0/0. [sources: src/devops_cli/security/tflint.py:92]
  • Does Trivy 0.75.0 cover all tflint security group checks?: No. Trivy reported a 0.0.0.0/0 rule to port 22 as AWS-0107 (HIGH), but reported nothing for the same rule to port 8080. The tflint fallback reports both. [sources: src/devops_cli/tools_lock/tools.lock]
  • What did fix(security): kubeconform and checkov are pinned and their adapters read what those tools write, or the adapters go #2214 do for kubeconform and Checkov?: It pinned kubeconform in tools.lock and deleted its fallback. It deleted the Checkov adapter and used Trivy's misconfiguration scan (trivy config) in its place. [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 28, 2026
  2. dan-petty commented on Oct 28, 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 fix ensures security scanners are properly installed and removes a weaker hand-written fallback, directly affecting security scan reliability.
    • Priority: P1-High. Security scanners silently degrade to weaker checks or become unavailable, leaving vulnerabilities undetected.
    • Value: High. Users rely on these scanners for security findings; a silent fallback or missing tool undermines trust in scan results.
    • Effort: Medium. Requires pinning two tools with SHA-256 per platform, recording runs, fixing a parser, and deleting a fallback, or deleting adapters.
    • Related: fix(security): scan_uv_audit runs a uv audit adapter, and the uv pip audit command that uv does not have goes #2106, which asks for a different change. Both manage scanner adapters in the security registry, but #2106 adds a uv audit adapter while the candidate pins or removes the tflint and dive adapters.
  3. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

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

  4. added
    priority/p1-high
    status/ready
    effort/medium
    value/high
    on Oct 28, 2026
  5. added
    status/in-progress
    type/bug
    scope/security
    status/in-review
    and removed
    status/ready
    type/security
    status/in-progress
    on Oct 30, 2026
  6. removed
    status/in-review
    on Oct 30, 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

    effort/mediumpriority/p1-highscope/securitysource/agenttype/bugvalue/high

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions