Skip to content

fix(cli): devops scan commands print their progress line on stdout before the JSON, so --json output does not parse #2216

Description

@dan-petty

Problem

devops scan secrets <path> --json writes the line Executing Gitleaks secret scan on '<path>'... to stdout before the JSON. So stdout is not JSON, and a program that reads it fails.

Reproduced on 2026-10-25 with Gitleaks 8.30.1 on a directory that holds one clean file:

$ devops scan secrets <dir> --json 2>/dev/null | python3 -c "import json,sys; json.load(sys.stdin)"
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
$ devops scan secrets <dir> --json 2>/dev/null | head -2
Executing Gitleaks secret scan on '<dir>'...
[]

print_muted writes to stdout unless it gets to_stderr=True (src/devops_cli/output/console.py). These scan commands call it before their scan, also when the output format is JSON or another format that a program reads (src/devops_cli/commands/scan.py): scan trivy (trivy_executing), scan secrets (gitleaks_executing), scan workflows (zizmor_executing), scan sast (semgrep_executing), scan iac (checkov_executing) and scan injection (injection_executing). The MCP tools scan_trivy, scan_sast and scan_secrets run these commands.

Proposed remedy

Write the progress line to stderr, or write it only when the output format is the table. Find the other commands that print progress before machine-readable output, and add a check that runs each command with --format json and parses its stdout.

Acceptance criteria

  • For each scan command above, the stdout of --json and of --format json is valid JSON, and a test parses it.
  • The table output still shows the progress line.

Activity

  1. added
    source/agent
    type/bug
    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/bug. The issue describes a bug where progress lines interfere with JSON parsing, requiring a fix in output handling.
    • Priority: P2-Medium. This bug affects programmatic consumption of scan command outputs and is a regression from expected behavior.
    • Value: High. Fixing this ensures tools can properly parse JSON output from scan commands, improving automation support.
    • Effort: Medium. The fix requires modifying console output logic in multiple scan command functions and testing the changes thoroughly.
    • Related: fix(scan): the json and yaml output of devops scan holds the status and the reason of the scan, so a scan with no result does not read as clean #2107, which asks for a different change. Both items relate to scan command output formats but the candidate addresses stdout vs stderr placement while item 2107 focuses on missing status and reason in JSON output.
  3. added a commit that references this issue on Oct 27, 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/bug

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions