bridgecrewio / checkov

Prevent cloud misconfigurations and find vulnerabilities during build-time in infrastructure as code, container images and open source packages with Checkov by Bridgecrew.
https://www.checkov.io/
Apache License 2.0
7.01k stars 1.1k forks source link

Checkov crashes with TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' #5251

Closed sebastianczech closed 8 months ago

sebastianczech commented 1 year ago

Describe the issue

While using checkov via checkov-action I'm experiencing an error:

Error: -23 09:36:46,516 [MainThread  ] [ERROR]  Exception traceback:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/checkov/main.py", line 501, in run
    exit_codes.append(self.print_results(
  File "/usr/local/lib/python3.10/site-packages/checkov/main.py", line 690, in print_results
    return runner_registry.print_reports(
  File "/usr/local/lib/python3.10/site-packages/checkov/common/runners/runner_registry.py", line 428, in print_reports
    sarif = Sarif(reports=sarif_reports, tool=self.tool)
  File "/usr/local/lib/python3.10/site-packages/checkov/common/output/sarif.py", line 40, in __init__
    self.json = self.create_json()
  File "/usr/local/lib/python3.10/site-packages/checkov/common/output/sarif.py", line 46, in create_json
    "runs": self._create_runs(),
  File "/usr/local/lib/python3.10/site-packages/checkov/common/output/sarif.py", line 52, in _create_runs
    results = self._create_results()
  File "/usr/local/lib/python3.10/site-packages/checkov/common/output/sarif.py", line 226, in _create_results
    "startLine": int(record.file_line_range[0]) or 1,
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

Examples

Details can be found in https://github.com/PaloAltoNetworks/terraform-aws-vmseries-modules/actions/runs/5354980337/jobs/9712690088

Version (please complete the following information):

Checkov Version 2.3.301

Additional context

Errors appears only via GitHub actions, locally I'm not experiencing it.

sebastianczech commented 1 year ago

Error is connected with SARIF reports, so as a workaround I specified CLI output format, SARIF is skipped:

        id: checkov
        uses: bridgecrewio/checkov-action@master
        with:
          output_format: cli
          directory: .
          framework: terraform 
          compact: true
stale[bot] commented 8 months ago

Thanks for contributing to Checkov! We've automatically marked this issue as stale to keep our issues list tidy, because it has not had any activity for 6 months. It will be closed in 14 days if no further activity occurs. Commenting on this issue will remove the stale tag. If you want to talk through the issue or help us understand the priority and context, feel free to add a comment or join us in the Checkov slack channel at codifiedsecurity.slack.com Thanks!

stale[bot] commented 8 months ago

Closing issue due to inactivity. If you feel this is in error, please re-open, or reach out to the community via slack: codifiedsecurity.slack.com Thanks!