Skip to content

Commit 6875003

Browse files
authored
fix(sast): fix sast cdk code location paths (#5938)
fix sast cdk code location paths
1 parent 7a8d8b0 commit 6875003

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

checkov/common/bridgecrew/platform_integration.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,12 +559,18 @@ def adjust_sast_match_location_path(self, match: Match) -> None:
559559
for dir in self.scan_dir:
560560
if match.location.path.startswith(os.path.abspath(dir)):
561561
match.location.path = match.location.path.replace(os.path.abspath(dir), self.repo_path) # type: ignore
562+
if match.metadata.code_locations:
563+
for code_location in match.metadata.code_locations:
564+
code_location.path = code_location.path.replace(os.path.abspath(dir), self.repo_path) # type: ignore
562565
return
563566

564567
for file in self.scan_file:
565568
if match.location.path == os.path.abspath(file):
566569
file_dir = '/'.join(match.location.path.split('/')[0:-1])
567570
match.location.path = match.location.path.replace(os.path.abspath(file_dir), self.repo_path) # type: ignore
571+
if match.metadata.code_locations:
572+
for code_location in match.metadata.code_locations:
573+
code_location.path = code_location.path.replace(os.path.abspath(file_dir), self.repo_path) # type: ignore
568574
return
569575

570576
@staticmethod

0 commit comments

Comments
 (0)