Skip to content

feat: add checkov2hdf converter command - #7059

Merged
Amndeep7 merged 1 commit into
mitre:mainfrom
clem-field:feature/checkov2hdf
Apr 14, 2026
Merged

Amndeep7 merged 1 commit into
mitre:mainfrom
clem-field:feature/checkov2hdf

Conversation

@clem-field

Copy link
Copy Markdown
Contributor

Summary

Add checkov2hdf converter command to SAF CLI, consuming the CheckovMapper from @mitre/hdf-converters v2.13.0.

Changes

New: src/commands/convert/checkov2hdf.ts

Standalone command with flags:

  • -i, --input — Input Checkov JSON file (required)
  • -o, --output — Output HDF JSON file (required)
  • -w, --includeRaw — Include raw input in HDF passthrough

Modified: src/commands/convert/index.ts

  • Import CheckovMapper from @mitre/hdf-converters
  • Add case 'checkov' to the auto-detect switch block

Modified: README.md

  • Added "Checkov to HDF" usage documentation in the "To HDF" section

New: Test suite (test/commands/convert/checkov2hdf.test.ts)

5 tests matching the hdf-converters test coverage:

Test Sample Covers
terraform_plan scan checkov_json.json Standard terraform_plan Checkov output
withRaw passthrough checkov_json.json -w Raw input preserved in HDF passthrough
terraform scan checkov_sample.json terraform (non-plan) scan structure
skipped checks checkov_with_skips.json Skipped checks + parsing errors
synthetic (all paths) checkov_synthetic.json All code paths: severity, skipped, parsing errors

New: Sample data (test/sample_data/checkov/)

  • 4 input samples in sample_input_report/
  • 5 HDF baselines regenerated against published @mitre/hdf-converters v2.13.0

Usage

# Basic conversion
saf convert checkov2hdf -i checkov_results.json -o output-hdf.json

# With raw input preserved
saf convert checkov2hdf -i checkov_results.json -o output-hdf.json -w

Testing

  • All 5 unit tests pass against published @mitre/hdf-converters v2.13.0
  • Validated against 17 live Checkov scan results (Azure VM, EC2, ECS deployments from the sparc-iac project) — all converted successfully
  • TypeScript compilation clean (no errors)

Checklist

  • Command file follows existing patterns (burpsuite, trivy)
  • Tests match hdf-converters test coverage
  • HDF baselines generated against published (not dev) mapper
  • README documentation added
  • --signoff on commit
  • checkInput validates input type before conversion

Add SAF CLI command to convert Checkov JSON output to Heimdall Data
Format (HDF) using the CheckovMapper from @mitre/hdf-converters v2.13.0.

Files:
  - src/commands/convert/checkov2hdf.ts — standalone command with
    -i (input), -o (output), -w (includeRaw) flags
  - src/commands/convert/index.ts — CheckovMapper import + case
    'checkov' in auto-detect switch
  - test/commands/convert/checkov2hdf.test.ts — 5 tests matching
    Heimdall2 hdf-converters coverage: terraform_plan scan, withRaw,
    terraform scan, skipped checks + parsing errors, synthetic
    (all code paths)
  - test/sample_data/checkov/ — 4 sample inputs + 5 HDF baselines
    regenerated against published hdf-converters 2.13.0
  - README.md — checkov2hdf usage documentation

Usage:
  saf convert checkov2hdf -i checkov_results.json -o output-hdf.json
  saf convert checkov2hdf -i checkov_results.json -o output-hdf.json -w

Tested against live Checkov scans from sparc-iac (Azure VM, EC2, ECS)
across 17 result files — all converted successfully.

Signed-off-by: Clem Field <[email protected]>
Signed-off-by: clem-field <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@Amndeep7 Amndeep7 added the ready-to-merge Used by mergify to identify if a PR is ready to merge into main. label Apr 14, 2026
@Amndeep7
Amndeep7 merged commit 2a5c69b into mitre:main Apr 14, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Used by mergify to identify if a PR is ready to merge into main.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants