Skip to content

Feature/fix checkov tool list output json decode - #8

Merged
slManuel merged 3 commits into
trunkfrom
feature/fix-checkov-tool-list-output-json-decode
Aug 12, 2026
Merged

Feature/fix checkov tool list output json decode#8
slManuel merged 3 commits into
trunkfrom
feature/fix-checkov-tool-list-output-json-decode

Conversation

@slManuel

Copy link
Copy Markdown
Owner

Description

Please include a summary of the change and which issue is fixed. List any dependencies that are required for this change.

Fix

How does someone fix the issue in code and/or in runtime?

Checklist:

  • The pull request is complete according to the guide of contributing of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes

Manuel Solis added 2 commits July 24, 2026 11:47
…ameworks

Checkov returns a JSON list (one entry per framework) instead of a single dict when more than one framework is scanned in the same run (e.g. framework=[terraform, terraform_plan], triggered by --platform terraform/all with RULES_TERRAFORM).

_async_scan always did result.append(json.loads(output)), assuming a dict. When output was actually a list, it produced a nested list inside result_scans, which later made CheckovDeserealizator fail with: list indices must be integers or slices, not str at checkov_deserealizator.py line 19 (result[results]).

Fix is backward compatible: extend result with parsed_output when it is a list, keep append for the single-dict case, so other subsidiaries relying on the single-framework behavior see no change.

Added regression test test_async_scan_with_multiple_frameworks_list_output.
Explanatory detail already lives in the fix commit message per repo conventions; keep the diff itself minimal.
…ializer

get_list_finding used "'error' in str(result)" to detect failed scans. This substring check false-positives whenever a legitimate failed check's name/guideline/resource text contains the word error (common in security rule descriptions), discarding all already-collected findings and raising Exception(None) since result.get(error) returns None on a normal results dict.

Replaced with isinstance(result, dict) and error in result, which only matches the real error dicts built in CheckovTool._async_scan (e.g. subprocess/JSON decode failures).

Added regression tests: one for the false-positive case (finding text containing error), one confirming the real error path still raises.
@slManuel
slManuel merged commit 843ffda into trunk Aug 12, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant