From 36a33d1d6887db3b0ebd68e982a06e260eb781f8 Mon Sep 17 00:00:00 2001 From: achia Date: Sun, 14 Jan 2024 11:13:58 +0200 Subject: [PATCH] fix sast cdk code location paths --- checkov/common/bridgecrew/platform_integration.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/checkov/common/bridgecrew/platform_integration.py b/checkov/common/bridgecrew/platform_integration.py index 1ecb23b1b5e..08f385d807c 100644 --- a/checkov/common/bridgecrew/platform_integration.py +++ b/checkov/common/bridgecrew/platform_integration.py @@ -559,12 +559,18 @@ def adjust_sast_match_location_path(self, match: Match) -> None: for dir in self.scan_dir: if match.location.path.startswith(os.path.abspath(dir)): match.location.path = match.location.path.replace(os.path.abspath(dir), self.repo_path) # type: ignore + if match.metadata.code_locations: + for code_location in match.metadata.code_locations: + code_location.path = code_location.path.replace(os.path.abspath(dir), self.repo_path) # type: ignore return for file in self.scan_file: if match.location.path == os.path.abspath(file): file_dir = '/'.join(match.location.path.split('/')[0:-1]) match.location.path = match.location.path.replace(os.path.abspath(file_dir), self.repo_path) # type: ignore + if match.metadata.code_locations: + for code_location in match.metadata.code_locations: + code_location.path = code_location.path.replace(os.path.abspath(file_dir), self.repo_path) # type: ignore return @staticmethod