From 4eaadd7b1abed5b623f07e670660a5e2186446c6 Mon Sep 17 00:00:00 2001 From: Martin Martinez Rivera Date: Mon, 18 Jul 2022 15:42:09 -0700 Subject: [PATCH 1/3] Add commit author to Python SDK Fixes PLAT-2228 --- nightfall/findings.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nightfall/findings.py b/nightfall/findings.py index f77cb5e..69cbee8 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_hash (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"] ) From 423ef205bd392062659557558163541bb083fa24 Mon Sep 17 00:00:00 2001 From: Martin Martinez Rivera Date: Mon, 18 Jul 2022 15:48:47 -0700 Subject: [PATCH 2/3] Fix tests --- tests/test_api.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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" From c26672ee4c99fbcbd45891eba0887cc9acb0b659 Mon Sep 17 00:00:00 2001 From: Martin Martinez Rivera Date: Tue, 19 Jul 2022 11:16:48 -0700 Subject: [PATCH 3/3] Update nightfall/findings.py Co-authored-by: Evan Fuller --- nightfall/findings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nightfall/findings.py b/nightfall/findings.py index 69cbee8..8a8a6f3 100644 --- a/nightfall/findings.py +++ b/nightfall/findings.py @@ -34,7 +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_hash (str): The author 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