Skip to content

fix(security): the pluto, popeye and gitleaks adapters read what those tools actually write #1434

Closed

Description

@dan-petty

Problem

Lines cited at 05e9388 (release/v0.2.29).

How each tool's output was checked:

  • Run offline against a scratch manifest: Pluto 5.24.4 and kube-linter 0.8.3.
  • Popeye 0.22.1: read from its --help and the JSON tags in its binary.
  • gitleaks: taken from its upstream documentation.

The defects:

  • Pluto. parse_pluto_json reads kind, apiVersion, replacement and filepath (security/pluto.py:27-33). Pluto writes filePath and api.{kind,version,replacement-api}. Every finding therefore reports the defaults (Resource, v1, apps/v1) and the scan target instead of the file.
  • Popeye.
    • build_popeye_cmd passes -s error,warn (config/commands.py:145), but -s is --sections (resource kinds). The level flag is -l.
    • The parser reads sanitizers (security/popeye.py:50-51). Popeye 0.22's JSON has sections and linter, so the parser returns no findings.
    • run_popeye_scan accepts namespace and never passes it to the command (:104-111, :73-81).
  • Gitleaks.
    • build_gitleaks_cmd (config/commands.py:188-195) runs detect --report-format json without --report-path. gitleaks v8 writes the report only to that path, so stdout carries no JSON, and a leak (exit 1) surfaces as a failed scan.
    • detect is also deprecated in favour of git and dir.

Scope moved out (2026-10-25)

The kubeconform and Checkov parts move to #2214, because neither tool is in tools.lock. devops install-tools does not install them, and command -v finds neither in the devcontainer. So this item cannot test their adapters on output recorded at a pinned version. Pinning kubeconform also needs a fetch of its schemas before the network-less review run (#2096). This item keeps Pluto, Popeye (with scan_popeye) and Gitleaks.

Confirmed on 2026-10-25 with the pinned tools:

  • Gitleaks 8.30.1: detect --report-format json --no-git --source <dir> writes nothing to stdout. With --report-path -, it writes the JSON report. devops scan secrets on a directory with one leaked token says "Gitleaks was not run (Scanner exited with code 1 ... leaks found: 1)" and exits 0.
  • Popeye 0.22.1: -o json -s error,warn exits 1 with "no linters matched query". -o json -l warn -n <namespace> writes popeye.sections[] with linter, gvr, tally and issues (resource <namespace>/<name> to a list of group, gvr, level, message).
  • Pluto 5.24.4: the parser now reads api.* and filePath. It still puts invented defaults (Resource, v1, apps/v1) in place of an empty field. Pluto writes filePath as its working directory joined to the path it gets, so an absolute path gives a wrong file path (/tmp//tmp/x/deploy.yaml).

Proposed remedy

Key questions

  • Does gitleaks print JSON to stdout without --report-path? (proposed) No. Confirm this once against the pinned gitleaks before recording the fixture. The fix (--report-path -) is the same either way.

Acceptance criteria

  • A recorded Pluto report yields findings carrying Pluto's kind, apiVersion, replacement API and file path.
  • A recorded Popeye report at warn level yields one finding per issue, and the command carries -l warn and the namespace.
  • A recorded gitleaks report with one leak yields one finding with status ok, not failed.
  • Adapter tests use the process fake replaying the recorded output.
  • Tests run offline with fakes only at process and HTTP edges; each new test runs under 1 s.
  • uv run devops ci passes.

Related: #1045 (kube-linter), #1141 (fingerprints), #1332, #1142, #772.

Found by the 2026-10-08 client-library audit.

Opened as a borrow (#1153, budget/borrowed): the agent filing quota is spent for this cycle, and this is a defect or security finding of the owner-requested 2026-10-08 client-library audit.

Activity

  1. added
    type/bug
    scope/security
    source/agent
    on Oct 8, 2026
  2. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Priority: P2-Medium. Security scanners silently produce incorrect or empty results, undermining review confidence, but the system still runs and no active vulnerability is exposed.
    • Value: High. Users relying on these five scanners for security reviews are receiving wrong or no findings, defeating the purpose of the security gate.
    • Effort: Medium. Fixing CLI flags and JSON parsing across five adapters plus adding recorded-output tests is well-scoped but touches multiple modules.
  3. dan-petty commented on Oct 9, 2026

    @dan-petty
    OwnerAuthor

    Folded in from the #1045 re-scope (2026-10-09)

    Pluto's Kubernetes object symbol moves here from #1045: Kind/<namespace>/<name>, or Kind/name when Pluto reports no namespace (the form #1045 gives kube-linter). The parser reads kind and filepath, but Pluto writes api.kind and filePath, so fixing those keys comes first; adding a namespace alone would give Resource/ns/name.

  4. dan-petty commented on Oct 24, 2026

    @dan-petty
    OwnerAuthor

    Added scope, 2026-10-24 (from #1435). Intake judged this part to belong to this item.

    Friction

    The agent scan tool scan_popeye (src/devops_cli/ai/tools/builtin_tools.py) still runs its own popeye argv and reads its text output. #1435 moved the other six agent scan tools onto the security/* adapters, but PopeyeScanner cannot yet do what the agent tool does.

    Evidence (found during #1435, 2026-10-24)

    What should happen

    After #1434 gives PopeyeScanner -l warn, the namespace and a parser for the JSON of Popeye 0.22, scan_popeye calls the adapter and replies with its outcome (status first, then the findings through mask_secrets), as the other agent scan tools do since #1435. The popeye argv in builtin_tools.py goes.

    Deliver it in the same pull request as the Popeye adapter fix of this item.

  5. changed the title [-]fix(security): the pluto, popeye, kubeconform, gitleaks and checkov adapters read what those tools actually write[/-] [+]fix(security): the pluto, popeye and gitleaks adapters read what those tools actually write[/+] on Oct 25, 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

    scope/securitysource/agenttype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions