Skip to content

Commit

Permalink
fix(sast): fix sast cdk code location paths (#5938)
Browse files Browse the repository at this point in the history
fix sast cdk code location paths
  • Loading branch information
achiar99 committed Jan 14, 2024
1 parent 7a8d8b0 commit 6875003
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions checkov/common/bridgecrew/platform_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6875003

Please sign in to comment.