|
4 | 4 |
|
5 | 5 | from detect_secrets import filters
|
6 | 6 | from detect_secrets.core.scan import scan_line
|
| 7 | +from detect_secrets.plugins.aws import AWSKeyDetector |
7 | 8 | from detect_secrets.settings import transient_settings
|
8 | 9 |
|
9 | 10 |
|
@@ -77,23 +78,26 @@ def test_success(self, secret, line):
|
77 | 78 | assert filters.heuristic.is_likely_id_string(secret, line)
|
78 | 79 |
|
79 | 80 | @pytest.mark.parametrize(
|
80 |
| - 'secret, line', |
| 81 | + 'secret, line, plugin', |
81 | 82 | [
|
82 | 83 | # the word hidden has the word id in it, but lets
|
83 | 84 | # not mark that as an id string
|
84 |
| - ('RANDOM_STRING', 'hidden_secret: RANDOM_STRING'), |
85 |
| - ('RANDOM_STRING', 'hidden_secret=RANDOM_STRING'), |
86 |
| - ('RANDOM_STRING', 'hidden_secret = RANDOM_STRING'), |
| 85 | + ('RANDOM_STRING', 'hidden_secret: RANDOM_STRING', None), |
| 86 | + ('RANDOM_STRING', 'hidden_secret=RANDOM_STRING', None), |
| 87 | + ('RANDOM_STRING', 'hidden_secret = RANDOM_STRING', None), |
87 | 88 |
|
88 | 89 | # fail silently if the secret isn't even on the line
|
89 |
| - ('SOME_RANDOM_STRING', 'id: SOME_OTHER_RANDOM_STRING'), |
| 90 | + ('SOME_RANDOM_STRING', 'id: SOME_OTHER_RANDOM_STRING', None), |
90 | 91 |
|
91 | 92 | # fail although the word david ends in id
|
92 |
| - ('RANDOM_STRING', 'postgres://david:RANDOM_STRING'), |
| 93 | + ('RANDOM_STRING', 'postgres://david:RANDOM_STRING', None), |
| 94 | +
|
| 95 | + # fail since this is an aws access key id, a real secret |
| 96 | + ('AKIA4NACSIJMDDNSEDTE', 'aws_access_key_id=AKIA4NACSIJMDDNSEDTE', AWSKeyDetector()), |
93 | 97 | ],
|
94 | 98 | )
|
95 |
| - def test_failure(self, secret, line): |
96 |
| - assert not filters.heuristic.is_likely_id_string(secret, line) |
| 99 | + def test_failure(self, secret, line, plugin): |
| 100 | + assert not filters.heuristic.is_likely_id_string(secret, line, plugin) |
97 | 101 |
|
98 | 102 |
|
99 | 103 | @pytest.mark.parametrize(
|
|
0 commit comments