Skip to content

Commit fbeeb4c

Browse files
committed
Added test data for generic base64 pw
1 parent 2be7749 commit fbeeb4c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

generic/patterns.yml

+11-6
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ patterns:
88
pattern: |
99
[a-zA-Z0-9!.,$%&*+?^_`{|}()[\]\\/~-][a-zA-Z0-9\t !.,$%&*+?^_`{|}()[\]\\/~-]*
1010
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["'])?
1212
end: |
1313
(\z|[\r\n'"])
1414
additional_not_match:
1515
# something that means "password" or a placeholder name - either a variable or a placeholder
1616
# 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 | \|\| ).*)?$
1818
# Python type hints, Swift typing
1919
- ^\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*$
2020
# ..., \, , \n, \0, ',' and other single chars, smilies, hex, digits, nothing at all,
2121
# directories, regex, format string placeholder, urllib demo passphrase, "optional" in docs, a variable substitution, or surrounded by brackets of various kinds
2222
# 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*(?:/\*|#|//).*)?$
2424
# function definitions, e.g. Javascript, function calls or variable declaration
2525
- ^(?: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*\) \{)$|\{\{[^}]+\}\}|\$\{\{
2626
# reference to a member variable, index into a variable, bash variables, perl hash key index, environment vars
@@ -53,7 +53,7 @@ patterns:
5353
pattern: |
5454
[0-9a-f]{32}|[0-9a-f]{40}|[0-9a-f]{64}
5555
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["'])?
5757
end: |
5858
(\z|[\r\n'"])
5959
test:
@@ -73,14 +73,18 @@ patterns:
7373
pattern: |
7474
(([A-Za-z0-9+/]){4})+[A-Za-z0-9+/]{1,2}={0,2}
7575
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["'])?
7777
end: |
7878
(\z|[\r\n'"])
7979
additional_match:
8080
- '[0-9]'
8181
- '[A-Z]'
8282
- '[a-z]'
8383
- '^.{12,}$'
84+
test:
85+
data: password="AAAAAAAAAAAa00=="
86+
start_offset: 10
87+
end_offset: 26
8488
comments:
8589
- "The Base64 must contain numbers, upper case and lower case and be at least 12 characters long"
8690
- "`password`, `secret`, `key`, or password like prefix (fuzzy)"
@@ -124,7 +128,7 @@ patterns:
124128
pattern: |
125129
[a-zA-Z0-9_.=/+:-]+
126130
start: |
127-
\b([Bb]earer|[Tt]oken)[ ]+
131+
\b([Bb]earer |[Tt]oken (token=)?)
128132
end: |
129133
\z|[\s'"]
130134
additional_not_match:
@@ -148,6 +152,7 @@ patterns:
148152
- "As used in an Authorization header"
149153
- "We try to remove common placeholders"
150154

155+
151156
- name: OAuth client secret and ID pair
152157
type: oauth_client_secret
153158
regex:

0 commit comments

Comments
 (0)