Skip to content

Commit

Permalink
adjust SAST file pattern search
Browse files Browse the repository at this point in the history
  • Loading branch information
gruebel committed Oct 26, 2023
1 parent 4e7ca22 commit 37a5dac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions checkov/sast/engines/prisma_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
logger = logging.getLogger(__name__)

REPORT_PARSING_ERRORS = "report_parsing_errors"
SAST_CORE_FILENAME_PATTERN = re.compile(r"(\d+_\d+_\d+)_library\.(so|dll|dylib)$")
SAST_CORE_URL_PATTERN = re.compile(r".*/(?P<name>v?\d+_\d+_\d+_library\.(so|dll|dylib))\?.*")


class PrismaEngine(SastEngine):
Expand Down Expand Up @@ -111,7 +113,7 @@ def setup_sast_artifact(self) -> bool:
now = datetime.now().timestamp()
diff = datetime.fromtimestamp(now) - datetime.fromtimestamp(creation_time)
if diff.days < 1:
match = re.match(r"(\d+_\d+_\d+)_library\.(so|dll|dylib)", latest_file)
match = re.search(SAST_CORE_FILENAME_PATTERN, latest_file)
if match:
current_version = match.groups()[0]

Expand Down Expand Up @@ -142,7 +144,7 @@ def download_sast_artifacts(self, current_version: str) -> bool:
if response.status_code == 304:
return True

match = re.match(r'.*\/(?P<name>v?\d+_\d+_\d+_library\.(so|dll|dylib))\?.*', response.url)
match = re.match(SAST_CORE_URL_PATTERN, response.url)
if match:
new_name = match.group('name')
cli_file_name_path = self.prisma_sast_dir_path / new_name
Expand Down

0 comments on commit 37a5dac

Please sign in to comment.