Skip to content

Commit e3441a7

Browse files
author
XIANJUN ZHU
committed
Remove some false positives from basic auth
Exclude single and double quotes in matching
1 parent 4cf087b commit e3441a7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

detect_secrets/plugins/basic_auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .base import RegexBasedDetector
66

77

8-
SPECIAL_URL_CHARACTERS = ':/?#[]@'
8+
SPECIAL_URL_CHARACTERS = ':/?#[]@"\''
99

1010

1111
class BasicAuthDetector(RegexBasedDetector):

tests/plugins/basic_auth_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ class TestBasicAuthDetector(object):
1212
[
1313
('https://username:[email protected]', True,),
1414
('http://localhost:5000/<%= @variable %>', False,),
15+
('"https://url:8000";@something else', False,),
16+
('\'https://url:8000\';@something else', False,),
17+
('https://url:8000 @something else', False,),
18+
('https://url:8000/ @something else', False,),
1519
],
1620
)
1721
def test_analyze_string(self, payload, should_flag):

0 commit comments

Comments
 (0)