@@ -8,19 +8,19 @@ patterns:
8
8
pattern : |
9
9
[a-zA-Z0-9!.,$%&*+?^_`{|}()[\]\\/~-][a-zA-Z0-9\t !.,$%&*+?^_`{|}()[\]\\/~-]*
10
10
start : |
11
- (?:\A|[^a-zA-Z0-9])(?i)(?:api|auth[a-z]+|jwt|mysql|db)?[_.-]?(?:pass?(?:wo?r?d|code|phrase)|secret|key|token)([_-][a-z+])? ([ \t]+As[ \t]+String)?[\t ]*(={1,3}|:)[\t ]*(?:["']|b["'])?
11
+ (?:\A|[^a-zA-Z0-9])(?i)(?:api|auth[a-z]+|jwt|mysql|db)?[_.-]?(?:pass?(?:wo?r?d|code|phrase)|secret|key|token)([_-][a-z0-9]+){0,3} ([ \t]+As[ \t]+String)?[\t ]*(={1,3}|:)[\t ]*(?:["']|b["'])?
12
12
end : |
13
13
(\z|[\r\n'"])
14
14
additional_not_match :
15
15
# something that means "password" or a placeholder name - either a variable or a placeholder
16
16
# a literal value or config switch
17
- - ^(?i)(?:[a-z0-9_.]*,\s*)?(?:str\()?[[<(]?(?:(?:(?:user|key) _?)?(?:[a-zA-Z0-9._]+[_.])?(?:the )?(?:pass?(wo?r?d|code|phrase)|pass|pwd|secret|token|tok|redacted|placeholder|dummy|pw|thephrase)|write|read|on|off|true|false|none|null( \? )?|nil|undefined|eof|ignore|eol|git|yes|no|y|n),?[\]>)]?(?:\)\s*\{)?\\?(( or | \|\| ).*)?$
17
+ - _?)?(?:[a-zA-Z0-9._]+[_.])?(?:the )?(?:pass?(wo?r?d|code|phrase)|pass|pwd|secret|token|tok|redacted|placeholder|dummy|pw|thephrase)|write|read|on|off|true|false|none|null( \? )?|nil|undefined|eof|ignore|eol|git|yes|no|y|n),?\s*\){0,2} [\]>)]?(?:\)\s*\{)?\\?(( or | \|\| ).*)?$
18
18
# Python type hints, Swift typing
19
19
- ^\s*(?:(?:typing\.)?(?:(?:[Tt]uple|[Ll]ist|[Dd]ict|Callable|Iterable|Sequence|Optional|Union)\[.*|(?:int|str|float|(?:typing.)?Any|None|bytes|bool|ReadableBuffer)\s*(?:[,|].*)?|(?:Int|Swift\.Int|Int32)\.*))\s*$
20
20
# ..., \, , \n, \0, ',' and other single chars, smilies, hex, digits, nothing at all,
21
21
# directories, regex, format string placeholder, urllib demo passphrase, "optional" in docs, a variable substitution, or surrounded by brackets of various kinds
22
22
# all with possible ',' and surrounding whitespace, possibly with a following comment
23
- - ^\s*(?:\.\.\.|\\|\\n|\\0|\?|[,()[\]{}`.]\\?|-[)(]|\\f21b|0x[A-Fa-f0-9]+|[0-9]{1,4}|(?:~|/tmp|\.\.|\.)|\\{1,2}w\+/g,( \\?)?|%[sr]|geheim\$parole|\([Oo]ptional\).*|\$?(?:\{\{?[^}]+\}\}?|\(\(?[^)]+\)\)?|\[\[?[^\]+]\]\]?)|(before|hover|focus)(,| \{))?,?\s*(?:\s*(?:/\*|#|//).*)?$
23
+ - ^\s*(?:\.\.\.|\\|\\n|\\0|\?|\$\(| [,()[\]{}`.]\\?|-[)(]|\\f21b|0x[A-Fa-f0-9]+|[0-9]{1,4}|(?:~|/tmp|\.\.|\.)|\\{1,2}w\+/g,( \\?)?|%[sr]|geheim\$parole|\([Oo]ptional\).*|\$?(?:\{\{?[^}]+\}\}?|\(\(?[^)]+\)\)?|\[\[?[^\]+]\]\]?)|(before|hover|focus)(,| \{))?,?\s*(?:\s*(?:/\*|#|//).*)?$
24
24
# function definitions, e.g. Javascript, function calls or variable declaration
25
25
- ^(?:function\s*\([^)]*\)\s*{\s*.*|\([^)]*\)\s*=>\s*(?:{\s*|[^;)]+[;)])|(?:new |\([A-Za-z]+\)\s*)?[a-zA-Z0-9_.]+\s*\(.*|(?:public|private) [A-Za-z0-9_]+ \{|[A-Za-z0-9_.-]+\s*\) \{)$|\{\{[^}]+\}\}|\$\{\{
26
26
# reference to a member variable, index into a variable, bash variables, perl hash key index, environment vars
@@ -53,7 +53,7 @@ patterns:
53
53
pattern : |
54
54
[0-9a-f]{32}|[0-9a-f]{40}|[0-9a-f]{64}
55
55
start : |
56
- (?:\A|[^a-zA-Z0-9])(?i)(?:api|auth[a-z]+|jwt|mysql|db)?[_.-]?(?:pass?(?:wo?r?d|code|phrase)|secret|key|token)([_-][a-z+])? ([ \t]+As[ \t]+String)?[\t ]*(={1,3}|:)[\t ]*(?:["']|b["'])?
56
+ (?:\A|[^a-zA-Z0-9])(?i)(?:api|auth[a-z]+|jwt|mysql|db)?[_.-]?(?:pass?(?:wo?r?d|code|phrase)|secret|key|token)([_-][a-z0-9]+){0,3} ([ \t]+As[ \t]+String)?[\t ]*(={1,3}|:)[\t ]*(?:["']|b["'])?
57
57
end : |
58
58
(\z|[\r\n'"])
59
59
test :
@@ -73,14 +73,18 @@ patterns:
73
73
pattern : |
74
74
(([A-Za-z0-9+/]){4})+[A-Za-z0-9+/]{1,2}={0,2}
75
75
start : |
76
- (?:\A|[^a-zA-Z0-9])(?i)(?:api|auth[a-z]+|jwt|mysql|db)?[_.-]?(?:pass?(?:wo?r?d|code|phrase)|secret|key|token)([_-][a-z+])? ([ \t]+As[ \t]+String)?[\t ]*(={1,3}|:)[\t ]*(?:["']|b["'])?
76
+ (?:\A|[^a-zA-Z0-9])(?i)(?:api|auth[a-z]+|jwt|mysql|db)?[_.-]?(?:pass?(?:wo?r?d|code|phrase)|secret|key|token)([_-][a-z0-9]+){0,3} ([ \t]+As[ \t]+String)?[\t ]*(={1,3}|:)[\t ]*(?:["']|b["'])?
77
77
end : |
78
78
(\z|[\r\n'"])
79
79
additional_match :
80
80
- ' [0-9]'
81
81
- ' [A-Z]'
82
82
- ' [a-z]'
83
83
- ' ^.{12,}$'
84
+ test :
85
+ data : password="AAAAAAAAAAAa00=="
86
+ start_offset : 10
87
+ end_offset : 26
84
88
comments :
85
89
- " The Base64 must contain numbers, upper case and lower case and be at least 12 characters long"
86
90
- " `password`, `secret`, `key`, or password like prefix (fuzzy)"
@@ -124,7 +128,7 @@ patterns:
124
128
pattern : |
125
129
[a-zA-Z0-9_.=/+:-]+
126
130
start : |
127
- \b([Bb]earer|[Tt]oken)[ ]+
131
+ \b([Bb]earer |[Tt]oken (token=)?)
128
132
end : |
129
133
\z|[\s'"]
130
134
additional_not_match :
@@ -148,6 +152,7 @@ patterns:
148
152
- " As used in an Authorization header"
149
153
- " We try to remove common placeholders"
150
154
155
+
151
156
- name : OAuth client secret and ID pair
152
157
type : oauth_client_secret
153
158
regex :
0 commit comments