Closed lohrm-stabl closed 1 year ago
hey @lohrm-stabl thanks for reaching out.
I can verify this is reproducible. Interestingly it works, when you scan the folder 😄
checkov -d . --framework terraform_json -o json
After cdktf synth, I get
docker run -it -v ./cdktf.out:/tf --workdir /tf bridgecrew/checkov --directory /tf --framework terraform_json -o json
2024-06-10 14:06:10,466 [MainThread ] [ERROR] Exception traceback:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/checkov/main.py", line 519, in run
self.scan_reports = runner_registry.run(
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/checkov/common/runners/runner_registry.py", line 126, in run
self.runners[0].run(root_folder, external_checks_dir=external_checks_dir, files=files,
File "/usr/local/lib/python3.11/site-packages/checkov/terraform_json/runner.py", line 87, in run
self.definitions, self.definitions_raw, parsing_errors = create_definitions(file_paths)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/checkov/terraform_json/utils.py", line 59, in create_definitions
template, file_lines = parse(file_path)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/checkov/terraform_json/parser.py", line 32, in parse
template, template_lines = loads(file_path=file_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/checkov/terraform_json/parser.py", line 77, in loads
template = prepare_definition(template)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/checkov/terraform_json/parser.py", line 105, in prepare_definition
definition_new[block_type].append({block_name: hclify(obj=config)})
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/checkov/terraform_json/parser.py", line 118, in hclify
raise Exception("this method receives only dicts")
Exception: this method receives only dicts
Steps to reproduce:
pip3 install checkov
checkov -f cdk.tf.json --framework terraform_json -o json
Gives the following output:
What I would expect? A runner runs with some tests.
Debug Output
LOG_LEVEL=DEBUG checkov -f cdk.tf.json --framework terraform_json 2023-08-29 12:39:24,168 [MainThread ] [DEBUG] Leveraging the bundled IAM Definition. 2023-08-29 12:39:24,168 [MainThread ] [DEBUG] Leveraging the IAM definition at /usr/local/lib/python3.9/dist-packages/policy_sentry/shared/data/iam-definition.json 2023-08-29 12:39:24,463 [MainThread ] [DEBUG] Adding the IntegrationFeatureRegistry