diff --git a/checkov/sast/engines/prisma_engine.py b/checkov/sast/engines/prisma_engine.py index 51a9b9ca7ec..4c8f96a8771 100644 --- a/checkov/sast/engines/prisma_engine.py +++ b/checkov/sast/engines/prisma_engine.py @@ -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".*/(?Pv?\d+_\d+_\d+_library\.(so|dll|dylib))\?.*") class PrismaEngine(SastEngine): @@ -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] @@ -142,7 +144,7 @@ def download_sast_artifacts(self, current_version: str) -> bool: if response.status_code == 304: return True - match = re.match(r'.*\/(?Pv?\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