Skip to content

Commit

Permalink
passes Phase 2 rule
Browse files Browse the repository at this point in the history
  • Loading branch information
lauraschauer committed Jul 4, 2024
1 parent 2033f57 commit c7cb7ea
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions prospector/rules/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,30 +412,6 @@ 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:
# temperature saved in LLMService's model
temperature = self.llm_service.model._identifying_params.get("temperature")
data = {
"temperature": temperature,
"diff": "\n".join(candidate.diff),
}

response = requests.get("http://127.0.0.1:8001/predict", json=data)

prediction = response.json()["prediction"]
if prediction == "1":
self.message = "The commit was deemed security relevant by the commit classification service."
return True
else:
return False


RULES_PHASE_1: List[Rule] = [
VulnIdInMessage("VULN_ID_IN_MESSAGE", 64),
# CommitMentionedInAdv("COMMIT_IN_ADVISORY", 64),
Expand All @@ -456,6 +432,4 @@ def apply(
CommitHasTwins("COMMIT_HAS_TWINS", 2),
]

RULES_PHASE_2: List[Rule] = [
CommitIsSecurityRelevant("COMMIT_IS_SECURITY_RELEVANT", 32)
]
RULES_PHASE_2: List[Rule] = []

0 comments on commit c7cb7ea

Please sign in to comment.