diff --git a/nightfall/findings.py b/nightfall/findings.py index f77cb5e..8a8a6f3 100644 --- a/nightfall/findings.py +++ b/nightfall/findings.py @@ -34,6 +34,7 @@ class Finding: row_range (Range): The row in which a finding was detected, if it was in a tabular document. Index starts at 1. column_range (Range): The column(s) in which a finding was detected, if it was in a tabular document. Index starts at 1. commit_hash (str): The hash of the commit in which the finding was detected, if known. + commit_author(str): The author of the commit in which the finding was detected, if known. matched_detection_rule_uuids (List[str]): The list of detection rule UUIDs that contained a detector that triggered a match. matched_detection_rules (List[str]): The list of inline detection rules that contained a detector that triggered @@ -51,6 +52,7 @@ class Finding: row_range: Optional[Range] column_range: Optional[Range] commit_hash: str + commit_author: str matched_detection_rule_uuids: List[str] matched_detection_rules: List[str] @@ -69,6 +71,7 @@ def from_dict(cls, resp: dict) -> "Finding": _range_or_none(resp["location"]["rowRange"]), _range_or_none(resp["location"]["columnRange"]), resp["location"].get("commitHash", ""), + resp["location"].get("commitAuthor", ""), resp["matchedDetectionRuleUUIDs"], resp["matchedDetectionRules"] ) diff --git a/tests/test_api.py b/tests/test_api.py index adf492e..08a7753 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -57,7 +57,7 @@ def finding_orderer(f): "Credit Card Number", result[0][0].detector_uuid, Confidence.VERY_LIKELY, - Range(0, 19), Range(0, 19), None, None, "", + Range(0, 19), Range(0, 19), None, None, "", "", [], ["Inline Detection Rule #1"]) assert result[0][1] == Finding( "489-36-8350", @@ -66,7 +66,7 @@ def finding_orderer(f): "US_SOCIAL_SECURITY_NUMBER", result[0][1].detector_uuid, Confidence.VERY_LIKELY, - Range(46, 57), Range(46, 57), None, None, "", + Range(46, 57), Range(46, 57), None, None, "", "", [], ["Inline Detection Rule #1"]) assert len(redactions) == 1 assert redactions[0] == "491👀-👀👀👀👀-👀👀👀👀-👀👀👀👀 is my credit card number, [REDACTED] ssn" @@ -334,7 +334,7 @@ def test_scan_text(): "Credit Card Number", result[0][0].detector_uuid, Confidence.VERY_LIKELY, - Range(0, 19), Range(0, 19), None, None, "", + Range(0, 19), Range(0, 19), None, None, "", "", [], ["Inline Detection Rule #1"]) assert result[0][1] == Finding( "489-36-8350", @@ -343,7 +343,7 @@ def test_scan_text(): "", result[0][1].detector_uuid, Confidence.VERY_LIKELY, - Range(46, 57), Range(46, 57), Range(2,4), Range(1,1), "", + Range(46, 57), Range(46, 57), Range(2,4), Range(1,1), "", "", [], ["Inline Detection Rule #1"]) assert len(redactions) == 1 assert redactions[0] == "491👀-👀👀👀👀-👀👀👀👀-👀👀👀👀 is my credit card number, [REDACTED] ssn" @@ -432,7 +432,7 @@ def test_scan_text_with_policy_uuids(): "Credit Card Number", result[0][0].detector_uuid, Confidence.VERY_LIKELY, - Range(0, 19), Range(0, 19), None, None, "", + Range(0, 19), Range(0, 19), None, None, "", "", ["0d8efd7b-b87a-478b-984e-9cf5534a46bc"], []) assert len(redactions) == 1 assert redactions[0] == "491👀-👀👀👀👀-👀👀👀👀-👀👀👀👀 is my credit card number, [REDACTED] ssn"