From 2b95629c12d62a7b52ab68b6f8128cefe20aa3a2 Mon Sep 17 00:00:00 2001 From: Omry Mendelovich <16597193+omryMen@users.noreply.github.com> Date: Sun, 10 Mar 2024 17:25:38 +0200 Subject: [PATCH] fix(sast): add attribute verification (#6078) --- checkov/common/bridgecrew/platform_integration.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/checkov/common/bridgecrew/platform_integration.py b/checkov/common/bridgecrew/platform_integration.py index 60211e26c54..f00d8049441 100644 --- a/checkov/common/bridgecrew/platform_integration.py +++ b/checkov/common/bridgecrew/platform_integration.py @@ -626,15 +626,15 @@ def save_sast_report_locally(sast_scan_reports: Dict[str, Dict[str, Any]]) -> No def persist_sast_scan_results(self, reports: List[Report]) -> None: sast_scan_reports = {} for report in reports: - if not report.check_type.startswith('sast'): + if not report.check_type.lower().startswith(CheckType.SAST): continue - if not report.sast_report: # type: ignore + if not hasattr(report, 'sast_report') or not report.sast_report: continue - for _, match_by_check in report.sast_report.rule_match.items(): # type: ignore + for _, match_by_check in report.sast_report.rule_match.items(): for _, match in match_by_check.items(): for m in match.matches: self.adjust_sast_match_location_path(m) - sast_scan_reports[report.check_type] = report.sast_report.model_dump(mode='json') # type: ignore + sast_scan_reports[report.check_type] = report.sast_report.model_dump(mode='json') if self.on_prem: BcPlatformIntegration._delete_code_block_from_sast_report(sast_scan_reports)