prospector/ranking/rules.py
def apply_rule_security_keyword_in_msg(
    candidate: Commit, advisory_record: AdvisoryRecord
) -> str:
    """
    This rule matches commits whose message contains one or more "security-related" keywords
    """

    SEC_KEYWORDS = [
        "vuln",
        "exploit",
        "attack",
        "secur",
        "xxe",
        "dos",
        "insecur",
        "inject",
    ]
    explanation_template = "The commit message includes the following keywords: {}"

    matching_keywords = set(
        [kw for kw in SEC_KEYWORDS if kw in candidate.message.lower()]
    )

    if len(matching_keywords) > 0:
        return explanation_template.format(", ".join(matching_keywords))

    return None

    This rule matches commits whose message contains one or more "security-related" keywords
    
This rule matches commits whose message contains one or more "security-related" keywords
This rule matches commits whose message contains one or more " security - related " keywords
def apply_rule_security_keyword_in_msg(
    candidate: Commit, advisory_record: AdvisoryRecord
) -> str:
    SEC_KEYWORDS = [
        "vuln",
        "exploit",
        "attack",
        "secur",
        "xxe",
        "dos",
        "insecur",
        "inject",
    ]
    explanation_template = "The commit message includes the following keywords: {}"
    matching_keywords = set(
        [kw for kw in SEC_KEYWORDS if kw in candidate.message.lower()]
    )
    if len(matching_keywords) > 0:
        return explanation_template.format(", ".join(matching_keywords))
    return None
def apply_rule_security_keyword_in_msg ( candidate : Commit , advisory_record : AdvisoryRecord ) -> str : SEC_KEYWORDS = [ "vuln" , "exploit" , "attack" , "secur" , "xxe" , "dos" , "insecur" , "inject" , ] explanation_template = "The commit message includes the following keywords: {}" matching_keywords = set ( [ kw for kw in SEC_KEYWORDS if kw in candidate . message . lower ( ) ] ) if len ( matching_keywords ) > 0 : return explanation_template . format ( ", " . join ( matching_keywords ) ) return None
This rule matches commits whose message contains one or more "security-related" keywords
This rule matches commits whose message contains one or more " security - related " keywords
"""
    This rule matches commits whose message contains one or more "security-related" keywords
    """
candidate
Commit
advisory_record
AdvisoryRecord