@@ -7,22 +7,69 @@ patterns:
7
7
regex :
8
8
version : 0.4
9
9
pattern : |
10
- [a-zA-Z0-9\ t !.,$%&*+?^_`{|}()[\]\\/~-]+
10
+ [a-zA-Z0-9!.,$%&*+?^_`{|}()[\]\\/~-][a-zA-Z0-9\ t !.,$%&*+?^_`{|}()[\]\\/~-]*
11
11
start : |
12
- (?i)(?:api|jwt|mysql)?[_.-]?(?:pass?(?:wo?r?d|code|phrase)?|pwd|secret|token )[\t ]*[=:] [\t ]*["']?
12
+ (?i)(?:api|jwt|mysql)?[_.-]?(?:pass?(?:wo?r?d|code|phrase)?|pwd? |secret)[\t ]*(={1,3}|:) [\t ]*["']?
13
13
end : |
14
14
(\z|[\r\n'"])
15
- additional_not_match :
16
- - \b((?i)(?:pass?(wo?r?d|code|phrase)?|pwd|secret|token|write|read|on|off|true|false|placeholder|dummy|none)\b
17
- - ^[\t \r\n"'()${}].*
18
-
15
+ additional_not_match :
16
+ # something that means "password" or a placeholder name - either a variable or a placeholder
17
+ - ^(?i)(?:[A-Za-z0-9_.]*,\s*)?(?:str\()?[[<(]?(?:(?:user|key)_?)?(?:pass?(wo?r?d|code|phrase)|pass|pwd|secret|token|tok|redacted|placeholder|dummy|pw|thephrase),?[\]>)]?\\?$
18
+ - ^.*token.*$
19
+ - ^[a-zA-Z0-9._]+[_.](?:password|passphrase|secret|key).*$
20
+ - ^.* passphrase .*$
21
+ # a literal value or config switch
22
+ - ^(?i)(?:[a-zA-Z0-9_.]*,\s*)?[[<(]?(?:write|read|on|off|true|false|none|null|nil|undefined|eof|ignore|eol|git),?[\]>)]?(?:\)\s*\{)?\\?$
23
+ - ^\s*%[sr]\s*$ # format string placeholder
24
+ - ^\s*$ # whitespace
25
+ - ^\s*(?:int|str|Any|None|bytes|bool)\s*([,|].*)?\s*$ # Python basic type hints
26
+ # Python container type hints
27
+ - ^\s*(?:[Tt]uple|[Ll]ist|[Dd]ict|Callable|Iterable|Sequence|Optional)\[.*\]\s*$
28
+ - ^\s*\.\.\.\s*$ # ...
29
+ - ^\s*\\\s*$ # a bare backslash
30
+ - ^\s*,s*$ # a bare comma
31
+ - ^\\0$ # literal \0
32
+ # function definitions, e.g. Javascript
33
+ - ^function\s*\([^)]*\)\s*{\s*
34
+ - ^\([^)]*\)\s*=>\s*(?:{\s*|[^;)]+[;)])$
35
+ # short numbers, possibly followed by a comment (some kind of tokenisation)
36
+ - ^\s*[0-9]{1,4}(?:\s*(?:/\*|#|//).*)?$
37
+ # function calls or a new variable
38
+ - ^(?:new )?[a-zA-Z0-9_.]+\(.*$
39
+ # reference to a member variable
40
+ - ^\s*(?:self|this)\.[a-zA-Z_][a-zA-Z0-9_]+[,[]?\s*$
41
+ # index into a variable
42
+ - ^\s*[a-zA-Z0-9_.]+\[(?:[a-zA-Z0-9_.]+)?\]?\s*$
43
+ # directories
44
+ - ^\s*(?:~|/tmp|\.\.|\.)\s*$
45
+ # regex
46
+ - ^\\{1,2}w\+/g,( \\?)?$
47
+ # a variable substitution
48
+ - ^\s*\$\{[^}]+}\s*$
49
+ # surrounded by {}
50
+ - ^\s*\{[^}]*\}\s*$
51
+ # surrounded by []
52
+ - ^\s*\[[^\]]*\]\s*$
53
+ # - ^["'()${}].* # check this!
54
+ # stray single chars
55
+ - ^[,()[\]{}`.]\\?$
56
+ # urllib demo passphrase
57
+ - ^geheim\$parole$
58
+ # docs
59
+ - ^\s*\([Oo]ptional\).*$
60
+ # smilies
61
+ - ^-[)(]$
62
+
19
63
expected :
20
64
- name : passwords.js
21
65
start_offset : 14
22
66
end_offset : 25
23
67
- name : passwords.js
24
68
start_offset : 41
25
69
end_offset : 62
70
+ - name : passwords.js
71
+ start_offset : 97
72
+ end_offset : 112
26
73
27
74
comments :
28
75
- " `password`, `secret`, `key`, or password like prefix (fuzzy)"
@@ -35,7 +82,16 @@ patterns:
35
82
regex :
36
83
version : 0.1
37
84
pattern : |
38
- [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
85
+ (?i)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
86
+ start : |
87
+ \A|[^0-9A-Fa-f-]
88
+ end : |
89
+ \z|[^0-9A-Fa-f-]
90
+ additional_not_match :
91
+ - ^12345678-1234-5678-1234-567812345678$
92
+ - ^00000000-0000-0000-0000-000000000000$
93
+ - ^(?i)00010203-0405-0607-0809-0a0b0c0d0e0f$
94
+ - ^(?i)12345678-1234-1234-1234-123456789abc$
39
95
expected :
40
96
- name : uuids.txt
41
97
start_offset : 12
@@ -46,3 +102,4 @@ patterns:
46
102
- name : uuids.txt
47
103
start_offset : 131
48
104
end_offset : 167
105
+
0 commit comments