credsweeper 1.10.6__py3-none-any.whl → 1.10.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- credsweeper/__init__.py +1 -1
- credsweeper/__main__.py +2 -2
- credsweeper/common/keyword_pattern.py +22 -15
- credsweeper/filters/value_allowlist_check.py +24 -8
- credsweeper/filters/value_blocklist_check.py +3 -0
- credsweeper/rules/config.yaml +16 -0
- credsweeper/utils/hop_stat.py +27 -1
- {credsweeper-1.10.6.dist-info → credsweeper-1.10.7.dist-info}/METADATA +2 -2
- {credsweeper-1.10.6.dist-info → credsweeper-1.10.7.dist-info}/RECORD +12 -12
- {credsweeper-1.10.6.dist-info → credsweeper-1.10.7.dist-info}/WHEEL +0 -0
- {credsweeper-1.10.6.dist-info → credsweeper-1.10.7.dist-info}/entry_points.txt +0 -0
- {credsweeper-1.10.6.dist-info → credsweeper-1.10.7.dist-info}/licenses/LICENSE +0 -0
credsweeper/__init__.py
CHANGED
credsweeper/__main__.py
CHANGED
|
@@ -205,8 +205,8 @@ def get_arguments() -> Namespace:
|
|
|
205
205
|
metavar="POSITIVE_INT")
|
|
206
206
|
parser.add_argument("--thrifty",
|
|
207
207
|
help="clear objects after scan to reduce memory consumption",
|
|
208
|
-
action=
|
|
209
|
-
|
|
208
|
+
action=BooleanOptionalAction,
|
|
209
|
+
default=True)
|
|
210
210
|
parser.add_argument("--skip_ignored",
|
|
211
211
|
help="parse .gitignore files and skip credentials from ignored objects",
|
|
212
212
|
dest="skip_ignored",
|
|
@@ -3,27 +3,30 @@ import re
|
|
|
3
3
|
|
|
4
4
|
class KeywordPattern:
|
|
5
5
|
"""Pattern set of keyword types"""
|
|
6
|
-
key_left = r"(\\[nrt]|%[0-9a-f]{2})?"\
|
|
7
|
-
r"(?P<variable>(([`'\"]
|
|
6
|
+
key_left = r"(\\[nrt]|%[0-9a-f]{2})?" \
|
|
7
|
+
r"(?P<variable>(([`'\"]{1,8}[^:='\"`}<>\\/&?]*|[^:='\"`}<>\s()\\/&?;,%]*)" \
|
|
8
8
|
r"(?P<keyword>"
|
|
9
9
|
# there will be inserted a keyword
|
|
10
10
|
key_right = r")" \
|
|
11
|
-
r"
|
|
12
|
-
|
|
13
|
-
r"(
|
|
14
|
-
r"
|
|
11
|
+
r"[^%:='\"`<>{?!&]*" \
|
|
12
|
+
r")" \
|
|
13
|
+
r"(&(quot|apos);|%[0-9a-f]{2}|[`'\"])*" \
|
|
14
|
+
r")" # <variable>
|
|
15
|
+
separator = r"(\s|\\{1,8}[tnr])*\]?(\s|\\{1,8}[tnr])*" \
|
|
16
|
+
r"(?P<separator>:(\s[a-z]{3,9}[?]?\s)?=|:|=(>|>|\\u0026gt;)|!==|!=|===|==|=|%3d)" \
|
|
17
|
+
r"(\s|\\{1,8}[tnr])*"
|
|
15
18
|
# might be curly, square or parenthesis with words before
|
|
16
19
|
wrap = r"(?P<wrap>(" \
|
|
17
|
-
r"(new(\s
|
|
20
|
+
r"(new(\s|\\{1,8}[tnr]){1,8})?" \
|
|
18
21
|
r"([0-9a-z_.]|-(>|(&|\\\\*u0026)gt;))*" \
|
|
19
|
-
r"[\[\(\{]"\
|
|
20
|
-
r"(\s
|
|
22
|
+
r"[\[\(\{]" \
|
|
23
|
+
r"(\s|\\{1,8}[tnr])*" \
|
|
21
24
|
r"([0-9a-z_]{1,32}=)?" \
|
|
22
|
-
r")
|
|
25
|
+
r"){1,8})?"
|
|
23
26
|
string_prefix = r"(((b|r|br|rb|u|f|rf|fr|l|@)(?=(\\*[`'\"])))?"
|
|
24
27
|
left_quote = r"(?P<value_leftquote>((?P<esq>\\{1,8})?([`'\"]|&(quot|apos);)){1,4}))?"
|
|
25
28
|
# Authentication scheme ( oauth | basic | bearer | apikey ) precedes to credential
|
|
26
|
-
auth_keywords = r"(
|
|
29
|
+
auth_keywords = r"(\s?(oauth|bot|basic|bearer|apikey|accesskey)\s)?"
|
|
27
30
|
value = r"(?P<value>" \
|
|
28
31
|
r"(?(value_leftquote)" \
|
|
29
32
|
r"(" \
|
|
@@ -31,11 +34,15 @@ class KeywordPattern:
|
|
|
31
34
|
r"(?(esq)((?!(?P=esq)([`'\"]|&(quot|apos);)).)|((?!(?P=value_leftquote)).)))" \
|
|
32
35
|
r"|" \
|
|
33
36
|
r"(?!&(quot|apos);)" \
|
|
34
|
-
r"(
|
|
35
|
-
r"
|
|
37
|
+
r"(\\{1,8}([ tnr]|[^\s`'\"])" \
|
|
38
|
+
r"|" \
|
|
39
|
+
r"(?P<url_esc>%[0-9a-f]{2})" \
|
|
40
|
+
r"|" \
|
|
41
|
+
r"(?(url_esc)[^\s`'\",;\\&]|[^\s`'\",;\\])" \
|
|
42
|
+
r")){3,8000}" \
|
|
36
43
|
r"|(\{[^}]{3,8000}\})" \
|
|
37
44
|
r"|(<[^>]{3,8000}>)" \
|
|
38
|
-
r")"
|
|
45
|
+
r")" # <value>
|
|
39
46
|
right_quote = r"(?(value_leftquote)" \
|
|
40
47
|
r"(?P<value_rightquote>(?<!\\)(?P=value_leftquote)|\\$|(?<=[0-9a-z+_/-])$)" \
|
|
41
48
|
r"|" \
|
|
@@ -44,7 +51,7 @@ class KeywordPattern:
|
|
|
44
51
|
@classmethod
|
|
45
52
|
def get_keyword_pattern(cls, keyword: str) -> re.Pattern:
|
|
46
53
|
"""Returns compiled regex pattern"""
|
|
47
|
-
expression =
|
|
54
|
+
expression = ''.join([ #
|
|
48
55
|
cls.key_left, #
|
|
49
56
|
keyword, #
|
|
50
57
|
cls.key_right, #
|
|
@@ -8,22 +8,35 @@ from credsweeper.utils import Util
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class ValueAllowlistCheck(Filter):
|
|
11
|
-
"""Check that
|
|
11
|
+
"""Check that the patterns do not MATCH the candidate value."""
|
|
12
12
|
|
|
13
13
|
ALLOWED = [
|
|
14
14
|
r"ENC\(.*\)", #
|
|
15
15
|
r"ENC\[.*\]", #
|
|
16
16
|
r"\$\{(\*|[0-9]+|[a-z_].*)\}", #
|
|
17
|
-
r"\$
|
|
17
|
+
r"\$[0-9]+(\s|$)", #
|
|
18
18
|
r"\$\$[a-z_]+(\^%[0-9a-z_]+)?", #
|
|
19
|
-
r"#\{
|
|
19
|
+
r"#\{.+\}", # Ruby: String Interpolation
|
|
20
20
|
r"\{\{.+\}\}", #
|
|
21
|
-
r"\S{0,5}\*{5,}", #
|
|
22
21
|
r".*@@@hl@@@(암호|비번|PW|PASS)@@@endhl@@@", #
|
|
23
22
|
]
|
|
24
23
|
|
|
25
24
|
ALLOWED_PATTERN = re.compile(Util.get_regex_combine_or(ALLOWED), flags=re.IGNORECASE)
|
|
26
|
-
|
|
25
|
+
|
|
26
|
+
ALLOWED_QUOTED = [
|
|
27
|
+
r"\$[a-z_]+[0-9a-z_]*([$\s]|$)", #
|
|
28
|
+
r".*\*\*\*", #
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
ALLOWED_QUOTED_PATTERN = re.compile(Util.get_regex_combine_or(ALLOWED_QUOTED), flags=re.IGNORECASE)
|
|
32
|
+
|
|
33
|
+
ALLOWED_UNQUOTED = [
|
|
34
|
+
r"[~a-z0-9_]+((\.|->)[a-z0-9_]+)+\(.*$", #
|
|
35
|
+
r"\$[a-z_]+[0-9a-z_]*\b", #
|
|
36
|
+
r".*\*\*\*\*\*", #
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
ALLOWED_UNQUOTED_PATTERN = re.compile(Util.get_regex_combine_or(ALLOWED_UNQUOTED), flags=re.IGNORECASE)
|
|
27
40
|
|
|
28
41
|
def __init__(self, config: Config = None) -> None:
|
|
29
42
|
pass
|
|
@@ -42,8 +55,11 @@ class ValueAllowlistCheck(Filter):
|
|
|
42
55
|
|
|
43
56
|
if self.ALLOWED_PATTERN.match(line_data.value):
|
|
44
57
|
return True
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
elif line_data.is_well_quoted_value:
|
|
59
|
+
if self.ALLOWED_QUOTED_PATTERN.match(line_data.value):
|
|
60
|
+
return True
|
|
61
|
+
else:
|
|
62
|
+
if self.ALLOWED_UNQUOTED_PATTERN.match(line_data.value):
|
|
63
|
+
return True
|
|
48
64
|
|
|
49
65
|
return False
|
credsweeper/rules/config.yaml
CHANGED
|
@@ -1391,6 +1391,22 @@
|
|
|
1391
1391
|
- code
|
|
1392
1392
|
- doc
|
|
1393
1393
|
|
|
1394
|
+
- name: Tavily API Key
|
|
1395
|
+
severity: high
|
|
1396
|
+
confidence: strong
|
|
1397
|
+
type: pattern
|
|
1398
|
+
values:
|
|
1399
|
+
- (?:(?<![0-9A-Za-z_-])|\\[0abfnrtv]|(%|\\x)[0-9A-Fa-f]{2}|\\[0-7]{3}|\\[Uu]([0-9A-Fa-f]{4}){1,2}|\x1B\[[0-9;]{0,80}m)(?P<value>tvly-[0-9A-Za-z_-]{32,40})(?![0-9A-Za-z_-])
|
|
1400
|
+
min_line_len: 37
|
|
1401
|
+
filter_type:
|
|
1402
|
+
- ValuePatternCheck(5)
|
|
1403
|
+
- ValueEntropyBase64Check
|
|
1404
|
+
required_substrings:
|
|
1405
|
+
- tvly-
|
|
1406
|
+
target:
|
|
1407
|
+
- code
|
|
1408
|
+
- doc
|
|
1409
|
+
|
|
1394
1410
|
- name: Discord Bot Token
|
|
1395
1411
|
severity: high
|
|
1396
1412
|
confidence: strong
|
credsweeper/utils/hop_stat.py
CHANGED
|
@@ -25,11 +25,37 @@ class HopStat:
|
|
|
25
25
|
')': '0',
|
|
26
26
|
'_': '-',
|
|
27
27
|
'+': '=',
|
|
28
|
+
'Q': 'q',
|
|
29
|
+
'W': 'w',
|
|
30
|
+
'E': 'e',
|
|
31
|
+
'R': 'r',
|
|
32
|
+
'T': 't',
|
|
33
|
+
'Y': 'y',
|
|
34
|
+
'U': 'u',
|
|
35
|
+
'I': 'i',
|
|
36
|
+
'O': 'o',
|
|
37
|
+
'P': 'p',
|
|
28
38
|
'{': '[',
|
|
29
39
|
'}': ']',
|
|
30
40
|
'|': '\\',
|
|
41
|
+
'A': 'a',
|
|
42
|
+
'S': 's',
|
|
43
|
+
'D': 'd',
|
|
44
|
+
'F': 'f',
|
|
45
|
+
'G': 'g',
|
|
46
|
+
'H': 'h',
|
|
47
|
+
'J': 'j',
|
|
48
|
+
'K': 'k',
|
|
49
|
+
'L': 'l',
|
|
31
50
|
':': ';',
|
|
32
51
|
'"': "'",
|
|
52
|
+
'Z': 'z',
|
|
53
|
+
'X': 'x',
|
|
54
|
+
'C': 'c',
|
|
55
|
+
'V': 'v',
|
|
56
|
+
'B': 'b',
|
|
57
|
+
'N': 'n',
|
|
58
|
+
'M': 'm',
|
|
33
59
|
'<': ',',
|
|
34
60
|
'>': '.',
|
|
35
61
|
'?': '/',
|
|
@@ -75,7 +101,7 @@ class HopStat:
|
|
|
75
101
|
|
|
76
102
|
"""
|
|
77
103
|
hops = []
|
|
78
|
-
value = value.
|
|
104
|
+
value = value.translate(HopStat.TRANSLATION)
|
|
79
105
|
for a, b in zip(value[:-1], value[1:]):
|
|
80
106
|
hop = self.__hop_dict.get((a, b))
|
|
81
107
|
if hop is None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: credsweeper
|
|
3
|
-
Version: 1.10.
|
|
3
|
+
Version: 1.10.7
|
|
4
4
|
Summary: Credential Sweeper
|
|
5
5
|
Project-URL: Homepage, https://github.com/Samsung/CredSweeper
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/Samsung/CredSweeper/issues
|
|
@@ -87,7 +87,7 @@ Full documentation can be found here: <https://credsweeper.readthedocs.io/>
|
|
|
87
87
|
|
|
88
88
|
### Main Requirements
|
|
89
89
|
|
|
90
|
-
- Python 3.
|
|
90
|
+
- Python 3.9, 3.10, 3.11, 3.12
|
|
91
91
|
|
|
92
92
|
### Installation
|
|
93
93
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
credsweeper/__init__.py,sha256=
|
|
2
|
-
credsweeper/__main__.py,sha256=
|
|
1
|
+
credsweeper/__init__.py,sha256=bsu6pMpQo7yoOF3zKYBhzmGZk1Y7W-1miVXpWCkScRc,632
|
|
2
|
+
credsweeper/__main__.py,sha256=jlI83ctJJfF0koMqP6u24JASC7MIPA2g1POx7aeuaQ8,17187
|
|
3
3
|
credsweeper/app.py,sha256=sexUp4Qced22AhvbcVlb5C-QtJRoDmUp5qhc_nwj248,21369
|
|
4
4
|
credsweeper/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
credsweeper/common/__init__.py,sha256=mYiHEDV0hSeWcFx0Wb8oIRDCPR92ben0mCuC9-gCTgI,184
|
|
6
6
|
credsweeper/common/constants.py,sha256=plBHrIVfj4CBpymIgLxTPiYr66_By3QKlgCoHYVKPLc,5534
|
|
7
7
|
credsweeper/common/keyword_checklist.py,sha256=6EKNdMMryZykedAOhEc-MF1byi5oXmAiljq61T_nco4,2258
|
|
8
8
|
credsweeper/common/keyword_checklist.txt,sha256=a8GW-wF6D83uVFYxMWEsUFlth6c1B_KDpF8_Xpj0mE8,7169
|
|
9
|
-
credsweeper/common/keyword_pattern.py,sha256=
|
|
9
|
+
credsweeper/common/keyword_pattern.py,sha256=IUvXQ1BWawzK_H8fkMJWUJBdPmi69RW5-VD36LfZNVE,2608
|
|
10
10
|
credsweeper/common/morpheme_checklist.txt,sha256=yPfBCSlLCHrzMtZELZbco4PFFWgq_cVOLJF4VTA2b9M,8852
|
|
11
11
|
credsweeper/config/__init__.py,sha256=3_lLgF2P-EurNupTYmHvY11Ba8rdjhLJAAfTiMJW4mY,45
|
|
12
12
|
credsweeper/config/config.py,sha256=Rfc8YLa4bcG_AMequbfQ-HggS74jC4OqTtaWOoGxJdA,2630
|
|
@@ -56,7 +56,7 @@ credsweeper/filters/filter.py,sha256=CqZbTsIDNVVwQyOjNekgNr_i1nPS4foutm0AvGAjM5M
|
|
|
56
56
|
credsweeper/filters/line_git_binary_check.py,sha256=G5N-woSLXC1mdiD80AhXbOpJCjGwtvFwFwMmRu87qlY,1595
|
|
57
57
|
credsweeper/filters/line_specific_key_check.py,sha256=rM66tPmUCXPaCUpNokIkJukOyxOL4FB8ig74ezYrbBs,1536
|
|
58
58
|
credsweeper/filters/line_uue_part_check.py,sha256=xmJr2Klz3H8yc-ymlGwPmIjRIoXxvBD9NvW0gW22i9o,1519
|
|
59
|
-
credsweeper/filters/value_allowlist_check.py,sha256=
|
|
59
|
+
credsweeper/filters/value_allowlist_check.py,sha256=dRhBKYQiODbAkpJ5pyCqliBdsQO-2qiVXel-wpFw_fo,2022
|
|
60
60
|
credsweeper/filters/value_array_dictionary_check.py,sha256=NaaojsUFjGlk4JzpskG3rdUCN2RXZs8MgX_yTrNHm9c,1251
|
|
61
61
|
credsweeper/filters/value_atlassian_token_check.py,sha256=rAuMC5JUxnXZwPxoKtrwFVKTWCNXf-gf9mv5h6IQC7M,2914
|
|
62
62
|
credsweeper/filters/value_azure_token_check.py,sha256=LGfLPoQxuVN8kReWKTvFpfLGa8oOhUCw95YHBJhF-uE,2022
|
|
@@ -65,7 +65,7 @@ credsweeper/filters/value_base64_data_check.py,sha256=J5dMgJsfs13MxijOMqGLYU8PZz
|
|
|
65
65
|
credsweeper/filters/value_base64_encoded_pem_check.py,sha256=sX80Uo_7b7HQm4KjNkRHqB8FQvxuuvMLhxAUalSQeaU,1607
|
|
66
66
|
credsweeper/filters/value_base64_key_check.py,sha256=6JrIGNphjM9gN8oi1OKyvm4MUvvLxsQPxGP5BkaTC1w,2131
|
|
67
67
|
credsweeper/filters/value_base64_part_check.py,sha256=rguPXjAmLJvwYYvgmzcH1eiDDf-9NkCC8gGNpans7aA,4324
|
|
68
|
-
credsweeper/filters/value_blocklist_check.py,sha256=
|
|
68
|
+
credsweeper/filters/value_blocklist_check.py,sha256=CSsD68QRF1zFLM2MB5pGRRs95O8IepZ9AUZYdxlBf-c,1145
|
|
69
69
|
credsweeper/filters/value_camel_case_check.py,sha256=cCBogfL5X9ufAbkl5QwqN6qvHz4XYaeaENC6ew4m4Ac,1233
|
|
70
70
|
credsweeper/filters/value_couple_keyword_check.py,sha256=zbY_TqsVHuwcf4ANp83g36wgxNLkHLk_r-Pm7-nmSZ8,1004
|
|
71
71
|
credsweeper/filters/value_dictionary_keyword_check.py,sha256=6-RqiROZJC6g2zD4v0AtFKhlNE4tY-iYhestwTI4vbE,1263
|
|
@@ -127,7 +127,7 @@ credsweeper/ml_model/features/word_in_path.py,sha256=FjjzdyPvEsIYwkB94-0bdbHOtKN
|
|
|
127
127
|
credsweeper/ml_model/features/word_in_value.py,sha256=35GCjCfvpWw4-MiMAZA9YcoaqwBommArSrJ4kEAi5TA,883
|
|
128
128
|
credsweeper/ml_model/features/word_in_variable.py,sha256=d02c1ieUxm1pSyOE-S-HijgliMRV9kMaI0zv-UxFAp4,823
|
|
129
129
|
credsweeper/rules/__init__.py,sha256=alXS8IivUs-AKKbVHiWvSjFpg1urJZLKItuFr61HHyg,40
|
|
130
|
-
credsweeper/rules/config.yaml,sha256=
|
|
130
|
+
credsweeper/rules/config.yaml,sha256=_RkpDyad8_uJbMdxIQK9F9-B1CER7OHMTuZtKPTsSHE,39065
|
|
131
131
|
credsweeper/rules/rule.py,sha256=rU6vJ4cVoeAZdUMWalRTMuAdRuYgFxeTltvSYUJRHOU,10224
|
|
132
132
|
credsweeper/scanner/__init__.py,sha256=KUh1uUEgZOd12DiXV-TQP3OvByI9tsyqN1KCdw994h8,48
|
|
133
133
|
credsweeper/scanner/scanner.py,sha256=eGwMJSCSqMyDzDN7Kniqeylv3rB2SuuyJmQ5QUb7hsE,9608
|
|
@@ -140,11 +140,11 @@ credsweeper/secret/config.json,sha256=GLmo20U9xEJbZ8K0diprxkUYiulWIvD8-jEH8zcycA
|
|
|
140
140
|
credsweeper/secret/log.yaml,sha256=h29atN5Kvk68oKuTYG2Mi4f2uNO3dvwhOkzCRBKo1rg,952
|
|
141
141
|
credsweeper/utils/__init__.py,sha256=wPdTkrSBAkR3rppFZ68k6MiT_P7tIHuAb3AcwndJCWg,63
|
|
142
142
|
credsweeper/utils/entropy_validator.py,sha256=711xCIBGAy-Pb6wqbMpEToa4dOYj5_CmkbKHygLeQrI,2796
|
|
143
|
-
credsweeper/utils/hop_stat.py,sha256=
|
|
143
|
+
credsweeper/utils/hop_stat.py,sha256=0D7xB1CVAUhseOZWvLZXxn3MYHKZnfnFJ8hj7tONiyU,2978
|
|
144
144
|
credsweeper/utils/pem_key_detector.py,sha256=Z1LJYm4WAqppF2ooj81-lbhrg2woiNKiMk8Nt4DV-G8,7721
|
|
145
145
|
credsweeper/utils/util.py,sha256=oI4uaMAEoZUVwqPOsjWSp4boKGCQtS6dui0yFbPCsy8,29896
|
|
146
|
-
credsweeper-1.10.
|
|
147
|
-
credsweeper-1.10.
|
|
148
|
-
credsweeper-1.10.
|
|
149
|
-
credsweeper-1.10.
|
|
150
|
-
credsweeper-1.10.
|
|
146
|
+
credsweeper-1.10.7.dist-info/METADATA,sha256=mZ29rR4tboTGU7wO-rs-QxM96g8pIyk6qb5qWrsgaQc,10389
|
|
147
|
+
credsweeper-1.10.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
148
|
+
credsweeper-1.10.7.dist-info/entry_points.txt,sha256=SLGNZshvi3zpWPhVmRP-oDXRMRPBS4tzRDy6xYOXwqA,58
|
|
149
|
+
credsweeper-1.10.7.dist-info/licenses/LICENSE,sha256=aU7mGjBKbmRHNLVXXzcPdKmTtBxRwDPtjflQRfN7fFg,1065
|
|
150
|
+
credsweeper-1.10.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|