From 111c25b4aa6baa8fc2b05876bc2a46018b8f11bd Mon Sep 17 00:00:00 2001 From: I748376 Date: Wed, 10 Jul 2024 12:53:22 +0000 Subject: [PATCH] adds rule to phase 2 rules list --- prospector/rules/rules.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/prospector/rules/rules.py b/prospector/rules/rules.py index 80496c812..2ba5a16e9 100644 --- a/prospector/rules/rules.py +++ b/prospector/rules/rules.py @@ -413,6 +413,18 @@ def apply(self, candidate: Commit, advisory_record: AdvisoryRecord): return False +class CommitIsSecurityRelevant(Rule): + """Matches commits that are deemed security relevant by the commit classification service.""" + + def apply( + self, + candidate: Commit, + ) -> bool: + return LLMService().classify_commit( + candidate.diff, candidate.repository, candidate.message + ) + + RULES_PHASE_1: List[Rule] = [ VulnIdInMessage("VULN_ID_IN_MESSAGE", 64), # CommitMentionedInAdv("COMMIT_IN_ADVISORY", 64), @@ -433,4 +445,6 @@ def apply(self, candidate: Commit, advisory_record: AdvisoryRecord): CommitHasTwins("COMMIT_HAS_TWINS", 2), ] -RULES_PHASE_2: List[Rule] = [] +RULES_PHASE_2: List[Rule] = [ + CommitIsSecurityRelevant("COMMIT_IS_SECURITY_RELEVANT", 32) +]