Skip to content

Commit 8bf7c99

Browse files
authored
Merge pull request #26 from Yelp/better-descriptions-of-high-entropy-strings
Better distinction between high entropy strings
2 parents 464f8db + 410051c commit 8bf7c99

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

detect_secrets/plugins/high_entropy_strings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,17 @@ def _non_quoted_string_regex(self):
179179
class HexHighEntropyString(HighEntropyStringsPlugin):
180180
"""HighEntropyStringsPlugin for hex strings"""
181181

182+
secret_type = 'Hex High Entropy String'
183+
182184
def __init__(self, limit, *args):
183185
super(HexHighEntropyString, self).__init__(string.hexdigits, limit)
184186

185187

186188
class Base64HighEntropyString(HighEntropyStringsPlugin):
187189
"""HighEntropyStringsPlugin for base64 encoded strings"""
188190

191+
secret_type = 'Base64 High Entropy String'
192+
189193
def __init__(self, limit, *args):
190194
super(Base64HighEntropyString, self).__init__(
191195
string.ascii_letters + string.digits + '+/=',

tests/pre_commit_hook_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_file_with_secrets(self, mock_log):
6565
'Potential secrets about to be committed to git repo!'
6666
)
6767
assert message_by_lines[2] == \
68-
'Secret Type: High Entropy String'
68+
'Secret Type: Base64 High Entropy String'
6969
assert message_by_lines[3] == \
7070
'Location: test_data/files/file_with_secrets.py:3'
7171

@@ -158,7 +158,7 @@ def _create_baseline():
158158
'results': {
159159
'test_data/files/file_with_secrets.py': [
160160
{
161-
'type': 'High Entropy String',
161+
'type': 'Base64 High Entropy String',
162162
'line_number': 3,
163163
'hashed_secret': PotentialSecret.hash_secret(base64_secret),
164164
},

0 commit comments

Comments
 (0)