Skip to content

fix(security): the agent scan tools run the scanner adapters and report a missing or failed scan as such, not as clean #1435

Closed

Description

@dan-petty

Problem

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

  • A missing or failed scan reads as clean.
    • _run_tool_cmd (ai/tools/builtin_tools.py:42-63) returns output or fallback_msg and never looks at the exit code.
    • run_subprocess reports a missing binary as an empty stdout with exit 127 (core/process.py:413-418).
    • So when nothing ran, or the tool crashed, these tools answer "No ... detected": scan_trivy, scan_kubelinter, scan_pluto, scan_bandit, scan_popeye, scan_gitleaks and scan_semgrep (:274-357).
    • The review's CVE verification reads scan_trivy and scan_uv_audit (AGENTS.md, "Zero Hallucinated CVEs").
  • The missing-binary check never fires. :269 looks for No such file or directory: '<tool>' in the returned text. That text appears only if the runner raises, and it does not.
  • The tools duplicate argv that security/* already owns.
    • Two of them read human output: Bandit -r <path> -ll -q (:322) and bare popeye (:330, with no -o json and no context).
    • ai/mcp/server.py:2038-2076 is a third path, through uv run devops scan .... Its Semgrep default config is auto (:2070), while DEFAULT_SEMGREP_CONFIG is p/default.

Proposed remedy

  • Call the adapters. The agent tools call the security/* scanner adapters and render the ScanOutcome:
    • its status first (ok, failed, not installed, not_applicable);
    • then the findings through mask_secrets, truncated as today.
  • MCP. The MCP scan tools call the same adapters, with the configured Semgrep ruleset.
  • Delete the per-tool argv in builtin_tools.py and the text check at :269.

Acceptance criteria

  • For each agent scan tool, a missing binary returns "not installed" and a non-zero exit with empty output returns "failed" (process fake).
  • rg -n '\["(trivy|semgrep|bandit|gitleaks|kube-linter|popeye)"' src/devops_cli/ai prints nothing.
  • The MCP Semgrep tool uses DEFAULT_SEMGREP_CONFIG unless the caller names a ruleset.
  • Tests run offline with fakes only at process and HTTP edges; each new test runs under 1 s.
  • uv run devops ci passes.

Related: #772, #1330, #1332, #1137, and the adapter fixes filed from the same audit (fix(security): the pluto, popeye, kubeconform, gitleaks and checkov adapters read what those tools actually write).

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. Failed or missing security scans are silently reported as clean in agent tools used for CVE verification, but this is a reporting defect rather than an exploitable vulnerability.
    • Value: High. Users relying on agent scan tools for security verification receive false 'clean' results when scanners are absent or crash, eroding trust in the tooling.
    • Effort: Medium. Requires rewiring six agent tools and the MCP path to call existing security adapters, removing duplicated argv, and adding offline tests, but the adapters already exist.
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