Skip to content

Commit b17c97d

Browse files
committed
test 2025-03-16T13:33:32+02:00
1 parent b91053b commit b17c97d

4 files changed

Lines changed: 5 additions & 28 deletions

File tree

credsweeper/common/keyword_pattern.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ class KeywordPattern:
88
r"(?P<keyword>"
99
# there will be inserted a keyword
1010
key_right = r")" \
11-
r"[^%:='\"`<>{?!&]*" \
11+
r"[^%:='\"`<>{?!&,;]*" \
1212
r")" \
1313
r"(&(quot|apos);|%[0-9a-f]{2}|[`'\"])*" \
1414
r")" # <variable>
1515
separator = r"(\s|\\{1,8}[tnr])*\]?(\s|\\{1,8}[tnr])*" \
16-
r"(?P<separator>:(\s[a-z]{3,9}[?]?\s)?=|:|=(>|&gt;|\\u0026gt;)|!==|!=|===|==|=|%3d)" \
16+
r"(?P<separator>:(\s[a-z]{3,9}[?]?\s)?=|:(?!:)|=(>|&gt;|\\u0026gt;)|!==|!=|===|==|=|%3d)" \
1717
r"(\s|\\{1,8}[tnr])*"
1818
# might be curly, square or parenthesis with words before
1919
wrap = r"(?P<wrap>(" \

tests/common/test_keyword_pattern.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ def test_separator_p(self, config: Config, file_path: pytest.fixture, line: str)
144144
["password=${array[@]:7:2}", "${array[@]:7:2}"],
145145
["password=${1#*=}", "${1#*=}"],
146146
["A2 ID:master,PW:dipPr10Gg!","dipPr10Gg!"],
147-
["pass=get->pass(arg1='seCreT', arg2='secRet2'...","seCreT"]
147+
["pass=get->pass(arg1='seCreT', arg2='secRet2'...","seCreT"],
148+
["The login name is test@ror-e.com with a password => skvu810","skvu810"]
148149
])
149150
def test_keyword_pattern_p(self, config: Config, file_path: pytest.fixture, line: str, value: str) -> None:
150151

tests/data/ml_threshold.json

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6067,31 +6067,6 @@
60676067
}
60686068
]
60696069
},
6070-
{
6071-
"rule": "Password",
6072-
"severity": "critical",
6073-
"confidence": "moderate",
6074-
"ml_probability": 1.0,
6075-
"line_data_list": [
6076-
{
6077-
"line": "ANY_password,default:IhqSb1Gg",
6078-
"line_num": 31,
6079-
"path": "./tests/samples/doc_various",
6080-
"info": "",
6081-
"value": "IhqSb1Gg",
6082-
"value_start": 21,
6083-
"value_end": 29,
6084-
"variable": "ANY_password,default",
6085-
"variable_start": 0,
6086-
"variable_end": 20,
6087-
"entropy_validation": {
6088-
"iterator": "BASE64STDPAD_CHARS",
6089-
"entropy": 3.0,
6090-
"valid": false
6091-
}
6092-
}
6093-
]
6094-
},
60956070
{
60966071
"rule": "Key",
60976072
"severity": "critical",

tests/test_main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,7 @@ def test_param_n(self) -> None:
873873
def test_param_p(self) -> None:
874874
# internal parametrized tests for quick debug
875875
items = [ #
876+
("pw.md", b"The login password => skWu850", "password", "skWu850"), #
876877
("log.txt", b'Authorization: SSWS 00QEi8-WW0HmCjAl4MlVjFx-vbGPXMD8sWXsua', "Authorization",
877878
"00QEi8-WW0HmCjAl4MlVjFx-vbGPXMD8sWXsua"),
878879
('test.yaml', b'password: "Fd[q#pX+@4*r`1]Io"', 'password', 'Fd[q#pX+@4*r`1]Io'),

0 commit comments

Comments
 (0)