Skip to content

Commit

Permalink
adds rule to phase 2 rules list
Browse files Browse the repository at this point in the history
  • Loading branch information
lauraschauer committed Jul 11, 2024
1 parent aded174 commit 111c25b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion prospector/rules/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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)
]

0 comments on commit 111c25b

Please sign in to comment.