mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6a87ca58c | ||
|
|
73a3cf8afb | ||
|
|
d196b83ca6 | ||
|
|
35f2ea5da2 | ||
|
|
70028079b4 | ||
|
|
c14af5ffdf | ||
|
|
06b1396a2a | ||
|
|
5d3f247d7d | ||
|
|
404dd8e0c0 | ||
|
|
3a1ab48818 | ||
|
|
f5c2b636f3 | ||
|
|
b5ed7ff1b2 | ||
|
|
09007da395 | ||
|
|
d51ce47d86 | ||
|
|
6919447094 | ||
|
|
c3b7932544 | ||
|
|
82e409a434 | ||
|
|
0eb57cbe4d | ||
|
|
3531887941 | ||
|
|
e9ebde73bc | ||
|
|
469cd22f61 | ||
|
|
93e72c215d | ||
|
|
865478bcdc | ||
|
|
d6c0de7c85 | ||
|
|
0266ab8958 | ||
|
|
6b7ab73a52 | ||
|
|
61ee7c58cc | ||
|
|
ad7509e3b4 | ||
|
|
a62cc52aba | ||
|
|
f93e5dc844 | ||
|
|
8481f0e9cd | ||
|
|
82f7d61593 | ||
|
|
a42b32bdf1 | ||
|
|
79638b080c | ||
|
|
3474c58c9e | ||
|
|
d8cd93cabe | ||
|
|
48b79facfa | ||
|
|
e23f7f58f3 | ||
|
|
606bb1a13b | ||
|
|
e784980515 | ||
|
|
c33ee3f252 | ||
|
|
b0a958f55e | ||
|
|
237b03af18 | ||
|
|
f348991d21 | ||
|
|
e0745adbd2 | ||
|
|
1ddc924a67 | ||
|
|
0b07625567 | ||
|
|
0cabbf8ca8 | ||
|
|
ba9e089e35 | ||
|
|
31ff8677dd | ||
|
|
3e5e63956e | ||
|
|
57f9bc83d1 | ||
|
|
6e72472b60 | ||
|
|
9326f35380 | ||
|
|
19555579c8 | ||
|
|
60dd607312 | ||
|
|
c3b799ec63 | ||
|
|
4b6f4d0de5 | ||
|
|
fbfb3f591e | ||
|
|
b91799aa18 | ||
|
|
db1b54bf9f | ||
|
|
e9529744f8 | ||
|
|
d1f642a9df | ||
|
|
9261f1c47f | ||
|
|
991223abab | ||
|
|
801d44a6e4 | ||
|
|
44d7d89e19 | ||
|
|
aae23acff3 | ||
|
|
705595aaf6 | ||
|
|
43ec22429f | ||
|
|
36779df3bb | ||
|
|
3d3d801729 | ||
|
|
0f2ffee6f9 | ||
|
|
f4d37a2c0d | ||
|
|
be5596df1d | ||
|
|
e97f26bb5f | ||
|
|
ae13c96df8 | ||
|
|
d15dfdc387 | ||
|
|
631d8dcf03 | ||
|
|
192b96289f | ||
|
|
b8141713e8 | ||
|
|
3fedf6f8e7 | ||
|
|
6f6ebd454f | ||
|
|
ce42947cae | ||
|
|
84e285e4ce | ||
|
|
928c6a6043 | ||
|
|
106897fdf0 | ||
|
|
98d5648f6e | ||
|
|
9358e84588 | ||
|
|
958c18f0b7 | ||
|
|
089639e9fb | ||
|
|
85afd767f7 | ||
|
|
38006fb93b | ||
|
|
9ae1def963 | ||
|
|
6517900e5a | ||
|
|
5e51da600b | ||
|
|
f0b8d26c99 | ||
|
|
1724591029 | ||
|
|
80d29764a0 | ||
|
|
f498b1d308 | ||
|
|
8eabfd614e | ||
|
|
4acd7a3c8d | ||
|
|
a37822dffd | ||
|
|
1c6b28aa61 | ||
|
|
f15b4e408b | ||
|
|
d5f9d2b5d2 | ||
|
|
67a7069bb8 | ||
|
|
fd5d786538 | ||
|
|
c017b763f3 | ||
|
|
e796458763 | ||
|
|
2a9fbbc64d | ||
|
|
d6081d0cc4 | ||
|
|
e6c3a495ce | ||
|
|
93f292c3df | ||
|
|
780fb4a8f1 | ||
|
|
0d9ab37ba4 | ||
|
|
acffe44440 | ||
|
|
178f78fa14 | ||
|
|
1ab1ae0e70 | ||
|
|
9f8ca91b8b | ||
|
|
eec6c5a391 | ||
|
|
714c0bef1e | ||
|
|
e9b699dda1 | ||
|
|
5afe59d2fa | ||
|
|
8adf27b1ea | ||
|
|
aecd32075e | ||
|
|
290118cbbe | ||
|
|
d2e1e43a25 | ||
|
|
2161ff358b | ||
|
|
f338bc584f | ||
|
|
e6a132bf4f | ||
|
|
8625cc30db | ||
|
|
7cc3d7e467 | ||
|
|
b8ff5eec73 | ||
|
|
36a4871585 | ||
|
|
c85ebbb2ba | ||
|
|
3a3e13c3b5 | ||
|
|
14a00e1ffd | ||
|
|
bd707fa9c4 | ||
|
|
5e6b1840df | ||
|
|
d8e3a694f2 | ||
|
|
05e3462025 | ||
|
|
b83fe80968 | ||
|
|
5db0159c52 | ||
|
|
5f87c4137c | ||
|
|
ea94318ba3 | ||
|
|
3128789777 | ||
|
|
270207e5eb | ||
|
|
efe96640fc | ||
|
|
0137637c2c | ||
|
|
6adc045580 | ||
|
|
45c898c5ea | ||
|
|
95f8bd0daa | ||
|
|
2cc2519302 | ||
|
|
be13bba64c | ||
|
|
7111a698c0 | ||
|
|
8b9092a248 | ||
|
|
0aa05133a9 | ||
|
|
2952df5432 | ||
|
|
541e26b067 | ||
|
|
6018a6bb70 | ||
|
|
ca987b3842 | ||
|
|
67f8d28d7f | ||
|
|
f88abe99d7 | ||
|
|
6ddf27c5c3 | ||
|
|
aadd9387b2 | ||
|
|
0fd68c901d | ||
|
|
17a3943afe | ||
|
|
abc73e2443 | ||
|
|
3c1751e5c4 | ||
|
|
a32ef6afc4 | ||
|
|
127df8a6f0 | ||
|
|
aa91fd3e5e | ||
|
|
c8e97d97f9 | ||
|
|
67e3603ba4 | ||
|
|
f62617d7a6 | ||
|
|
9324184c24 | ||
|
|
a80ce0d251 | ||
|
|
c1c4a93f98 | ||
|
|
e74e6292ee | ||
|
|
25c3e92c2a | ||
|
|
9ab424172d | ||
|
|
28fd47e170 | ||
|
|
8250e40a75 | ||
|
|
f735c9a5c9 | ||
|
|
e7553b0168 | ||
|
|
12d276acd7 | ||
|
|
e6934bf0a5 | ||
|
|
6f5ad9dc0b | ||
|
|
a2019a4782 | ||
|
|
5d7b7718ec | ||
|
|
190877a24b | ||
|
|
144362b972 | ||
|
|
d353ac5108 | ||
|
|
a27a08904a | ||
|
|
5ef4e336ce | ||
|
|
78f2c46517 | ||
|
|
bdcb9e33a8 | ||
|
|
6e4e9df55f | ||
|
|
b3bed5658d | ||
|
|
a10ae91ba7 | ||
|
|
a8dbc7f107 | ||
|
|
4544156b44 | ||
|
|
b52e8c9c7c | ||
|
|
0ce1249b95 | ||
|
|
3932ed6baf | ||
|
|
981b636920 | ||
|
|
c8e15c731a | ||
|
|
901f932a89 | ||
|
|
c0a9580a65 | ||
|
|
8be91eea5d | ||
|
|
1c6f2252b8 | ||
|
|
58d130c5f3 | ||
|
|
091ea81e68 | ||
|
|
f036dce6ab | ||
|
|
2d58f1f94e | ||
|
|
86cfe0848b | ||
|
|
973d74e592 | ||
|
|
3909ebe03b | ||
|
|
65f42020af | ||
|
|
65a91ae976 | ||
|
|
7db08bfd90 | ||
|
|
af26553292 | ||
|
|
d5e431e7d4 | ||
|
|
54ba3ec377 | ||
|
|
656ef1c9a7 | ||
|
|
b8accd7273 | ||
|
|
238c31beaa | ||
|
|
eb31190f31 | ||
|
|
389d45e380 | ||
|
|
81b3a6e279 | ||
|
|
c50906373c | ||
|
|
40545fb680 | ||
|
|
2acc34dfdf | ||
|
|
ede68fd95d | ||
|
|
6c60c3dde3 | ||
|
|
ad505754fc | ||
|
|
21d81879e2 | ||
|
|
b5ca2ba614 | ||
|
|
ef4655fcf1 | ||
|
|
01b553a75d | ||
|
|
fae366a404 | ||
|
|
6129b1a15d | ||
|
|
31d03a1146 | ||
|
|
eabc7b5c12 | ||
|
|
1dc7569f95 | ||
|
|
1797e9c966 | ||
|
|
e2eaceb4cd | ||
|
|
c637b129ec | ||
|
|
8470e43d7f | ||
|
|
94f5950d68 | ||
|
|
fe69a17c9c | ||
|
|
6ca7a11d88 | ||
|
|
cfbb600fcb | ||
|
|
e36b550851 | ||
|
|
2232dc191c | ||
|
|
bdc688dd53 | ||
|
|
e0f6399d5c | ||
|
|
3e88ac6726 | ||
|
|
d0088f6c7c | ||
|
|
0d7c18cb39 | ||
|
|
d0e98416b9 | ||
|
|
b7438011b4 | ||
|
|
4e59d3bf19 | ||
|
|
e4b26aea4a | ||
|
|
473d0d55a7 | ||
|
|
8bd4649b01 | ||
|
|
a69df84325 | ||
|
|
0faebdefea | ||
|
|
a728e3abf3 | ||
|
|
e87c62fe72 | ||
|
|
4801818e3d | ||
|
|
b4a0577786 | ||
|
|
212232f80a | ||
|
|
11dcb44e41 | ||
|
|
af0df6ea2c | ||
|
|
9db91442b3 | ||
|
|
9d76070806 | ||
|
|
2fa580f1bb | ||
|
|
c6f15b768e | ||
|
|
779937ca87 | ||
|
|
731856e974 | ||
|
|
baf54631c7 | ||
|
|
3e760d7fed | ||
|
|
679f00dc9c | ||
|
|
dae5c142d7 | ||
|
|
8e8873286e | ||
|
|
6693cbdde3 | ||
|
|
8b3ce2cb1e | ||
|
|
94cae90d1e | ||
|
|
c4b07f5113 | ||
|
|
01d73028f8 | ||
|
|
862f1203ed | ||
|
|
581e81c16e | ||
|
|
6c166c9530 | ||
|
|
4181ede6cd | ||
|
|
10745be661 | ||
|
|
ee2d73c740 | ||
|
|
e7fbcf5333 | ||
|
|
2810eccc82 | ||
|
|
baff419091 | ||
|
|
d13e0fdfde | ||
|
|
5a300c3c64 | ||
|
|
d8ddb9630a | ||
|
|
1537eeb5fa | ||
|
|
1a492537dd | ||
|
|
bd4107b002 | ||
|
|
7b48cadf6d | ||
|
|
6eab8a7a0a | ||
|
|
c6d14e5b7d | ||
|
|
ce95cafd54 | ||
|
|
4024faceab | ||
|
|
1afa931248 | ||
|
|
2474c39311 | ||
|
|
f6460a7365 | ||
|
|
b47e00858e | ||
|
|
b200a13c8d | ||
|
|
e6fabdbb31 | ||
|
|
cdd654eab7 | ||
|
|
2f07b96333 | ||
|
|
62e74b2b18 | ||
|
|
e75693b131 | ||
|
|
3cd14d4696 | ||
|
|
d29cc9892c | ||
|
|
d996882f4e | ||
|
|
17b6aa856d | ||
|
|
c21a9cf121 | ||
|
|
d3c4342c15 | ||
|
|
b4c2f8e69c | ||
|
|
a0f72a4e35 | ||
|
|
24844002de | ||
|
|
593edeae21 | ||
|
|
6df770d261 | ||
|
|
4f0c9dcede | ||
|
|
52425a8ca9 | ||
|
|
454acebe5a | ||
|
|
6fcf91e934 | ||
|
|
f89b8f2b29 | ||
|
|
648a7ba577 | ||
|
|
7c5594c39d | ||
|
|
274e8212a6 | ||
|
|
36c6ddaf86 | ||
|
|
15ed72bc09 | ||
|
|
ace8de93a9 | ||
|
|
45a4c0a284 | ||
|
|
c5e1e8abc0 | ||
|
|
ef38b69c39 | ||
|
|
ac6bde9996 | ||
|
|
23568cc0ba | ||
|
|
e61c2cfae7 | ||
|
|
38e0b11995 | ||
|
|
31903d1a80 | ||
|
|
3655284b57 | ||
|
|
db79a96118 | ||
|
|
5152e1fc63 | ||
|
|
c04e137b28 | ||
|
|
9b3342fbff | ||
|
|
d9a060a12d | ||
|
|
77f2fdd09a | ||
|
|
dba1ef6104 | ||
|
|
725da55905 | ||
|
|
cfac551ab8 | ||
|
|
c559fdbf04 | ||
|
|
e2ac47cd06 | ||
|
|
8ef16d9efb | ||
|
|
b6f726654e | ||
|
|
8cbb84c50f | ||
|
|
f3eac0c958 | ||
|
|
3211cfbbb1 | ||
|
|
c6934f5eab | ||
|
|
f8c054b879 | ||
|
|
ad2a64c82b | ||
|
|
9e0028fe73 | ||
|
|
dfbd01a980 | ||
|
|
86737955de | ||
|
|
7f0b027486 | ||
|
|
4d04ea079f | ||
|
|
6e1c41b536 | ||
|
|
275232f8c8 | ||
|
|
c8f9560aa3 | ||
|
|
315ee56024 | ||
|
|
e446ba0738 | ||
|
|
2ccd40677d | ||
|
|
41ef2a8cd2 | ||
|
|
d8acd1354f | ||
|
|
e28cfd1ad5 | ||
|
|
e5f5e64cdb | ||
|
|
b55d88dc15 | ||
|
|
f3360cbf66 | ||
|
|
065b621604 | ||
|
|
fd87df475c | ||
|
|
c7b6792956 | ||
|
|
1f2d11003d | ||
|
|
6432f11a6b | ||
|
|
7d53fb5951 | ||
|
|
b9aa3ef97d | ||
|
|
c271497ecb | ||
|
|
e05c4645ac | ||
|
|
63d8e6e21b | ||
|
|
5bd59b0d8c | ||
|
|
464e152783 | ||
|
|
91406b0c4c | ||
|
|
04e81270cb | ||
|
|
69c6695765 | ||
|
|
9e0e050f92 | ||
|
|
b2efcf36c8 | ||
|
|
ba39abfb19 | ||
|
|
f47e1f71ee | ||
|
|
6d980b4eab | ||
|
|
ca18e8e2f6 | ||
|
|
ec436d7b33 | ||
|
|
38a511f6ba | ||
|
|
15ac1ffdd1 | ||
|
|
eb977ba237 | ||
|
|
9a6b1c3bbb | ||
|
|
95443e742c | ||
|
|
0c94db2d6b | ||
|
|
9808551eed | ||
|
|
b6fe5b08d3 | ||
|
|
5309811a09 | ||
|
|
3b6c198715 | ||
|
|
57bfa41b33 | ||
|
|
474266c0b5 | ||
|
|
c891470344 | ||
|
|
e6004da801 | ||
|
|
e18b1a884a | ||
|
|
faeb0914b2 | ||
|
|
d6578df998 | ||
|
|
f010513d17 | ||
|
|
d4be9602e3 | ||
|
|
7676690697 | ||
|
|
f4b9b6d0b3 | ||
|
|
7a3d155675 | ||
|
|
68b6388ef7 | ||
|
|
547e9768ec | ||
|
|
8608cf5b48 | ||
|
|
a08ddedb88 | ||
|
|
398366a615 | ||
|
|
7dfa3f2b48 | ||
|
|
2e7325ce03 | ||
|
|
cb74386ef0 | ||
|
|
87d6c588a6 | ||
|
|
df8a2d35a8 | ||
|
|
c4da547503 | ||
|
|
7bd55e33b5 | ||
|
|
256ace38d7 | ||
|
|
4c20d5d85c | ||
|
|
ac43c67a47 | ||
|
|
d2d68a7e44 | ||
|
|
27aee19a35 | ||
|
|
2a6bd1636f | ||
|
|
7b82e29e7e | ||
|
|
4fd2f06a0d | ||
|
|
8016dffe18 | ||
|
|
10004da36f | ||
|
|
633e06a7c7 | ||
|
|
660350c9b1 | ||
|
|
9122aa6cf4 | ||
|
|
56c89866a2 | ||
|
|
f9be4e543a | ||
|
|
042b82e2af | ||
|
|
9176896742 | ||
|
|
4ea0c66bec | ||
|
|
ae4542abf0 | ||
|
|
ac14d347de | ||
|
|
c2143c5843 | ||
|
|
e79ffc6ae8 | ||
|
|
a56c2341cf | ||
|
|
1c14586cde | ||
|
|
2b995fda44 | ||
|
|
5d68b48af3 | ||
|
|
f90a00b564 | ||
|
|
4bc7c13310 | ||
|
|
771055fd59 | ||
|
|
75c70bf804 | ||
|
|
c5f34a6704 | ||
|
|
463871a307 | ||
|
|
fa1080d066 | ||
|
|
52cfad1d08 | ||
|
|
9e294f5910 | ||
|
|
9f8326de56 | ||
|
|
79c3f99165 | ||
|
|
d4925443c8 | ||
|
|
fa27d32bfe | ||
|
|
230a52e3e3 | ||
|
|
15dedda59a | ||
|
|
3b45fb91e3 | ||
|
|
f378319395 | ||
|
|
98173b3aa6 | ||
|
|
36340c8f2f | ||
|
|
77b6d90a16 | ||
|
|
6b3bd46fa8 | ||
|
|
8485f88158 | ||
|
|
d2baa9e675 | ||
|
|
7fa9c802f5 | ||
|
|
8f1bc74e26 | ||
|
|
8de38be418 | ||
|
|
ec1ebd4686 | ||
|
|
81ddfbed88 | ||
|
|
63814f1eaf | ||
|
|
38a36add57 | ||
|
|
9e39927ac6 | ||
|
|
0ba9dda0f0 | ||
|
|
a24f9a2c92 | ||
|
|
f57158a893 | ||
|
|
1e3bf42464 | ||
|
|
9d6a75fbab | ||
|
|
6fa52ae7cc | ||
|
|
bb9c459a1a | ||
|
|
432c76a9d9 | ||
|
|
1cdf315bfa | ||
|
|
777601a0ea | ||
|
|
35d170018e | ||
|
|
af2e99ef45 | ||
|
|
734befb555 | ||
|
|
64c8d618a2 | ||
|
|
92bb4ea6fc | ||
|
|
98b025da72 | ||
|
|
af7717412f | ||
|
|
68c2a18f6f | ||
|
|
ea49078ffd | ||
|
|
b902d7310a | ||
|
|
3591560b34 | ||
|
|
949029ca89 | ||
|
|
cde0894711 | ||
|
|
342e9f80db | ||
|
|
96b0f4aab7 | ||
|
|
3af6a546ac | ||
|
|
6e086c4297 | ||
|
|
db08fc0564 | ||
|
|
dbb6d4cc5f | ||
|
|
d0f44da4c2 | ||
|
|
cb6b01cc5d | ||
|
|
392d79b9e2 | ||
|
|
f8e609d4bf | ||
|
|
573bf46fd1 | ||
|
|
d65592bbcc | ||
|
|
169a137e7f | ||
|
|
bd61f2d2f7 | ||
|
|
793bbc793f | ||
|
|
4aa7be2dbf | ||
|
|
35531233d9 | ||
|
|
54949bd62a | ||
|
|
e95a8a7158 | ||
|
|
de0a70a835 | ||
|
|
9f8feca926 | ||
|
|
c50187559b | ||
|
|
c2cf6327c2 | ||
|
|
1ea773ddfb | ||
|
|
79a8983bac | ||
|
|
7d5ed837a4 | ||
|
|
60267523e9 | ||
|
|
8153da6e9c | ||
|
|
5f6fb388ec | ||
|
|
ba49396755 | ||
|
|
40240cb5ee | ||
|
|
bba926693e | ||
|
|
9103834503 | ||
|
|
7e3c740592 | ||
|
|
35a59746df | ||
|
|
23b5ce3264 | ||
|
|
03c53d2978 | ||
|
|
695449d73d | ||
|
|
6bad1e7194 | ||
|
|
77dec1461b | ||
|
|
14d77f59d4 | ||
|
|
afb598cf15 | ||
|
|
b4c6fe92e0 | ||
|
|
f50577be1c | ||
|
|
c358ae9310 | ||
|
|
9554258d02 | ||
|
|
95ee2cc30e | ||
|
|
79a35f0c27 | ||
|
|
7a021cda9e | ||
|
|
447f7a04cb | ||
|
|
e5b62cbc7c | ||
|
|
6739a34f74 | ||
|
|
e502bf29de | ||
|
|
51b504bf99 | ||
|
|
107d582e7b | ||
|
|
ea42ed406f | ||
|
|
c869812875 | ||
|
|
4f7ce9c195 | ||
|
|
847687a637 | ||
|
|
94389137e8 | ||
|
|
98e6ba9378 | ||
|
|
e288db29a8 | ||
|
|
98aeee9b1d | ||
|
|
45a2aa8495 | ||
|
|
4b350987a1 | ||
|
|
3b2b754fe5 | ||
|
|
64e7afea98 | ||
|
|
16765c19cf | ||
|
|
87d916fc24 | ||
|
|
21b59fab5d | ||
|
|
9272e1e556 | ||
|
|
0a51dabb17 | ||
|
|
8c1cee4e00 | ||
|
|
4d5315e2ca | ||
|
|
88cc9bb363 | ||
|
|
80e41ee14c | ||
|
|
23489f3f18 | ||
|
|
a998ddc9d4 | ||
|
|
833963c1c1 | ||
|
|
4b11f87f80 | ||
|
|
923dcf0311 | ||
|
|
8896cf66cd | ||
|
|
df133ccaf8 | ||
|
|
23cd693d71 | ||
|
|
524d81fde9 | ||
|
|
d387f528c4 | ||
|
|
dcda26578b | ||
|
|
28639d3a49 | ||
|
|
19e23c9cbe | ||
|
|
160015b872 | ||
|
|
abdf2c47f0 | ||
|
|
8536f16ceb | ||
|
|
6862c13bf7 | ||
|
|
9939c638ec | ||
|
|
ed3a512b4b | ||
|
|
7c988c927d | ||
|
|
bde9af44ea | ||
|
|
eee4d05642 | ||
|
|
9144594d77 | ||
|
|
1cb15242fd | ||
|
|
08498600d1 | ||
|
|
88c0c7779b | ||
|
|
67454d109e | ||
|
|
ce603c73b4 | ||
|
|
55218fc8f8 | ||
|
|
5d81c650e8 | ||
|
|
0726209172 | ||
|
|
bfec8aca51 | ||
|
|
a9b30edb06 | ||
|
|
cc6d698e63 | ||
|
|
2ba97d0fa3 | ||
|
|
d299b5aa7f | ||
|
|
0a209b60a5 | ||
|
|
fe8c6271f2 | ||
|
|
42fb085684 | ||
|
|
3faec00bf9 | ||
|
|
93669f1ee8 | ||
|
|
fad98cbde2 | ||
|
|
8eb28cbb4c | ||
|
|
9dc9a8e62a | ||
|
|
e6caef0d94 | ||
|
|
5e289ed0cc | ||
|
|
d99588fe19 | ||
|
|
a7ccb7a9d1 | ||
|
|
f32abb921d | ||
|
|
e8851c1f99 | ||
|
|
f3a8359ac0 | ||
|
|
829e8fed8c | ||
|
|
c7e3605bff | ||
|
|
c1774b1596 | ||
|
|
35710a7428 | ||
|
|
c7ba4d8bbf | ||
|
|
5585e10933 | ||
|
|
23d5bf0b51 | ||
|
|
b1c7a84fae | ||
|
|
60801b336a | ||
|
|
851ea3df3c | ||
|
|
d482577e47 | ||
|
|
94e7a25b5b | ||
|
|
45d94fa013 | ||
|
|
b4e69ecd37 | ||
|
|
1c2820b4f1 | ||
|
|
215c3f6623 | ||
|
|
39b162cadf | ||
|
|
e0c717c3a3 | ||
|
|
ebb9be999f | ||
|
|
5fbb15be62 | ||
|
|
8922546a00 | ||
|
|
38b7fc3cfb | ||
|
|
8a76e0af27 | ||
|
|
1f80d14f3f | ||
|
|
91eb014f17 | ||
|
|
6122092224 | ||
|
|
55102bd461 | ||
|
|
9927c0bd4b | ||
|
|
ba6f0c4d88 | ||
|
|
a52abe0b31 | ||
|
|
b1ae2a02fe | ||
|
|
f7fca41beb | ||
|
|
a257e9ed2e | ||
|
|
c51944c4d2 | ||
|
|
8e59bf766a | ||
|
|
fa498287b9 | ||
|
|
c77421d077 | ||
|
|
fe977ea857 | ||
|
|
ccef3680d5 | ||
|
|
2c80ad5ea9 | ||
|
|
f5ae1ae88b | ||
|
|
f653ab71c2 | ||
|
|
aec926df5e | ||
|
|
7bbf07e7e6 | ||
|
|
9f3ae4efa0 | ||
|
|
2fd1d44e0a | ||
|
|
e2060e9cd3 | ||
|
|
ce44961e6e | ||
|
|
078b951a43 | ||
|
|
b6b3e768dc | ||
|
|
2fadf219d9 | ||
|
|
ae71ce6ea0 | ||
|
|
041c11d9fc | ||
|
|
c019a9d80d | ||
|
|
0ed0489c2d | ||
|
|
2d27ce7cdf | ||
|
|
032c616f63 | ||
|
|
36c31bf181 | ||
|
|
d85c8d8abd | ||
|
|
39c9cb617c | ||
|
|
648ae701bf | ||
|
|
9dd624affa | ||
|
|
17efe94f95 | ||
|
|
25736d115f | ||
|
|
0d75136c1c | ||
|
|
7919e15a65 | ||
|
|
faca0e14d9 | ||
|
|
59f1f02480 | ||
|
|
c8880ed911 | ||
|
|
095279d60c | ||
|
|
91c39935e4 | ||
|
|
d972792aa1 | ||
|
|
9d544f474a | ||
|
|
01c54e55e7 | ||
|
|
4b21bbef2e | ||
|
|
9e87d94ce7 | ||
|
|
27ab66827d | ||
|
|
87ee13fb3d | ||
|
|
4b4fa00b69 | ||
|
|
1cecd5e090 | ||
|
|
93380ad86a | ||
|
|
c104ff9157 | ||
|
|
73387cbc53 | ||
|
|
bc0dab1c56 | ||
|
|
7554b51ad5 | ||
|
|
224ba41968 | ||
|
|
1b06f1a0dc | ||
|
|
a63f5059f2 | ||
|
|
9393f06d19 | ||
|
|
c11171f47d | ||
|
|
801254f97e | ||
|
|
7a0ce07f99 | ||
|
|
d16d584efa | ||
|
|
780123c5be | ||
|
|
c4738ef26f | ||
|
|
2186f22999 | ||
|
|
aa15ded5c4 | ||
|
|
9f694531b2 | ||
|
|
1669939147 | ||
|
|
e3c7b3a9eb | ||
|
|
1e250f1a14 | ||
|
|
6f5079c193 | ||
|
|
0fa6a79a25 | ||
|
|
970bbca757 | ||
|
|
b9657155b2 | ||
|
|
f58caef16d | ||
|
|
c0797d115a | ||
|
|
744ff2f876 | ||
|
|
4137d3cfc0 | ||
|
|
4a7875bb38 | ||
|
|
14c2bb6ff2 | ||
|
|
44df20e1f3 | ||
|
|
4ffbdde578 | ||
|
|
1d3d9b5983 | ||
|
|
5d995c05a2 | ||
|
|
d9d87410e2 | ||
|
|
fa1afa3e0c | ||
|
|
ad53f2ce34 | ||
|
|
3d2fd8a020 | ||
|
|
668fceb048 | ||
|
|
5114689a34 | ||
|
|
eae4b49966 | ||
|
|
d70dded366 | ||
|
|
864e1eeedc | ||
|
|
73ea4dfe3b | ||
|
|
c0bf19fc44 | ||
|
|
bc26e979c5 | ||
|
|
8f352bd840 | ||
|
|
d465c3d2f1 | ||
|
|
840e9e873f | ||
|
|
5c1bb93068 | ||
|
|
2533ea6661 | ||
|
|
a67910ec00 | ||
|
|
825d434c66 | ||
|
|
5d924ecc53 | ||
|
|
a77b6e4f8b | ||
|
|
c8181dee1b | ||
|
|
4ea51fc98d | ||
|
|
cba584bb18 | ||
|
|
159f5d6185 | ||
|
|
a9c5d5a953 | ||
|
|
cf4c157141 | ||
|
|
9c1ea12d77 | ||
|
|
a705784673 | ||
|
|
2d3bcc7e91 | ||
|
|
e0cfd0b5ca | ||
|
|
6eba1bb24e |
No files matched your search
@@ -0,0 +1,3 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: [zricethezav]
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Basic Info (please complete the following information):**
|
||||||
|
- OS:
|
||||||
|
- Gitleaks Version:
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
|
|
||||||
|
cc @zricethezav
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
|
|
||||||
|
cc @zricethezav
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
name: Maintenance request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
|
|
||||||
|
cc @zricethezav
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
### Description:
|
||||||
|
Explain the purpose of the PR.
|
||||||
|
|
||||||
|
### Checklist:
|
||||||
|
|
||||||
|
* [ ] Does your PR pass tests?
|
||||||
|
* [ ] Have you written new tests for your changes?
|
||||||
|
* [ ] Have you lint your code locally prior to submission?
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
name: gitleaks
|
||||||
|
on: [pull_request, push, workflow_dispatch]
|
||||||
|
jobs:
|
||||||
|
scan:
|
||||||
|
name: gitleaks
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: gitleaks/gitleaks-action@v2
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
name: Create and publish a Docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push-image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Log in to the Container registry
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
zricethezav/gitleaks
|
||||||
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
name: Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "*"
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.17
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: go build -v ./...
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.17
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: make test
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
# Binaries for programs and plugins
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.DS_STORE
|
||||||
|
*.idea
|
||||||
|
*.got
|
||||||
|
gitleaks
|
||||||
|
build
|
||||||
|
|
||||||
|
# configs
|
||||||
|
.gitleaks.toml
|
||||||
|
cmd/generate/config/gitleaks.toml
|
||||||
|
|
||||||
|
# Test binary
|
||||||
|
*.out
|
||||||
|
|
||||||
|
dist/
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
project_name: gitleaks
|
||||||
|
|
||||||
|
builds:
|
||||||
|
- main: main.go
|
||||||
|
binary: gitleaks
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- linux
|
||||||
|
- windows
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- "386"
|
||||||
|
- arm
|
||||||
|
- arm64
|
||||||
|
goarm:
|
||||||
|
- "6"
|
||||||
|
- "7"
|
||||||
|
ldflags:
|
||||||
|
- -s -w -X=github.com/zricethezav/gitleaks/v8/cmd.Version={{.Version}}
|
||||||
|
archives:
|
||||||
|
- builds: [gitleaks]
|
||||||
|
format_overrides:
|
||||||
|
- goos: windows
|
||||||
|
format: zip
|
||||||
|
replacements:
|
||||||
|
amd64: x64
|
||||||
|
386: x32
|
||||||
|
release:
|
||||||
|
prerelease: true
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
- id: gitleaks
|
||||||
|
name: Detect hardcoded secrets
|
||||||
|
description: Detect hardcoded secrets using Gitleaks
|
||||||
|
entry: gitleaks protect --verbose --redact --staged
|
||||||
|
language: golang
|
||||||
|
pass_filenames: false
|
||||||
|
- id: gitleaks-docker
|
||||||
|
name: Detect hardcoded secrets
|
||||||
|
description: Detect hardcoded secrets using Gitleaks
|
||||||
|
entry: zricethezav/gitleaks protect --verbose --redact --staged
|
||||||
|
language: docker_image
|
||||||
+103
@@ -0,0 +1,103 @@
|
|||||||
|
# Contribution guidelines
|
||||||
|
|
||||||
|
## General
|
||||||
|
|
||||||
|
### Issues
|
||||||
|
|
||||||
|
If you have a feature or bug fix you would like to contribute please check if
|
||||||
|
there are any open issues describing your proposed addition. If there are open
|
||||||
|
issues, make a comment stating you are working on fixing or implementing said
|
||||||
|
issue. If not, then please open an issue describing your addition. Make sure to
|
||||||
|
link your PR to an issue.
|
||||||
|
|
||||||
|
### Pull Requests
|
||||||
|
|
||||||
|
Fill out the template as best you can. Make sure your tests pass. If you see a
|
||||||
|
PR that isn't one you opened and want it introduced in the next release,
|
||||||
|
give it a :thumbsup: on the PR description.
|
||||||
|
|
||||||
|
## Adding new Gitleaks rules
|
||||||
|
|
||||||
|
If you want to add a new rule to the [default Gitleaks configuration](https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml) then follow these steps.
|
||||||
|
|
||||||
|
1. Create a `cmd/generate/config/rules/{provider}.go` file.
|
||||||
|
This file is used to generate a new Gitleaks rule.
|
||||||
|
Let's look at `beamer.go` for example. Comments have been added for context.
|
||||||
|
|
||||||
|
```golang
|
||||||
|
func Beamer() *config.Rule {
|
||||||
|
// Define Rule
|
||||||
|
r := config.Rule{
|
||||||
|
// Human redable description of the rule
|
||||||
|
Description: "Beamer API token",
|
||||||
|
|
||||||
|
// Unique ID for the rule
|
||||||
|
RuleID: "beamer-api-token",
|
||||||
|
|
||||||
|
// Regex capture group for the actual secret
|
||||||
|
SecretGroup: 1,
|
||||||
|
|
||||||
|
|
||||||
|
// Regex used for detecting secrets. See regex section below for more details
|
||||||
|
Regex: generateSemiGenericRegex([]string{"beamer"}, `b_[a-z0-9=_\-]{44}`),
|
||||||
|
|
||||||
|
// Keywords used for string matching on fragments (think of this as a prefilter)
|
||||||
|
Keywords: []string{"beamer"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("beamer", "b_"+secrets.NewSecret(alphaNumericExtended("44"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Feel free to use this example as a template when writing new rules.
|
||||||
|
This file should be fairly self-explanatory except for a few items;
|
||||||
|
regex and secret generation. To help with maintence, _most_ rules should
|
||||||
|
be uniform. The functions,
|
||||||
|
[`generateSemiGenericRegex`](https://github.com/zricethezav/gitleaks/blob/master/cmd/generate/config/rules/rule.go#L31) and [`generateUniqueTokenRegex`](https://github.com/zricethezav/gitleaks/blob/master/cmd/generate/config/rules/rule.go#L44) will generate rules
|
||||||
|
that follow defined patterns.
|
||||||
|
|
||||||
|
The function signatures look like this:
|
||||||
|
|
||||||
|
```golang
|
||||||
|
func generateSemiGenericRegex(identifiers []string, secretRegex string) *regexp.Regexp
|
||||||
|
|
||||||
|
func generateUniqueTokenRegex(secretRegex string) *regexp.Regexp
|
||||||
|
```
|
||||||
|
|
||||||
|
`generateSemiGenericRegex` accepts a list of identifiers and a regex.
|
||||||
|
The list of identifiers _should_ match the list of `Keywords` in the rule
|
||||||
|
definition above. Both `identifiers` in the `generateSemiGenericRegex`
|
||||||
|
function _and_ `Keywords` act as filters for Gitleaks telling the program
|
||||||
|
"_at least one of these strings must be present to be considered a leak_"
|
||||||
|
|
||||||
|
`generateUniqueToken` just accepts a regex. If you are writing a rule for a
|
||||||
|
token that is unique enough not to require an identifier then you can use
|
||||||
|
this function. For example, Pulumi's API Token has the prefix `pul-` which is
|
||||||
|
unique enough to use `generateUniqueToken`. But something like Beamer's API
|
||||||
|
token that has a `b_` prefix is not unqiue enough to use `generateUniqueToken`,
|
||||||
|
so instead we use `generateSemiGenericRegex` and require a `beamer`
|
||||||
|
identifier is part of the rule.
|
||||||
|
If a token's prefix has more than `3` characters then you could
|
||||||
|
probably get away with using `generateUniqueToken`.
|
||||||
|
|
||||||
|
Last thing you'll want to hit before we move on from this file is the
|
||||||
|
validation part. You can use `generateSampleSecret` to create a secret for the
|
||||||
|
true positives (`tps` in the example above) used in `validate`.
|
||||||
|
|
||||||
|
1. Update `cmd/generate/config/main.go`. Add a line like
|
||||||
|
`configRules = append(configRules, rules.Beamer())` in `main()`. Try and keep
|
||||||
|
this alphabetically pretty please.
|
||||||
|
|
||||||
|
1. Change directories into `cmd/generate/config` and run `go run main.go`
|
||||||
|
|
||||||
|
```
|
||||||
|
cd cmd/generate/config && go run main.go
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Check out your new rules in `config/gitleaks.toml` and see if everything looks good.
|
||||||
|
|
||||||
|
1. Open a PR
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
FROM golang:1.18 AS build
|
||||||
|
WORKDIR /go/src/github.com/zricethezav/gitleaks
|
||||||
|
COPY . .
|
||||||
|
RUN VERSION=$(git describe --tags --abbrev=0) && \
|
||||||
|
CGO_ENABLED=0 go build -o bin/gitleaks -ldflags "-X="github.com/zricethezav/gitleaks/v8/cmd.Version=${VERSION}
|
||||||
|
|
||||||
|
FROM alpine:3.16
|
||||||
|
RUN adduser -D gitleaks && \
|
||||||
|
apk add --no-cache bash git openssh-client
|
||||||
|
COPY --from=build /go/src/github.com/zricethezav/gitleaks/bin/* /usr/bin/
|
||||||
|
USER gitleaks
|
||||||
|
|
||||||
|
RUN git config --global --add safe.directory '*'
|
||||||
|
|
||||||
|
ENTRYPOINT ["gitleaks"]
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019 Zachary Rice
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
.PHONY: test test-cover
|
||||||
|
|
||||||
|
PKG=github.com/zricethezav/gitleaks
|
||||||
|
VERSION := `git fetch --tags && git tag | sort -V | tail -1`
|
||||||
|
LDFLAGS=-ldflags "-X=github.com/zricethezav/gitleaks/v8/cmd.Version=$(VERSION)"
|
||||||
|
COVER=--cover --coverprofile=cover.out
|
||||||
|
|
||||||
|
test-cover:
|
||||||
|
go test -v ./... --race $(COVER) $(PKG)
|
||||||
|
go tool cover -html=cover.out
|
||||||
|
|
||||||
|
format:
|
||||||
|
go fmt ./...
|
||||||
|
|
||||||
|
test: format
|
||||||
|
go vet ./...
|
||||||
|
go test -v ./... --race $(PKG)
|
||||||
|
|
||||||
|
build: format
|
||||||
|
go vet ./...
|
||||||
|
go mod tidy
|
||||||
|
go build $(LDFLAGS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
find . -type f -name '*.got.*' -delete
|
||||||
|
find . -type f -name '*.out' -delete
|
||||||
@@ -1,26 +1,363 @@
|
|||||||
# GitLeaks
|
# gitleaks
|
||||||
#### Check git repos for secrets and keys
|
|
||||||
|
|
||||||
##### Features:
|
|
||||||
* Search all commits on all branches in topological order
|
|
||||||
* Regex/Entropy checks
|
|
||||||
|
|
||||||
##### Installing:
|
|
||||||
```
|
```
|
||||||
$ go get github.com/zricethezav/gitleaks
|
┌─○───┐
|
||||||
|
│ │╲ │
|
||||||
|
│ │ ○ │
|
||||||
|
│ ○ ░ │
|
||||||
|
└─░───┘
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Usage and Explanation:
|
<p align="left">
|
||||||

|
<p align="left">
|
||||||
|
<a href="https://github.com/zricethezav/gitleaks/actions/workflows/test.yml">
|
||||||
|
<img alt="Github Test" src="https://github.com/zricethezav/gitleaks/actions/workflows/test.yml/badge.svg">
|
||||||
|
</a>
|
||||||
|
<a href="https://hub.docker.com/r/zricethezav/gitleaks">
|
||||||
|
<img src="https://img.shields.io/docker/pulls/zricethezav/gitleaks.svg" />
|
||||||
|
</a>
|
||||||
|
<a href="https://www.jit.io/jit-open-source-gitleaks?utm_source=github&utm_medium=badge&utm_campaign=GitleaksReadme&utm_id=oss&items=item-secret-detection">
|
||||||
|
<img src="https://img.shields.io/badge/Secured%20by-Jit-B8287F?style=?style=plastic" />
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/zricethezav/gitleaks-action">
|
||||||
|
<img alt="gitleaks badge" src="https://img.shields.io/badge/protected%20by-gitleaks-blue">
|
||||||
|
</a>
|
||||||
|
<a href="https://twitter.com/intent/follow?screen_name=zricethezav">
|
||||||
|
<img src="https://img.shields.io/twitter/follow/zricethezav?label=Follow%20zricethezav&style=social&color=blue" alt="Follow @zricethezav" />
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Gitleaks is a SAST tool for **detecting** and **preventing** hardcoded secrets like passwords, api keys, and tokens in git repos. Gitleaks is an **easy-to-use, all-in-one solution** for detecting secrets, past or present, in your code.
|
||||||
|
|
||||||
|
[](https://asciinema.org/a/455683)
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
Gitleaks can be installed using Homebrew, Docker, or Go. Gitleaks is also available in binary form for many popular platforms and OS types on the [releases page](https://github.com/zricethezav/gitleaks/releases). In addition, Gitleaks can be implemented as a pre-commit hook directly in your repo.
|
||||||
|
|
||||||
|
### MacOS
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install gitleaks
|
||||||
```
|
```
|
||||||
$ ./gitleaks {git url}
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
#### DockerHub
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker pull zricethezav/gitleaks:latest
|
||||||
|
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest [COMMAND] --source="/path" [OPTIONS]
|
||||||
```
|
```
|
||||||
This will clone the target `{git url}` and run a diff on all commits. A report will be output to `{repo_name}.json`
|
|
||||||
Gitleaks scans all lines of all commit diffs and checks if there are any regular expression matches. The regexs are defined in `main.go`. For example if a line in a commit diff like `AWS_KEY='AKAI...'` exists then the value after the assignment operator will be checked for entropy. If the value is above a certain entropy threshold then we assume that the line contains a key/secret. Work largely based on https://people.eecs.berkeley.edu/~rohanpadhye/files/key_leaks-msr15.pdf
|
#### ghcr.io
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker pull ghcr.io/zricethezav/gitleaks:latest
|
||||||
|
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest [COMMAND] --source="/path" [OPTIONS]
|
||||||
|
```
|
||||||
|
|
||||||
|
### From Source
|
||||||
|
|
||||||
|
1. Download and install Go from https://golang.org/dl/
|
||||||
|
2. Clone the repo
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/zricethezav/gitleaks.git
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Build the binary
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd gitleaks
|
||||||
|
make build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Github Action
|
||||||
|
|
||||||
|
Check out the official [Gitleaks GitHub Action](https://github.com/gitleaks/gitleaks-action)
|
||||||
|
|
||||||
|
```
|
||||||
|
name: gitleaks
|
||||||
|
on: [pull_request, push, workflow_dispatch]
|
||||||
|
jobs:
|
||||||
|
scan:
|
||||||
|
name: gitleaks
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: gitleaks/gitleaks-action@v2
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}} # Only required for Organizations, not personal accounts.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Pre-Commit
|
||||||
|
|
||||||
|
1. Install pre-commit from https://pre-commit.com/#install
|
||||||
|
2. Create a `.pre-commit-config.yaml` file at the root of your repository with the following content:
|
||||||
|
|
||||||
|
```
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/zricethezav/gitleaks
|
||||||
|
rev: v8.2.0
|
||||||
|
hooks:
|
||||||
|
- id: gitleaks
|
||||||
|
```
|
||||||
|
|
||||||
|
for a [native execution of GitLeaks](https://github.com/zricethezav/gitleaks/releases) or use the [`gitleaks-docker` pre-commit ID](https://github.com/zricethezav/gitleaks/blob/master/.pre-commit-hooks.yaml) for executing GitLeaks using the [official Docker images](#docker)
|
||||||
|
|
||||||
|
3. Install with `pre-commit install`
|
||||||
|
4. Now you're all set!
|
||||||
|
|
||||||
|
```
|
||||||
|
➜ git commit -m "this commit contains a secret"
|
||||||
|
Detect hardcoded secrets.................................................Failed
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: to disable the gitleaks pre-commit hook you can prepend `SKIP=gitleaks` to the commit command
|
||||||
|
and it will skip running gitleaks
|
||||||
|
|
||||||
|
```
|
||||||
|
➜ SKIP=gitleaks git commit -m "skip gitleaks check"
|
||||||
|
Detect hardcoded secrets................................................Skipped
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
Usage:
|
||||||
|
gitleaks [command]
|
||||||
|
|
||||||
|
Available Commands:
|
||||||
|
completion generate the autocompletion script for the specified shell
|
||||||
|
detect Detect secrets in code
|
||||||
|
help Help about any command
|
||||||
|
protect Protect secrets in code
|
||||||
|
version Display gitleaks version
|
||||||
|
|
||||||
|
Flags:
|
||||||
|
-c, --config string config file path
|
||||||
|
order of precedence:
|
||||||
|
1. --config/-c
|
||||||
|
2. env var GITLEAKS_CONFIG
|
||||||
|
3. (--source/-s)/.gitleaks.toml
|
||||||
|
If none of the three options are used, then gitleaks will use the default config
|
||||||
|
--exit-code string exit code when leaks have been encountered (default: 1)
|
||||||
|
-h, --help help for gitleaks
|
||||||
|
-l, --log-level string log level (debug, info, warn, error, fatal) (default "info")
|
||||||
|
--redact redact secrets from logs and stdout
|
||||||
|
-f, --report-format string output format (json, csv, sarif)
|
||||||
|
-r, --report-path string report file
|
||||||
|
-s, --source string path to source (git repo, directory, file)
|
||||||
|
-v, --verbose show verbose output from scan
|
||||||
|
|
||||||
|
Use "gitleaks [command] --help" for more information about a command.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Commands
|
||||||
|
|
||||||
|
There are two commands you will use to detect secrets; `detect` and `protect`.
|
||||||
|
|
||||||
|
#### Detect
|
||||||
|
|
||||||
|
The `detect` command is used to scan repos, directories, and files. This command can be used on developer machines and in CI environments.
|
||||||
|
|
||||||
|
When running `detect` on a git repository, gitleaks will parse the output of a `git log -p` command (you can see how this executed
|
||||||
|
[here](https://github.com/zricethezav/gitleaks/blob/7240e16769b92d2a1b137c17d6bf9d55a8562899/git/git.go#L17-L25)).
|
||||||
|
[`git log -p` generates patches](https://git-scm.com/docs/git-log#_generating_patch_text_with_p) which gitleaks will use to detect secrets.
|
||||||
|
You can configure what commits `git log` will range over by using the `--log-opts` flag. `--log-opts` accepts any option for `git log -p`.
|
||||||
|
For example, if you wanted to run gitleaks on a range of commits you could use the following command: `gitleaks detect --source . --log-opts="--all commitA..commitB"`.
|
||||||
|
See the `git log` [documentation](https://git-scm.com/docs/git-log) for more information.
|
||||||
|
|
||||||
|
You can scan files and directories by using the `--no-git` option.
|
||||||
|
|
||||||
|
#### Protect
|
||||||
|
|
||||||
|
The `protect` command is used to uncommitted changes in a git repo. This command should be used on developer machines in accordance with
|
||||||
|
[shifting left on security](https://cloud.google.com/architecture/devops/devops-tech-shifting-left-on-security).
|
||||||
|
When running `protect` on a git repository, gitleaks will parse the output of a `git diff` command (you can see how this executed
|
||||||
|
[here](https://github.com/zricethezav/gitleaks/blob/7240e16769b92d2a1b137c17d6bf9d55a8562899/git/git.go#L48-L49)). You can set the
|
||||||
|
`--staged` flag to check for changes in commits that have been `git add`ed. The `--staged` flag should be used when running Gitleaks
|
||||||
|
as a pre-commit.
|
||||||
|
|
||||||
|
**NOTE**: the `protect` command can only be used on git repos, running `protect` on files or directories will result in an error message.
|
||||||
|
|
||||||
|
### Verify Findings
|
||||||
|
|
||||||
|
You can verify a finding found by gitleaks using a `git log` command.
|
||||||
|
Example output:
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"Description": "AWS",
|
||||||
|
"StartLine": 37,
|
||||||
|
"EndLine": 37,
|
||||||
|
"StartColumn": 19,
|
||||||
|
"EndColumn": 38,
|
||||||
|
"Match": "\t\t\"aws_secret= \\\"AKIAIMNOJVGFDXXXE4OA\\\"\": true,",
|
||||||
|
"Secret": "AKIAIMNOJVGFDXXXE4OA",
|
||||||
|
"File": "checks_test.go",
|
||||||
|
"Commit": "ec2fc9d6cb0954fb3b57201cf6133c48d8ca0d29",
|
||||||
|
"Entropy": 0,
|
||||||
|
"Author": "zricethezav",
|
||||||
|
"Email": "thisispublicanyways@gmail.com",
|
||||||
|
"Date": "2018-01-28 17:39:00 -0500 -0500",
|
||||||
|
"Message": "[update] entropy check",
|
||||||
|
"Tags": [],
|
||||||
|
"RuleID": "aws-access-token"
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
We can use the following format to verify the leak:
|
||||||
|
|
||||||
|
```
|
||||||
|
git log -L {StartLine,EndLine}:{File} {Commit}
|
||||||
|
```
|
||||||
|
|
||||||
|
So in this example it would look like:
|
||||||
|
|
||||||
|
```
|
||||||
|
git log -L 37,37:checks_test.go ec2fc9d6cb0954fb3b57201cf6133c48d8ca0d29
|
||||||
|
```
|
||||||
|
|
||||||
|
Which gives us:
|
||||||
|
|
||||||
|
```
|
||||||
|
commit ec2fc9d6cb0954fb3b57201cf6133c48d8ca0d29
|
||||||
|
Author: zricethezav <thisispublicanyways@gmail.com>
|
||||||
|
Date: Sun Jan 28 17:39:00 2018 -0500
|
||||||
|
|
||||||
|
[update] entropy check
|
||||||
|
|
||||||
|
diff --git a/checks_test.go b/checks_test.go
|
||||||
|
--- a/checks_test.go
|
||||||
|
+++ b/checks_test.go
|
||||||
|
@@ -28,0 +37,1 @@
|
||||||
|
+ "aws_secret= \"AKIAIMNOJVGFDXXXE4OA\"": true,
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Pre-Commit hook
|
||||||
|
|
||||||
|
You can run Gitleaks as a pre-commit hook by copying the example `pre-commit.py` script into
|
||||||
|
your `.git/hooks/` directory.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Gitleaks offers a configuration format you can follow to write your own secret detection rules:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
# Title for the gitleaks configuration file.
|
||||||
|
title = "Gitleaks title"
|
||||||
|
|
||||||
|
# An array of tables that contain information that define instructions
|
||||||
|
# on how to detect secrets
|
||||||
|
[[rules]]
|
||||||
|
|
||||||
|
# Unique identifier for this rule
|
||||||
|
id = "awesome-rule-1"
|
||||||
|
|
||||||
|
# Short human readable description of the rule.
|
||||||
|
description = "awesome rule 1"
|
||||||
|
|
||||||
|
# Golang regular expression used to detect secrets. Note Golang's regex engine
|
||||||
|
# does not support lookaheads.
|
||||||
|
regex = '''one-go-style-regex-for-this-rule'''
|
||||||
|
|
||||||
|
# Golang regular expression used to match paths. This can be used as a standalone rule or it can be used
|
||||||
|
# in conjunction with a valid `regex` entry.
|
||||||
|
path = '''a-file-path-regex'''
|
||||||
|
|
||||||
|
# Array of strings used for metadata and reporting purposes.
|
||||||
|
tags = ["tag","another tag"]
|
||||||
|
|
||||||
|
# Int used to extract secret from regex match and used as the group that will have
|
||||||
|
# its entropy checked if `entropy` is set.
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
|
# Float representing the minimum shannon entropy a regex group must have to be considered a secret.
|
||||||
|
entropy = 3.5
|
||||||
|
|
||||||
|
# Keywords are used for pre-regex check filtering. Rules that contain
|
||||||
|
# keywords will perform a quick string compare check to make sure the
|
||||||
|
# keyword(s) are in the content being scanned. Ideally these values should
|
||||||
|
# either be part of the idenitifer or unique strings specific to the rule's regex
|
||||||
|
# (introduced in v8.6.0)
|
||||||
|
keywords = [
|
||||||
|
"auth",
|
||||||
|
"password",
|
||||||
|
"token",
|
||||||
|
]
|
||||||
|
|
||||||
|
# You can include an allowlist table for a single rule to reduce false positives or ignore commits
|
||||||
|
# with known/rotated secrets
|
||||||
|
[rules.allowlist]
|
||||||
|
description = "ignore commit A"
|
||||||
|
commits = [ "commit-A", "commit-B"]
|
||||||
|
paths = [
|
||||||
|
'''go\.mod''',
|
||||||
|
'''go\.sum'''
|
||||||
|
]
|
||||||
|
regexes = [
|
||||||
|
'''process''',
|
||||||
|
'''getenv''',
|
||||||
|
]
|
||||||
|
# note: stopwords targets the extracted secret, not the entire regex match
|
||||||
|
# like 'regexes' does. (stopwords introduced in 8.8.0)
|
||||||
|
stopwords = [
|
||||||
|
'''client''',
|
||||||
|
'''endpoint''',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
#### TODO
|
# This is a global allowlist which has a higher order of precedence than rule-specific allowlists.
|
||||||
- Specify a target branch
|
# If a commit listed in the `commits` field below is encountered then that commit will be skipped and no
|
||||||
- Support for custom regex
|
# secrets will be detected for said commit. The same logic applies for regexes and paths.
|
||||||
- Filter regex
|
[allowlist]
|
||||||
- Modify entropy cutoff
|
description = "global allow list"
|
||||||
|
commits = [ "commit-A", "commit-B", "commit-C"]
|
||||||
|
paths = [
|
||||||
|
'''gitleaks\.toml''',
|
||||||
|
'''(.*?)(jpg|gif|doc)'''
|
||||||
|
]
|
||||||
|
regexes = [
|
||||||
|
'''219-09-9999''',
|
||||||
|
'''078-05-1120''',
|
||||||
|
'''(9[0-9]{2}|666)-\d{2}-\d{4}''',
|
||||||
|
]
|
||||||
|
# note: stopwords targets the extracted secret, not the entire regex match
|
||||||
|
# like 'regexes' does. (stopwords introduced in 8.8.0)
|
||||||
|
stopwords = [
|
||||||
|
'''client''',
|
||||||
|
'''endpoint''',
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
Refer to the default [gitleaks config](https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml) for examples or follow the [contributing guidelines](https://github.com/zricethezav/gitleaks/blob/master/README.md).
|
||||||
|
|
||||||
|
## Secured by Jit
|
||||||
|
|
||||||
|
We use [Jit](https://www.jit.io/jit-open-source-gitleaks?utm_source=github&utm_medium=readme&utm_campaign=GitleaksReadme&utm_id=oss&items=item-secret-detection) to secure our codebase, to achieve fully automated, full-stack continuous security using the world's best OSS security tools.
|
||||||
|
|
||||||
|
## Sponsorships
|
||||||
|
|
||||||
|
<p align="left">
|
||||||
|
<a href="https://www.tines.com/?utm_source=oss&utm_medium=sponsorship&utm_campaign=gitleaks">
|
||||||
|
<img alt="Tines Sponsorship" src="https://user-images.githubusercontent.com/15034943/146411864-4878f936-b4f7-49a0-b625-f9f40c704bfa.png" width=200>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Exit Codes
|
||||||
|
|
||||||
|
You can always set the exit code when leaks are encountered with the --exit-code flag. Default exit codes below:
|
||||||
|
|
||||||
|
```
|
||||||
|
0 - no leaks present
|
||||||
|
1 - leaks or error encountered
|
||||||
|
126 - unknown flag
|
||||||
|
```
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/nbutton23/zxcvbn-go"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// check each line of a diff and see if there are any potential secrets
|
|
||||||
// [1] https://people.eecs.berkeley.edu/~rohanpadhye/files/key_leaks-msr15.pdf
|
|
||||||
func checkRegex(diff string) []string {
|
|
||||||
var match string
|
|
||||||
var results []string
|
|
||||||
lines := strings.Split(diff, "\n")
|
|
||||||
for _, line := range lines {
|
|
||||||
// doubtful a leak would be on a line > 120 characters
|
|
||||||
if len(line) == 0 || len(line) > 120 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
for _, re := range regexes {
|
|
||||||
match = re.FindString(line)
|
|
||||||
if len(match) == 0 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
results = append(results, line)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results
|
|
||||||
}
|
|
||||||
|
|
||||||
// checkEntropy determines whether target contains enough
|
|
||||||
// entropy for a hash
|
|
||||||
// TODO remove stop words:
|
|
||||||
// setting(s), config(s), property(s), etc
|
|
||||||
func checkEntropy(target string) bool {
|
|
||||||
index := assignRegex.FindStringIndex(target)
|
|
||||||
if len(index) == 0 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO check for stop words here
|
|
||||||
target = strings.Trim(target[index[1]:len(target)], " ")
|
|
||||||
|
|
||||||
if len(target) > 70 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
entropy := zxcvbn.PasswordStrength(target, nil).Entropy
|
|
||||||
|
|
||||||
// tune this/make option
|
|
||||||
if entropy > 70 {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestCheckRegex(t *testing.T) {
|
|
||||||
var secretsPresent bool
|
|
||||||
var results []string
|
|
||||||
checks := map[string]bool{
|
|
||||||
"github.com": false,
|
|
||||||
"github.com/user/": false,
|
|
||||||
"github.com/user -- Sys": false,
|
|
||||||
"github_api_client = \"sample key\"": true,
|
|
||||||
"aws=\"afewafewafewafewaf\"": true,
|
|
||||||
"aws\"afewafewafewafewaf\"": false,
|
|
||||||
"heroku := \"afewafewafewafewaf\"": true,
|
|
||||||
"heroku_client_secret := \"afewafewafewafewaf\"": true,
|
|
||||||
"reddit_api_secreit = \"Fwe4fa431FgklreF\"": true,
|
|
||||||
}
|
|
||||||
|
|
||||||
for k, v := range checks {
|
|
||||||
results, secretsPresent = checkRegex(k)
|
|
||||||
if v != secretsPresent {
|
|
||||||
t.Errorf("regexCheck failed on string %s. Expected secretsPresent: %t, got %t, %v", k, v, secretsPresent, results)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestEntropy(t *testing.T) {
|
|
||||||
var enoughEntropy bool
|
|
||||||
checks := map[string]bool{
|
|
||||||
"heroku_client_secret = settings.HEROKU_CLIENT": false,
|
|
||||||
"heroku_client_secret = conf.heroku": false,
|
|
||||||
"reddit_secret = settings.REDDIT_API": false,
|
|
||||||
"reddit_api_secret = \"Fwe4fa431FgklreF\"": true,
|
|
||||||
"aws_secret= \"AKIAIMNOJVGFDXXXE4OA\"": true,
|
|
||||||
}
|
|
||||||
for k, v := range checks {
|
|
||||||
enoughEntropy = checkEntropy(k)
|
|
||||||
if v != enoughEntropy {
|
|
||||||
t.Errorf("checkEntropy failed for %s. Expected %t, got %t", k, v, enoughEntropy)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
+128
@@ -0,0 +1,128 @@
|
|||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/detect"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/report"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rootCmd.AddCommand(detectCmd)
|
||||||
|
detectCmd.Flags().String("log-opts", "", "git log options")
|
||||||
|
detectCmd.Flags().Bool("no-git", false, "treat git repo as a regular directory and scan those files, --log-opts has no effect on the scan when --no-git is set")
|
||||||
|
}
|
||||||
|
|
||||||
|
var detectCmd = &cobra.Command{
|
||||||
|
Use: "detect",
|
||||||
|
Short: "detect secrets in code",
|
||||||
|
Run: runDetect,
|
||||||
|
}
|
||||||
|
|
||||||
|
func runDetect(cmd *cobra.Command, args []string) {
|
||||||
|
initConfig()
|
||||||
|
var (
|
||||||
|
vc config.ViperConfig
|
||||||
|
findings []report.Finding
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
|
||||||
|
// Load config
|
||||||
|
if err = viper.Unmarshal(&vc); err != nil {
|
||||||
|
log.Fatal().Err(err).Msg("Failed to load config")
|
||||||
|
}
|
||||||
|
cfg, err := vc.Translate()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Err(err).Msg("Failed to load config")
|
||||||
|
}
|
||||||
|
cfg.Path, _ = cmd.Flags().GetString("config")
|
||||||
|
|
||||||
|
// start timer
|
||||||
|
start := time.Now()
|
||||||
|
|
||||||
|
// Setup detector
|
||||||
|
detector := detect.NewDetector(cfg)
|
||||||
|
detector.Config.Path, err = cmd.Flags().GetString("config")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Err(err)
|
||||||
|
}
|
||||||
|
source, err := cmd.Flags().GetString("source")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Err(err)
|
||||||
|
}
|
||||||
|
// if config path is not set, then use the {source}/.gitleaks.toml path.
|
||||||
|
// note that there may not be a `{source}/.gitleaks.toml` file, this is ok.
|
||||||
|
if detector.Config.Path == "" {
|
||||||
|
detector.Config.Path = filepath.Join(source, ".gitleaks.toml")
|
||||||
|
}
|
||||||
|
// set verbose flag
|
||||||
|
if detector.Verbose, err = cmd.Flags().GetBool("verbose"); err != nil {
|
||||||
|
log.Fatal().Err(err)
|
||||||
|
}
|
||||||
|
// set redact flag
|
||||||
|
if detector.Redact, err = cmd.Flags().GetBool("redact"); err != nil {
|
||||||
|
log.Fatal().Err(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// set exit code
|
||||||
|
exitCode, err := cmd.Flags().GetInt("exit-code")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Err(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// determine what type of scan:
|
||||||
|
// - git: scan the history of the repo
|
||||||
|
// - no-git: scan files by treating the repo as a plain directory
|
||||||
|
noGit, err := cmd.Flags().GetBool("no-git")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Err(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// start the detector scan
|
||||||
|
if noGit {
|
||||||
|
findings, err = detector.DetectFiles(source)
|
||||||
|
if err != nil {
|
||||||
|
// don't exit on error, just log it
|
||||||
|
log.Error().Err(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
logOpts, err := cmd.Flags().GetString("log-opts")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Err(err)
|
||||||
|
}
|
||||||
|
findings, err = detector.DetectGit(source, logOpts, detect.DetectType)
|
||||||
|
if err != nil {
|
||||||
|
// don't exit on error, just log it
|
||||||
|
log.Error().Err(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// log info about the scan
|
||||||
|
log.Info().Msgf("scan completed in %s", time.Since(start))
|
||||||
|
if len(findings) != 0 {
|
||||||
|
log.Warn().Msgf("leaks found: %d", len(findings))
|
||||||
|
} else {
|
||||||
|
log.Info().Msg("no leaks found")
|
||||||
|
}
|
||||||
|
|
||||||
|
// write report if desired
|
||||||
|
reportPath, _ := cmd.Flags().GetString("report-path")
|
||||||
|
ext, _ := cmd.Flags().GetString("report-format")
|
||||||
|
if reportPath != "" {
|
||||||
|
if err = report.Write(findings, cfg, ext, reportPath); err != nil {
|
||||||
|
log.Fatal().Err(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(findings) != 0 {
|
||||||
|
os.Exit(exitCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"text/template"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/rules"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
templatePath = "rules/config.tmpl"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
configRules := []*config.Rule{}
|
||||||
|
configRules = append(configRules, rules.AdobeClientID())
|
||||||
|
configRules = append(configRules, rules.AdobeClientSecret())
|
||||||
|
configRules = append(configRules, rules.AgeSecretKey())
|
||||||
|
configRules = append(configRules, rules.AlgoliaApiKey())
|
||||||
|
configRules = append(configRules, rules.AlibabaAccessKey())
|
||||||
|
configRules = append(configRules, rules.AlibabaSecretKey())
|
||||||
|
configRules = append(configRules, rules.AsanaClientID())
|
||||||
|
configRules = append(configRules, rules.AsanaClientSecret())
|
||||||
|
configRules = append(configRules, rules.Atlassian())
|
||||||
|
configRules = append(configRules, rules.AWS())
|
||||||
|
configRules = append(configRules, rules.BitBucketClientID())
|
||||||
|
configRules = append(configRules, rules.BitBucketClientSecret())
|
||||||
|
configRules = append(configRules, rules.Beamer())
|
||||||
|
configRules = append(configRules, rules.CoinbaseAccessToken())
|
||||||
|
configRules = append(configRules, rules.Clojars())
|
||||||
|
configRules = append(configRules, rules.ConfluentAccessToken())
|
||||||
|
configRules = append(configRules, rules.ConfluentSecretKey())
|
||||||
|
configRules = append(configRules, rules.Contentful())
|
||||||
|
configRules = append(configRules, rules.Databricks())
|
||||||
|
configRules = append(configRules, rules.DatadogtokenAccessToken())
|
||||||
|
configRules = append(configRules, rules.DiscordAPIToken())
|
||||||
|
configRules = append(configRules, rules.DiscordClientID())
|
||||||
|
configRules = append(configRules, rules.DiscordClientSecret())
|
||||||
|
configRules = append(configRules, rules.Doppler())
|
||||||
|
configRules = append(configRules, rules.DropBoxAPISecret())
|
||||||
|
configRules = append(configRules, rules.DropBoxLongLivedAPIToken())
|
||||||
|
configRules = append(configRules, rules.DropBoxShortLivedAPIToken())
|
||||||
|
configRules = append(configRules, rules.DroneciAccessToken())
|
||||||
|
configRules = append(configRules, rules.Duffel())
|
||||||
|
configRules = append(configRules, rules.Dynatrace())
|
||||||
|
configRules = append(configRules, rules.EasyPost())
|
||||||
|
configRules = append(configRules, rules.EasyPostTestAPI())
|
||||||
|
configRules = append(configRules, rules.EtsyAccessToken())
|
||||||
|
configRules = append(configRules, rules.Facebook())
|
||||||
|
configRules = append(configRules, rules.FastlyAPIToken())
|
||||||
|
configRules = append(configRules, rules.FinicityClientSecret())
|
||||||
|
configRules = append(configRules, rules.FinicityAPIToken())
|
||||||
|
configRules = append(configRules, rules.FlickrAccessToken())
|
||||||
|
configRules = append(configRules, rules.FinnhubAccessToken())
|
||||||
|
configRules = append(configRules, rules.FlutterwavePublicKey())
|
||||||
|
configRules = append(configRules, rules.FlutterwaveSecretKey())
|
||||||
|
configRules = append(configRules, rules.FlutterwaveEncKey())
|
||||||
|
configRules = append(configRules, rules.FrameIO())
|
||||||
|
configRules = append(configRules, rules.FreshbooksAccessToken())
|
||||||
|
configRules = append(configRules, rules.GoCardless())
|
||||||
|
// TODO figure out what makes sense for GCP
|
||||||
|
// configRules = append(configRules, rules.GCPServiceAccount())
|
||||||
|
configRules = append(configRules, rules.GCPAPIKey())
|
||||||
|
configRules = append(configRules, rules.GitHubPat())
|
||||||
|
configRules = append(configRules, rules.GitHubOauth())
|
||||||
|
configRules = append(configRules, rules.GitHubApp())
|
||||||
|
configRules = append(configRules, rules.GitHubRefresh())
|
||||||
|
configRules = append(configRules, rules.Gitlab())
|
||||||
|
configRules = append(configRules, rules.GitterAccessToken())
|
||||||
|
configRules = append(configRules, rules.Hashicorp())
|
||||||
|
configRules = append(configRules, rules.Heroku())
|
||||||
|
configRules = append(configRules, rules.HubSpot())
|
||||||
|
configRules = append(configRules, rules.Intercom())
|
||||||
|
configRules = append(configRules, rules.KrakenAccessToken())
|
||||||
|
configRules = append(configRules, rules.KucoinAccessToken())
|
||||||
|
configRules = append(configRules, rules.KucoinSecretKey())
|
||||||
|
configRules = append(configRules, rules.LaunchDarklyAccessToken())
|
||||||
|
configRules = append(configRules, rules.LinearAPIToken())
|
||||||
|
configRules = append(configRules, rules.LinearClientSecret())
|
||||||
|
configRules = append(configRules, rules.LinkedinClientID())
|
||||||
|
configRules = append(configRules, rules.LinkedinClientSecret())
|
||||||
|
configRules = append(configRules, rules.LobAPIToken())
|
||||||
|
configRules = append(configRules, rules.LobPubAPIToken())
|
||||||
|
configRules = append(configRules, rules.MailChimp())
|
||||||
|
configRules = append(configRules, rules.MailGunPubAPIToken())
|
||||||
|
configRules = append(configRules, rules.MailGunPrivateAPIToken())
|
||||||
|
configRules = append(configRules, rules.MailGunSigningKey())
|
||||||
|
configRules = append(configRules, rules.MapBox())
|
||||||
|
configRules = append(configRules, rules.MattermostAccessToken())
|
||||||
|
configRules = append(configRules, rules.MessageBirdAPIToken())
|
||||||
|
configRules = append(configRules, rules.MessageBirdClientID())
|
||||||
|
configRules = append(configRules, rules.NetlifyAccessToken())
|
||||||
|
configRules = append(configRules, rules.NewRelicUserID())
|
||||||
|
configRules = append(configRules, rules.NewRelicUserKey())
|
||||||
|
configRules = append(configRules, rules.NewRelicBrowserAPIKey())
|
||||||
|
configRules = append(configRules, rules.NPM())
|
||||||
|
configRules = append(configRules, rules.NytimesAccessToken())
|
||||||
|
configRules = append(configRules, rules.PlaidAccessID())
|
||||||
|
configRules = append(configRules, rules.PlaidAccessToken())
|
||||||
|
configRules = append(configRules, rules.PlanetScalePassword())
|
||||||
|
configRules = append(configRules, rules.PlanetScaleAPIToken())
|
||||||
|
configRules = append(configRules, rules.PlanetScaleOAuthToken())
|
||||||
|
configRules = append(configRules, rules.PostManAPI())
|
||||||
|
configRules = append(configRules, rules.PrivateKey())
|
||||||
|
configRules = append(configRules, rules.PulumiAPIToken())
|
||||||
|
configRules = append(configRules, rules.PyPiUploadToken())
|
||||||
|
configRules = append(configRules, rules.RubyGemsAPIToken())
|
||||||
|
configRules = append(configRules, rules.RapidAPIAccessToken())
|
||||||
|
configRules = append(configRules, rules.SendbirdAccessID())
|
||||||
|
configRules = append(configRules, rules.SendbirdAccessToken())
|
||||||
|
configRules = append(configRules, rules.SendGridAPIToken())
|
||||||
|
configRules = append(configRules, rules.SendInBlueAPIToken())
|
||||||
|
configRules = append(configRules, rules.SentryAccessToken())
|
||||||
|
configRules = append(configRules, rules.ShippoAPIToken())
|
||||||
|
configRules = append(configRules, rules.ShopifyAccessToken())
|
||||||
|
configRules = append(configRules, rules.ShopifyCustomAccessToken())
|
||||||
|
configRules = append(configRules, rules.ShopifyPrivateAppAccessToken())
|
||||||
|
configRules = append(configRules, rules.ShopifySharedSecret())
|
||||||
|
configRules = append(configRules, rules.SlackAccessToken())
|
||||||
|
configRules = append(configRules, rules.SlackWebHook())
|
||||||
|
configRules = append(configRules, rules.StripeAccessToken())
|
||||||
|
configRules = append(configRules, rules.SquareAccessToken())
|
||||||
|
configRules = append(configRules, rules.SquareSpaceAccessToken())
|
||||||
|
configRules = append(configRules, rules.SumoLogicAccessID())
|
||||||
|
configRules = append(configRules, rules.SumoLogicAccessToken())
|
||||||
|
configRules = append(configRules, rules.Twilio())
|
||||||
|
configRules = append(configRules, rules.TwitchAPIToken())
|
||||||
|
configRules = append(configRules, rules.TwitterAPIKey())
|
||||||
|
configRules = append(configRules, rules.TwitterAPISecret())
|
||||||
|
configRules = append(configRules, rules.TwitterAccessToken())
|
||||||
|
configRules = append(configRules, rules.TwitterAccessSecret())
|
||||||
|
configRules = append(configRules, rules.TwitterBearerToken())
|
||||||
|
configRules = append(configRules, rules.Typeform())
|
||||||
|
configRules = append(configRules, rules.YandexAPIKey())
|
||||||
|
configRules = append(configRules, rules.YandexAWSAccessToken())
|
||||||
|
configRules = append(configRules, rules.YandexAccessToken())
|
||||||
|
configRules = append(configRules, rules.GenericCredential())
|
||||||
|
|
||||||
|
// ensure rules have unique ids
|
||||||
|
ruleLookUp := make(map[string]bool)
|
||||||
|
for _, rule := range configRules {
|
||||||
|
// check if rule is in ruleLookUp
|
||||||
|
if _, ok := ruleLookUp[rule.RuleID]; ok {
|
||||||
|
log.Fatal().Msgf("rule id %s is not unique", rule.RuleID)
|
||||||
|
}
|
||||||
|
ruleLookUp[rule.RuleID] = true
|
||||||
|
}
|
||||||
|
config := config.Config{
|
||||||
|
Rules: configRules,
|
||||||
|
}
|
||||||
|
tmpl, err := template.ParseFiles(templatePath)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Err(err).Msg("Failed to parse template")
|
||||||
|
}
|
||||||
|
|
||||||
|
f, err := os.Create("../../../config/gitleaks.toml")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Err(err).Msg("Failed to create rules.toml")
|
||||||
|
}
|
||||||
|
tmpl.Execute(f, config)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AdobeClientID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Adobe Client ID (Oauth Web)",
|
||||||
|
RuleID: "adobe-client-id",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"adobe"}, hex("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"adobe"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("adobe", secrets.NewSecret(hex("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func AdobeClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Adobe Client Secret",
|
||||||
|
RuleID: "adobe-client-secret",
|
||||||
|
Regex: generateUniqueTokenRegex(`(p8e-)(?i)[a-z0-9]{32}`),
|
||||||
|
Keywords: []string{"p8e-"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
"adobeClient := \"p8e-" + secrets.NewSecret(hex("32")) + "\"",
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AgeSecretKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Age secret key",
|
||||||
|
RuleID: "age secret key",
|
||||||
|
Regex: regexp.MustCompile(`AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}`),
|
||||||
|
Keywords: []string{"AGE-SECRET-KEY-1"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
`apiKey := "AGE-SECRET-KEY-1QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ`, // gitleaks:allow
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AlgoliaApiKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Algolia API Key",
|
||||||
|
RuleID: "algolia-api-key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"algolia"}, `[a-z0-9]{32}`),
|
||||||
|
Keywords: []string{"algolia"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
"algolia_key := " + secrets.NewSecret(hex("32")),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AlibabaAccessKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Alibaba AccessKey ID",
|
||||||
|
RuleID: "alibaba-access-key-id",
|
||||||
|
Regex: generateUniqueTokenRegex(`(LTAI)(?i)[a-z0-9]{20}`),
|
||||||
|
Keywords: []string{"LTAI"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
"alibabaKey := \"LTAI" + secrets.NewSecret(hex("20")) + "\"",
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
func AlibabaSecretKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Alibaba Secret Key",
|
||||||
|
RuleID: "alibaba-secret-key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"alibaba"},
|
||||||
|
alphaNumeric("30")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"alibaba"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("alibaba", secrets.NewSecret(alphaNumeric("30"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AsanaClientID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Asana Client ID",
|
||||||
|
RuleID: "asana-client-id",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"asana"}, numeric("16")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"asana"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("asana", secrets.NewSecret(numeric("16"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func AsanaClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Asana Client Secret",
|
||||||
|
RuleID: "asana-client-secret",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"asana"}, alphaNumeric("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"asana"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("asana", secrets.NewSecret(alphaNumeric("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Atlassian() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Atlassian API token",
|
||||||
|
RuleID: "atlassian-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"atlassian", "confluence"}, alphaNumeric("24")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"atlassian", "confluence"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("atlassian", secrets.NewSecret(alphaNumeric("24"))),
|
||||||
|
generateSampleSecret("confluence", secrets.NewSecret(alphaNumeric("24"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AWS() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "AWS",
|
||||||
|
RuleID: "aws-access-token",
|
||||||
|
Regex: regexp.MustCompile(
|
||||||
|
"(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
||||||
|
Keywords: []string{
|
||||||
|
"AKIA",
|
||||||
|
"AGPA",
|
||||||
|
"AIDA",
|
||||||
|
"AROA",
|
||||||
|
"AIPA",
|
||||||
|
"ANPA",
|
||||||
|
"ANVA",
|
||||||
|
"ASIA",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{generateSampleSecret("AWS", "AKIALALEMEL33243OLIB")} // gitleaks:allow
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Beamer() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Beamer API token",
|
||||||
|
RuleID: "beamer-api-token",
|
||||||
|
SecretGroup: 1,
|
||||||
|
Regex: generateSemiGenericRegex([]string{"beamer"},
|
||||||
|
`b_[a-z0-9=_\-]{44}`),
|
||||||
|
Keywords: []string{"beamer"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("beamer", "b_"+secrets.NewSecret(alphaNumericExtended("44"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func BitBucketClientID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "BitBucket Client ID",
|
||||||
|
RuleID: "bitbucket-client-id",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumeric("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"bitbucket"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("bitbucket", secrets.NewSecret(alphaNumeric("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func BitBucketClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "BitBucket Client Secret",
|
||||||
|
RuleID: "bitbucket-client-secret",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumericExtended("64")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"bitbucket"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("bitbucket", secrets.NewSecret(alphaNumeric("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Clojars() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Clojars API token",
|
||||||
|
RuleID: "clojars-api-token",
|
||||||
|
Regex: regexp.MustCompile(`(?i)(CLOJARS_)[a-z0-9]{60}`),
|
||||||
|
Keywords: []string{"clojars"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("clojars", "CLOJARS_"+secrets.NewSecret(alphaNumeric("60"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CoinbaseAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "coinbase-access-token",
|
||||||
|
Description: "Coinbase Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"coinbase"},
|
||||||
|
alphaNumericExtendedShort("64")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"coinbase",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("coinbase",
|
||||||
|
secrets.NewSecret(alphaNumericExtendedShort("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
# This file has been auto-generated. Do not edit manually.
|
||||||
|
# If you would like to contribute new rules, please use
|
||||||
|
# cmd/generate/config/main.go and follow the contributing guidelines
|
||||||
|
# at https://github.com/zricethezav/gitleaks/blob/master/CONTRIBUTING.md
|
||||||
|
|
||||||
|
# This is the default gitleaks configuration file.
|
||||||
|
# Rules and allowlists are defined within this file.
|
||||||
|
# Rules instruct gitleaks on what should be considered a secret.
|
||||||
|
# Allowlists instruct gitleaks on what is allowed, i.e. not a secret.
|
||||||
|
|
||||||
|
title = "gitleaks config"
|
||||||
|
|
||||||
|
[allowlist]
|
||||||
|
description = "global allow lists"
|
||||||
|
paths = [
|
||||||
|
'''gitleaks.toml''',
|
||||||
|
'''(.*?)(jpg|gif|doc|docx|zip|xls|pdf|bin|svg|socket)$''',
|
||||||
|
'''(go.mod|go.sum)$''',
|
||||||
|
'''node_modules''',
|
||||||
|
'''vendor''',
|
||||||
|
]
|
||||||
|
|
||||||
|
{{ range $i, $rule := .Rules }}[[rules]]
|
||||||
|
{{ if and $rule.SecretGroup $rule.Entropy $rule.Allowlist.StopWords }}description = "{{$rule.Description}}"
|
||||||
|
id = "{{$rule.RuleID}}"
|
||||||
|
regex = '''{{$rule.Regex}}'''
|
||||||
|
secretGroup = {{ $rule.SecretGroup }}
|
||||||
|
entropy = {{ $rule.Entropy}}
|
||||||
|
keywords = [
|
||||||
|
{{ range $j, $keyword := $rule.Keywords }}"{{$keyword}}",{{end}}
|
||||||
|
]
|
||||||
|
[rules.allowlist]
|
||||||
|
stopwords= [{{ range $j, $stopword := $rule.Allowlist.StopWords }}
|
||||||
|
"{{$stopword}}",{{end}}
|
||||||
|
]
|
||||||
|
{{ else if and $rule.SecretGroup $rule.Entropy }}description = "{{$rule.Description}}"
|
||||||
|
id = "{{$rule.RuleID}}"
|
||||||
|
regex = '''{{$rule.Regex}}'''
|
||||||
|
secretGroup = {{ $rule.SecretGroup }}
|
||||||
|
entropy = {{ $rule.Entropy}}
|
||||||
|
keywords = [
|
||||||
|
{{ range $j, $keyword := $rule.Keywords }}"{{$keyword}}",{{end}}
|
||||||
|
]
|
||||||
|
|
||||||
|
{{ else if $rule.SecretGroup }}description = "{{$rule.Description}}"
|
||||||
|
id = "{{$rule.RuleID}}"
|
||||||
|
regex = '''{{$rule.Regex}}'''
|
||||||
|
secretGroup = {{ $rule.SecretGroup }}
|
||||||
|
keywords = [
|
||||||
|
{{ range $j, $keyword := $rule.Keywords }}"{{$keyword}}",{{end}}
|
||||||
|
]
|
||||||
|
|
||||||
|
{{ else }}description = "{{$rule.Description}}"
|
||||||
|
id = "{{$rule.RuleID}}"
|
||||||
|
regex = '''{{$rule.Regex}}'''
|
||||||
|
keywords = [
|
||||||
|
{{ range $j, $keyword := $rule.Keywords }}"{{$keyword}}",{{end}}
|
||||||
|
]
|
||||||
|
|
||||||
|
{{end}}{{end}}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ConfluentSecretKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "confluent-secret-key",
|
||||||
|
Description: "Confluent Secret Key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"confluent"}, alphaNumeric("64")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"confluent",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("confluent", secrets.NewSecret(alphaNumeric("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ConfluentAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "confluent-access-token",
|
||||||
|
Description: "Confluent Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"confluent"}, alphaNumeric("16")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"confluent",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("confluent", secrets.NewSecret(alphaNumeric("16"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Contentful() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Contentful delivery API token",
|
||||||
|
RuleID: "contentful-delivery-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"contentful"},
|
||||||
|
alphaNumericExtended("43")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"contentful"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("contentful", secrets.NewSecret(alphaNumeric("43"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Databricks() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Databricks API token",
|
||||||
|
RuleID: "databricks-api-token",
|
||||||
|
Regex: generateUniqueTokenRegex(`dapi[a-h0-9]{32}`),
|
||||||
|
Keywords: []string{"dapi"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("databricks", "dapi"+secrets.NewSecret(hex("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func DatadogtokenAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "datadogtoken-access-token",
|
||||||
|
Description: "Datadogtoken Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"datadog"},
|
||||||
|
alphaNumeric("40")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"datadog",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("datadog", secrets.NewSecret(alphaNumeric("40"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func DiscordAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Discord API key",
|
||||||
|
RuleID: "discord-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"discord"}, hex("64")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"discord"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("discord", secrets.NewSecret(hex("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func DiscordClientID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Discord client ID",
|
||||||
|
RuleID: "discord-client-id",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"discord"}, numeric("18")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"discord"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("discord", secrets.NewSecret(numeric("18"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func DiscordClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Discord client secret",
|
||||||
|
RuleID: "discord-client-secret",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"discord"}, alphaNumericExtended("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"discord"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("discord", secrets.NewSecret(numeric("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Doppler() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Doppler API token",
|
||||||
|
RuleID: "doppler-api-token",
|
||||||
|
Regex: regexp.MustCompile(`(dp\.pt\.)(?i)[a-z0-9]{43}`),
|
||||||
|
Keywords: []string{"doppler"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("doppler", "dp.pt."+secrets.NewSecret(alphaNumeric("43"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO add additional doppler formats:
|
||||||
|
// https://docs.doppler.com/reference/auth-token-formats
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func DroneciAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "droneci-access-token",
|
||||||
|
Description: "Droneci Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"droneci"}, alphaNumeric("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"droneci",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("droneci", secrets.NewSecret(alphaNumeric("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func DropBoxAPISecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Dropbox API secret",
|
||||||
|
RuleID: "dropbox-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"dropbox"}, alphaNumeric("15")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"dropbox"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("dropbox", secrets.NewSecret(alphaNumeric("15"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func DropBoxShortLivedAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "dropbox-short-lived-api-token",
|
||||||
|
Description: "Dropbox short lived API token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"dropbox"}, `sl\.[a-z0-9\-=_]{135}`),
|
||||||
|
Keywords: []string{"dropbox"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate TODO
|
||||||
|
return &r
|
||||||
|
}
|
||||||
|
|
||||||
|
func DropBoxLongLivedAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "dropbox-long-lived-api-token",
|
||||||
|
Description: "Dropbox long lived API token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"dropbox"}, `[a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\-_=]{43}`),
|
||||||
|
Keywords: []string{"dropbox"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate TODO
|
||||||
|
return &r
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Duffel() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "duffel-api-token",
|
||||||
|
Description: "Duffel API token",
|
||||||
|
Regex: regexp.MustCompile(`duffel_(test|live)_(?i)[a-z0-9_\-=]{43}`),
|
||||||
|
Keywords: []string{"duffel"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("duffel", "duffel_test_"+secrets.NewSecret(alphaNumericExtended("43"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Dynatrace() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Dynatrace API token",
|
||||||
|
RuleID: "dynatrace-api-token",
|
||||||
|
Regex: regexp.MustCompile(`dt0c01\.(?i)[a-z0-9]{24}\.[a-z0-9]{64}`),
|
||||||
|
Keywords: []string{"dynatrace"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("dynatrace", "dt0c01."+secrets.NewSecret(alphaNumeric("24"))+"."+secrets.NewSecret(alphaNumeric("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func EasyPost() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "EasyPost API token",
|
||||||
|
RuleID: "easypost-api-token",
|
||||||
|
Regex: regexp.MustCompile(`EZAK(?i)[a-z0-9]{54}`),
|
||||||
|
Keywords: []string{"EZAK"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("EZAK", "EZAK"+secrets.NewSecret(alphaNumeric("54"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func EasyPostTestAPI() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "EasyPost test API token",
|
||||||
|
RuleID: "easypost-test-api-token",
|
||||||
|
Regex: regexp.MustCompile(`EZTK(?i)[a-z0-9]{54}`),
|
||||||
|
Keywords: []string{"EZTK"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("EZTK", "EZTK"+secrets.NewSecret(alphaNumeric("54"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func EtsyAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "etsy-access-token",
|
||||||
|
Description: "Etsy Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"etsy"}, alphaNumeric("24")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"etsy",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("etsy", secrets.NewSecret(alphaNumeric("24"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Facebook() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "facebook",
|
||||||
|
RuleID: "facebook",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"facebook"}, hex("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"facebook"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("facebook", secrets.NewSecret(hex("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func FastlyAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Fastly API key",
|
||||||
|
RuleID: "fastly-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"fastly"}, alphaNumericExtended("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"fastly"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("fastly", secrets.NewSecret(alphaNumericExtended("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func FinicityClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Finicity Client Secret",
|
||||||
|
RuleID: "finicity-client-secret",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"finicity"}, alphaNumeric("20")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"finicity"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("finicity", secrets.NewSecret(alphaNumeric("20"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func FinicityAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Finicity API token",
|
||||||
|
RuleID: "finicity-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"finicity"}, hex("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"finicity"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("finicity", secrets.NewSecret(hex("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func FinnhubAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "finnhub-access-token",
|
||||||
|
Description: "Finnhub Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"finnhub"}, alphaNumeric("20")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"finnhub",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("finnhub", secrets.NewSecret(alphaNumeric("20"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func FlickrAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "flickr-access-token",
|
||||||
|
Description: "Flickr Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"flickr"}, alphaNumeric("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"flickr",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("flickr", secrets.NewSecret(alphaNumeric("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func FlutterwavePublicKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Finicity Public Key",
|
||||||
|
RuleID: "flutterwave-public-key",
|
||||||
|
Regex: regexp.MustCompile(`FLWPUBK_TEST-(?i)[a-h0-9]{32}-X`),
|
||||||
|
Keywords: []string{"FLWPUBK_TEST"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("flutterwavePubKey", "FLWPUBK_TEST-"+secrets.NewSecret(hex("32"))+"-X"),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func FlutterwaveSecretKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Flutterwave Secret Key",
|
||||||
|
RuleID: "flutterwave-secret-key",
|
||||||
|
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{32}-X`),
|
||||||
|
Keywords: []string{"FLWSECK_TEST"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("flutterwavePubKey", "FLWSECK_TEST-"+secrets.NewSecret(hex("32"))+"-X"),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func FlutterwaveEncKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Flutterwave Encryption Key",
|
||||||
|
RuleID: "flutterwave-encryption-key",
|
||||||
|
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{12}`),
|
||||||
|
Keywords: []string{"FLWSECK_TEST"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("flutterwavePubKey", "FLWSECK_TEST-"+secrets.NewSecret(hex("12"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func FrameIO() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Frame.io API token",
|
||||||
|
RuleID: "frameio-api-token",
|
||||||
|
Regex: regexp.MustCompile(`fio-u-(?i)[a-z0-9\-_=]{64}`),
|
||||||
|
Keywords: []string{"fio-u-"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("frameio", "fio-u-"+secrets.NewSecret(alphaNumericExtended("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func FreshbooksAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "freshbooks-access-token",
|
||||||
|
Description: "Freshbooks Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"freshbooks"}, alphaNumeric("64")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"freshbooks",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("freshbooks", secrets.NewSecret(alphaNumeric("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TODO this one could probably use some work
|
||||||
|
func GCPServiceAccount() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Google (GCP) Service-account",
|
||||||
|
RuleID: "gcp-service-account",
|
||||||
|
Regex: regexp.MustCompile(`\"type\": \"service_account\"`),
|
||||||
|
Keywords: []string{`\"type\": \"service_account\"`},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
`"type": "service_account"`,
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GCPAPIKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "gcp-api-key",
|
||||||
|
Description: "GCP API key",
|
||||||
|
Regex: generateUniqueTokenRegex(`AIza[0-9A-Za-z\\-_]{35}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"AIza",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("gcp", secrets.NewSecret(`AIza[0-9A-Za-z\\-_]{35}`)),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GenericCredential() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "generic-api-key",
|
||||||
|
Description: "Generic API Key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"key",
|
||||||
|
"api",
|
||||||
|
"token",
|
||||||
|
"secret",
|
||||||
|
"client",
|
||||||
|
"passwd",
|
||||||
|
"password",
|
||||||
|
"auth",
|
||||||
|
}, `[0-9a-z\-_.=]{10,150}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"key",
|
||||||
|
"api",
|
||||||
|
"token",
|
||||||
|
"secret",
|
||||||
|
"client",
|
||||||
|
"passwd",
|
||||||
|
"password",
|
||||||
|
"auth",
|
||||||
|
},
|
||||||
|
Entropy: 3.5,
|
||||||
|
Allowlist: config.Allowlist{
|
||||||
|
StopWords: DefaultStopWords,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("generic", "CLOJARS_34bf0e88955ff5a1c328d6a7491acc4f48e865a7b8dd4d70a70749037443"),
|
||||||
|
generateSampleSecret("generic", "Zf3D0LXCM3EIMbgJpUNnkRtOfOueHznB"),
|
||||||
|
`"client_id" : "0afae57f3ccfd9d7f5767067bc48b30f719e271ba470488056e37ab35d4b6506"`,
|
||||||
|
`"client_secret" : "6da89121079f83b2eb6acccf8219ea982c3d79bccc3e9c6a85856480661f8fde",`,
|
||||||
|
}
|
||||||
|
fps := []string{
|
||||||
|
`client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.client-vpn-endpoint.id`,
|
||||||
|
`password combination.
|
||||||
|
|
||||||
|
R5: Regulatory--21`,
|
||||||
|
}
|
||||||
|
return validate(r, tps, fps)
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GitHubPat() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "GitHub Personal Access Token",
|
||||||
|
RuleID: "github-pat",
|
||||||
|
Regex: regexp.MustCompile(`ghp_[0-9a-zA-Z]{36}`),
|
||||||
|
Keywords: []string{"ghp_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("github", "ghp_"+secrets.NewSecret(alphaNumeric("36"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GitHubOauth() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "GitHub OAuth Access Token",
|
||||||
|
RuleID: "github-oauth",
|
||||||
|
Regex: regexp.MustCompile(`gho_[0-9a-zA-Z]{36}`),
|
||||||
|
Keywords: []string{"gho_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("github", "gho_"+secrets.NewSecret(alphaNumeric("36"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GitHubApp() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "GitHub App Token",
|
||||||
|
RuleID: "github-app-token",
|
||||||
|
Regex: regexp.MustCompile(`(ghu|ghs)_[0-9a-zA-Z]{36}`),
|
||||||
|
Keywords: []string{"ghu_", "ghs_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("github", "ghu_"+secrets.NewSecret(alphaNumeric("36"))),
|
||||||
|
generateSampleSecret("github", "ghs_"+secrets.NewSecret(alphaNumeric("36"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GitHubRefresh() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "GitHub Refresh Token",
|
||||||
|
RuleID: "github-refresh-token",
|
||||||
|
Regex: regexp.MustCompile(`ghr_[0-9a-zA-Z]{36}`),
|
||||||
|
Keywords: []string{"ghr_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("github", "ghr_"+secrets.NewSecret(alphaNumeric("36"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Gitlab() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Gitlab Personal Access Token",
|
||||||
|
RuleID: "gitlab-pat",
|
||||||
|
Regex: regexp.MustCompile(`glpat-[0-9a-zA-Z\-\_]{20}`),
|
||||||
|
Keywords: []string{"glpat-"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("gitlab", "glpat-"+secrets.NewSecret(alphaNumeric("20"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GitterAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "gitter-access-token",
|
||||||
|
Description: "Gitter Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"gitter"},
|
||||||
|
alphaNumericExtendedShort("40")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"gitter",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("gitter",
|
||||||
|
secrets.NewSecret(alphaNumericExtendedShort("40"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GoCardless() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "gocardless-api-token",
|
||||||
|
Description: "GoCardless API token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"gocardless"}, `live_(?i)[a-z0-9\-_=]{40}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"live_",
|
||||||
|
"gocardless",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("gocardless", "live_"+secrets.NewSecret(alphaNumericExtended("40"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Hashicorp() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "HashiCorp Terraform user/org API token",
|
||||||
|
RuleID: "hashicorp-tf-api-token",
|
||||||
|
Regex: regexp.MustCompile(`(?i)[a-z0-9]{14}\.atlasv1\.[a-z0-9\-_=]{60,70}`),
|
||||||
|
Keywords: []string{"atlasv1"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("hashicorpToken", secrets.NewSecret(hex("14"))+".atlasv1."+secrets.NewSecret(alphaNumericExtended("60,70"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Heroku() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Heroku API Key",
|
||||||
|
RuleID: "heroku-api-key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"heroku"}, hex8_4_4_4_12()),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"heroku"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
`const HEROKU_KEY = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func HubSpot() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "HubSpot API Token",
|
||||||
|
RuleID: "hubspot-api-key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"hubspot"},
|
||||||
|
`[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"hubspot"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
`const hubspotKey = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Intercom() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Intercom API Token",
|
||||||
|
RuleID: "intercom-api-key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"intercom"}, alphaNumericExtended("60")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"intercom"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("intercom", secrets.NewSecret(alphaNumericExtended("60"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func KrakenAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "kraken-access-token",
|
||||||
|
Description: "Kraken Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"kraken"},
|
||||||
|
alphaNumericExtendedLong("80,90")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"kraken",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("kraken",
|
||||||
|
secrets.NewSecret(alphaNumericExtendedLong("80,90"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func KucoinAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "kucoin-access-token",
|
||||||
|
Description: "Kucoin Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"kucoin"}, hex("24")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"kucoin",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("kucoin", secrets.NewSecret(hex("24"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func KucoinSecretKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "kucoin-secret-key",
|
||||||
|
Description: "Kucoin Secret Key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"kucoin"}, hex8_4_4_4_12()),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"kucoin",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("kucoin", secrets.NewSecret(hex8_4_4_4_12())),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func LaunchDarklyAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "launchdarkly-access-token",
|
||||||
|
Description: "Launchdarkly Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"launchdarkly"}, alphaNumericExtended("40")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"launchdarkly",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("launchdarkly", secrets.NewSecret(alphaNumericExtended("40"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func LinearAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Linear API Token",
|
||||||
|
RuleID: "linear-api-key",
|
||||||
|
Regex: regexp.MustCompile(`lin_api_(?i)[a-z0-9]{40}`),
|
||||||
|
Keywords: []string{"lin_api_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("linear", "lin_api_"+secrets.NewSecret(alphaNumeric("40"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LinearClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Linear Client Secret",
|
||||||
|
RuleID: "linear-client-secret",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"linear"}, hex("32")),
|
||||||
|
Keywords: []string{"linear"},
|
||||||
|
SecretGroup: 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("linear", secrets.NewSecret(hex("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func LinkedinClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "linkedin-client-secret",
|
||||||
|
Description: "LinkedIn Client secret",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"linkedin",
|
||||||
|
"linked-in",
|
||||||
|
}, alphaNumeric("16")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"linkedin",
|
||||||
|
"linked-in",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("linkedin", secrets.NewSecret(alphaNumeric("16"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LinkedinClientID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "linkedin-client-id",
|
||||||
|
Description: "LinkedIn Client ID",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"linkedin",
|
||||||
|
"linked-in",
|
||||||
|
}, alphaNumeric("14")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"linkedin",
|
||||||
|
"linked-in",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("linkedin", secrets.NewSecret(alphaNumeric("14"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func LobPubAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Lob Publishable API Key",
|
||||||
|
RuleID: "lob-pub-api-key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"lob"}, `(test|live)_pub_[a-f0-9]{31}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"test_pub",
|
||||||
|
"live_pub",
|
||||||
|
"_pub",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("lob", "test_pub_"+secrets.NewSecret(hex("31"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LobAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Lob API Key",
|
||||||
|
RuleID: "lob-api-key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"lob"}, `(live|test)_[a-f0-9]{35}`),
|
||||||
|
Keywords: []string{
|
||||||
|
"test_",
|
||||||
|
"live_",
|
||||||
|
},
|
||||||
|
SecretGroup: 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("lob", "test_"+secrets.NewSecret(hex("35"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func MailChimp() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "mailchimp-api-key",
|
||||||
|
Description: "Mailchimp API key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"mailchimp"}, `[a-f0-9]{32}-us20`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"mailchimp",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("mailchimp", secrets.NewSecret(hex("32"))+"-us20"),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func MailGunPrivateAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "mailgun-private-api-token",
|
||||||
|
Description: "Mailgun private API token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"mailgun"}, `key-[a-f0-9]{32}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"mailgun",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("mailgun", "key-"+secrets.NewSecret(hex("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func MailGunPubAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "mailgun-pub-key",
|
||||||
|
Description: "Mailgun public validation key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"mailgun"}, `pubkey-[a-f0-9]{32}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"mailgun",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("mailgun", "pubkey-"+secrets.NewSecret(hex("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func MailGunSigningKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "mailgun-signing-key",
|
||||||
|
Description: "Mailgun webhook signing key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"mailgun"}, `[a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"mailgun",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("mailgun", secrets.NewSecret(hex("32"))+"-00001111-22223333"),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func MapBox() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "MapBox API token",
|
||||||
|
RuleID: "mapbox-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"mapbox"}, `pk\.[a-z0-9]{60}\.[a-z0-9]{22}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"mapbox"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("mapbox", "pk."+secrets.NewSecret(alphaNumeric("60"))+"."+secrets.NewSecret(alphaNumeric("22"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func MattermostAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "mattermostpersonaltoken-access-token",
|
||||||
|
Description: "Mattermostpersonaltoken Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"mattermost"}, alphaNumeric("26")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"mattermost",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("mattermost", secrets.NewSecret(alphaNumeric("26"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func MessageBirdAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "MessageBird API token",
|
||||||
|
RuleID: "messagebird-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"messagebird",
|
||||||
|
"message-bird",
|
||||||
|
"message_bird",
|
||||||
|
}, alphaNumeric("25")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"messagebird",
|
||||||
|
"message-bird",
|
||||||
|
"message_bird",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("messagebird", secrets.NewSecret(alphaNumeric("25"))),
|
||||||
|
generateSampleSecret("message-bird", secrets.NewSecret(alphaNumeric("25"))),
|
||||||
|
generateSampleSecret("message_bird", secrets.NewSecret(alphaNumeric("25"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func MessageBirdClientID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "MessageBird client ID",
|
||||||
|
RuleID: "messagebird-client-id",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"messagebird",
|
||||||
|
"message-bird",
|
||||||
|
"message_bird",
|
||||||
|
}, hex8_4_4_4_12()),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"messagebird",
|
||||||
|
"message-bird",
|
||||||
|
"message_bird",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
`const MessageBirdClientID = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NetlifyAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "netlify-access-token",
|
||||||
|
Description: "Netlify Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"netlify"},
|
||||||
|
alphaNumericExtended("40,46")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"netlify",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("netlify", secrets.NewSecret(alphaNumericExtended("40,46"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewRelicUserID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "new-relic-user-api-key",
|
||||||
|
Description: "New Relic user API Key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"new-relic",
|
||||||
|
"newrelic",
|
||||||
|
"new_relic",
|
||||||
|
}, `NRAK-[a-z0-9]{27}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"NRAK",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("new-relic", "NRAK-"+secrets.NewSecret(alphaNumeric("27"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRelicUserKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "new-relic-user-api-id",
|
||||||
|
Description: "New Relic user API ID",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"new-relic",
|
||||||
|
"newrelic",
|
||||||
|
"new_relic",
|
||||||
|
}, alphaNumeric("64")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"new-relic",
|
||||||
|
"newrelic",
|
||||||
|
"new_relic",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("new-relic", secrets.NewSecret(alphaNumeric("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRelicBrowserAPIKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "new-relic-browser-api-token",
|
||||||
|
Description: "New Relic ingest browser API token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"new-relic",
|
||||||
|
"newrelic",
|
||||||
|
"new_relic",
|
||||||
|
}, `NRJS-[a-f0-9]{19}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"NRJS-",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("new-relic", "NRJS-"+secrets.NewSecret(hex("19"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NPM() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "npm-access-token",
|
||||||
|
Description: "npm access token",
|
||||||
|
Regex: generateUniqueTokenRegex(`npm_[a-z0-9]{36}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"npm_",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("npmAccessToken", "npm_"+secrets.NewSecret(alphaNumeric("36"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NytimesAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "nytimes-access-token",
|
||||||
|
Description: "Nytimes Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"nytimes", "new-york-times,", "newyorktimes"},
|
||||||
|
alphaNumericExtended("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"nytimes",
|
||||||
|
"new-york-times",
|
||||||
|
"newyorktimes",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("nytimes", secrets.NewSecret(alphaNumeric("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func PlaidAccessID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "plaid-client-id",
|
||||||
|
Description: "Plaidkey Client ID",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("24")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"plaid",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("plaid", secrets.NewSecret(alphaNumeric("24"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func PlaidAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "plaid-api-secret",
|
||||||
|
Description: "Plaid API Secret",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("30")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"plaid",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("plaid", secrets.NewSecret(alphaNumeric("30"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func PlanetScalePassword() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "planetscale-password",
|
||||||
|
Description: "PlanetScale password",
|
||||||
|
Regex: generateUniqueTokenRegex(`pscale_pw_(?i)[a-z0-9=\-_\.]{32,64}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"pscale_pw_",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("planetScalePassword", "pscale_pw_"+secrets.NewSecret(alphaNumericExtended("32"))),
|
||||||
|
generateSampleSecret("planetScalePassword", "pscale_pw_"+secrets.NewSecret(alphaNumericExtended("43"))),
|
||||||
|
generateSampleSecret("planetScalePassword", "pscale_pw_"+secrets.NewSecret(alphaNumericExtended("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func PlanetScaleAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "planetscale-api-token",
|
||||||
|
Description: "PlanetScale API token",
|
||||||
|
Regex: generateUniqueTokenRegex(`pscale_tkn_(?i)[a-z0-9=\-_\.]{32,64}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"pscale_tkn_",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("planetScalePassword", "pscale_tkn_"+secrets.NewSecret(alphaNumericExtended("32"))),
|
||||||
|
generateSampleSecret("planetScalePassword", "pscale_tkn_"+secrets.NewSecret(alphaNumericExtended("43"))),
|
||||||
|
generateSampleSecret("planetScalePassword", "pscale_tkn_"+secrets.NewSecret(alphaNumericExtended("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func PlanetScaleOAuthToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "planetscale-oauth-token",
|
||||||
|
Description: "PlanetScale OAuth token",
|
||||||
|
Regex: generateUniqueTokenRegex(`pscale_oauth_(?i)[a-z0-9=\-_\.]{32,64}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"pscale_oauth_",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("planetScalePassword", "pscale_oauth_"+secrets.NewSecret(alphaNumericExtended("32"))),
|
||||||
|
generateSampleSecret("planetScalePassword", "pscale_oauth_"+secrets.NewSecret(alphaNumericExtended("43"))),
|
||||||
|
generateSampleSecret("planetScalePassword", "pscale_oauth_"+secrets.NewSecret(alphaNumericExtended("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func PostManAPI() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "postman-api-token",
|
||||||
|
Description: "Postman API token",
|
||||||
|
Regex: generateUniqueTokenRegex(`PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"PMAK-",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("postmanAPItoken", "PMAK-"+secrets.NewSecret(hex("24"))+"-"+secrets.NewSecret(hex("34"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func PrivateKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Private Key",
|
||||||
|
RuleID: "private-key",
|
||||||
|
Regex: regexp.MustCompile(`(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY-----[\s\S-]*KEY----`),
|
||||||
|
Keywords: []string{"-----BEGIN"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{`-----BEGIN PRIVATE KEY-----
|
||||||
|
anything
|
||||||
|
-----END PRIVATE KEY-----`,
|
||||||
|
`-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
abcdefghijklmnopqrstuvwxyz
|
||||||
|
-----END RSA PRIVATE KEY-----
|
||||||
|
`,
|
||||||
|
} // gitleaks:allow
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func PulumiAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "pulumi-api-token",
|
||||||
|
Description: "Pulumi API token",
|
||||||
|
Regex: generateUniqueTokenRegex(`pul-[a-f0-9]{40}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"pul-",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("pulumi-api-token", "pul-"+secrets.NewSecret(hex("40"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func PyPiUploadToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "PyPI upload token",
|
||||||
|
RuleID: "pypi-upload-token",
|
||||||
|
Regex: regexp.MustCompile(
|
||||||
|
`pypi-AgEIcHlwaS5vcmc[A-Za-z0-9\-_]{50,1000}`),
|
||||||
|
Keywords: []string{
|
||||||
|
"pypi-AgEIcHlwaS5vcmc",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{"pypiToken := \"pypi-AgEIcHlwaS5vcmc" + secrets.NewSecret(hex("32")) +
|
||||||
|
secrets.NewSecret(hex("32")) + "\""}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func RapidAPIAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "rapidapi-access-token",
|
||||||
|
Description: "RapidAPI Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"rapidapi"},
|
||||||
|
alphaNumericExtendedShort("50")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"rapidapi",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("rapidapi",
|
||||||
|
secrets.NewSecret(alphaNumericExtendedShort("50"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func RubyGemsAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "rubygems-api-token",
|
||||||
|
Description: "Rubygem API token",
|
||||||
|
Regex: generateUniqueTokenRegex(`rubygems_[a-f0-9]{48}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"rubygems_",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("rubygemsAPIToken", "rubygems_"+secrets.NewSecret(hex("48"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/detect"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// case insensitive prefix
|
||||||
|
caseInsensitive = `(?i)`
|
||||||
|
|
||||||
|
// identifier prefix (just an ignore group)
|
||||||
|
identifierPrefix = `(?:`
|
||||||
|
identifierSuffix = `)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}`
|
||||||
|
|
||||||
|
// commonly used assignment operators or function call
|
||||||
|
operator = `(?:=|>|:=|\|\|:|<=|=>|:)`
|
||||||
|
|
||||||
|
// boundaries for the secret
|
||||||
|
// \x60 = `
|
||||||
|
secretPrefixUnique = `\b(`
|
||||||
|
secretPrefix = `(?:'|\"|\s|=|\x60){0,5}(`
|
||||||
|
secretSuffix = `)(?:['|\"|\n|\r|\s|\x60]|$)`
|
||||||
|
)
|
||||||
|
|
||||||
|
func generateSemiGenericRegex(identifiers []string, secretRegex string) *regexp.Regexp {
|
||||||
|
var sb strings.Builder
|
||||||
|
sb.WriteString(caseInsensitive)
|
||||||
|
sb.WriteString(identifierPrefix)
|
||||||
|
sb.WriteString(strings.Join(identifiers, "|"))
|
||||||
|
sb.WriteString(identifierSuffix)
|
||||||
|
sb.WriteString(operator)
|
||||||
|
sb.WriteString(secretPrefix)
|
||||||
|
sb.WriteString(secretRegex)
|
||||||
|
sb.WriteString(secretSuffix)
|
||||||
|
return regexp.MustCompile(sb.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
func generateUniqueTokenRegex(secretRegex string) *regexp.Regexp {
|
||||||
|
var sb strings.Builder
|
||||||
|
sb.WriteString(caseInsensitive)
|
||||||
|
sb.WriteString(secretPrefixUnique)
|
||||||
|
sb.WriteString(secretRegex)
|
||||||
|
sb.WriteString(secretSuffix)
|
||||||
|
return regexp.MustCompile(sb.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
func generateSampleSecret(identifier string, secret string) string {
|
||||||
|
return fmt.Sprintf("%s_api_token = \"%s\"", identifier, secret)
|
||||||
|
}
|
||||||
|
|
||||||
|
func validate(r config.Rule, truePositives []string, falsePositives []string) *config.Rule {
|
||||||
|
// normalize keywords like in the config package
|
||||||
|
var keywords []string
|
||||||
|
for _, k := range r.Keywords {
|
||||||
|
keywords = append(keywords, strings.ToLower(k))
|
||||||
|
}
|
||||||
|
r.Keywords = keywords
|
||||||
|
|
||||||
|
d := detect.NewDetector(config.Config{
|
||||||
|
Rules: []*config.Rule{&r},
|
||||||
|
Keywords: keywords,
|
||||||
|
})
|
||||||
|
for _, tp := range truePositives {
|
||||||
|
if len(d.DetectString(tp)) != 1 {
|
||||||
|
fmt.Println(r.Regex.String())
|
||||||
|
log.Fatal().Msgf("Failed to validate (tp) %s %s", r.RuleID, tp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, fp := range falsePositives {
|
||||||
|
if len(d.DetectString(fp)) != 0 {
|
||||||
|
log.Fatal().Msgf("Failed to validate (fp) %s", r.RuleID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &r
|
||||||
|
}
|
||||||
|
|
||||||
|
func numeric(size string) string {
|
||||||
|
return fmt.Sprintf(`[0-9]{%s}`, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func hex(size string) string {
|
||||||
|
return fmt.Sprintf(`[a-f0-9]{%s}`, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func alphaNumeric(size string) string {
|
||||||
|
return fmt.Sprintf(`[a-z0-9]{%s}`, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func alphaNumericExtendedShort(size string) string {
|
||||||
|
return fmt.Sprintf(`[a-z0-9_-]{%s}`, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func alphaNumericExtended(size string) string {
|
||||||
|
return fmt.Sprintf(`[a-z0-9=_\-]{%s}`, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func alphaNumericExtendedLong(size string) string {
|
||||||
|
return fmt.Sprintf(`[a-z0-9\/=_\+\-]{%s}`, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func hex8_4_4_4_12() string {
|
||||||
|
return `[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SendbirdAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "sendbird-access-token",
|
||||||
|
Description: "Sendbird Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"sendbird"}, hex("40")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"sendbird",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("sendbird", secrets.NewSecret(hex("40"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func SendbirdAccessID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "sendbird-access-id",
|
||||||
|
Description: "Sendbird Access ID",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"sendbird"}, hex8_4_4_4_12()),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"sendbird",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("sendbird", secrets.NewSecret(hex8_4_4_4_12())),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SendGridAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "sendgrid-api-token",
|
||||||
|
Description: "SendGrid API token",
|
||||||
|
Regex: generateUniqueTokenRegex(`SG\.(?i)[a-z0-9=_\-\.]{66}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"SG.",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("sengridAPIToken", "SG."+secrets.NewSecret(alphaNumericExtended("66"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SendInBlueAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "sendinblue-api-token",
|
||||||
|
Description: "Sendinblue API token",
|
||||||
|
Regex: generateUniqueTokenRegex(`xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"xkeysib-",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("sendinblue", "xkeysib-"+secrets.NewSecret(hex("64"))+"-"+secrets.NewSecret(alphaNumeric("16"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SentryAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "sentrytoken-access-token",
|
||||||
|
Description: "Sentrytoken Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"sentry"}, hex("64")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"sentry",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("sentry", secrets.NewSecret(hex("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ShippoAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "shippo-api-token",
|
||||||
|
Description: "Shippo API token",
|
||||||
|
Regex: generateUniqueTokenRegex(`shippo_(live|test)_[a-f0-9]{40}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"shippo_",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("shippo", "shippo_live_"+secrets.NewSecret(hex("40"))),
|
||||||
|
generateSampleSecret("shippo", "shippo_test_"+secrets.NewSecret(hex("40"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ShopifySharedSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Shopify shared secret",
|
||||||
|
RuleID: "shopify-shared-secret",
|
||||||
|
Regex: regexp.MustCompile(`shpss_[a-fA-F0-9]{32}`),
|
||||||
|
Keywords: []string{"shpss_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{"shopifySecret := \"shpss_" + secrets.NewSecret(hex("32")) + "\""}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ShopifyAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Shopify access token",
|
||||||
|
RuleID: "shopify-access-token",
|
||||||
|
Regex: regexp.MustCompile(`shpat_[a-fA-F0-9]{32}`),
|
||||||
|
Keywords: []string{"shpat_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{"shopifyToken := \"shpat_" + secrets.NewSecret(hex("32")) + "\""}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ShopifyCustomAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Shopify custom access token",
|
||||||
|
RuleID: "shopify-custom-access-token",
|
||||||
|
Regex: regexp.MustCompile(`shpca_[a-fA-F0-9]{32}`),
|
||||||
|
Keywords: []string{"shpca_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{"shopifyToken := \"shpca_" + secrets.NewSecret(hex("32")) + "\""}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ShopifyPrivateAppAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Shopify private app access token",
|
||||||
|
RuleID: "shopify-private-app-access-token",
|
||||||
|
Regex: regexp.MustCompile(`shppa_[a-fA-F0-9]{32}`),
|
||||||
|
Keywords: []string{"shppa_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{"shopifyToken := \"shppa_" + secrets.NewSecret(hex("32")) + "\""}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SlackAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Slack token",
|
||||||
|
RuleID: "slack-access-token",
|
||||||
|
Regex: regexp.MustCompile(
|
||||||
|
"xox[baprs]-([0-9a-zA-Z]{10,48})"),
|
||||||
|
Keywords: []string{
|
||||||
|
"xoxb",
|
||||||
|
"xoxa",
|
||||||
|
"xoxp",
|
||||||
|
"xoxr",
|
||||||
|
"xoxs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
"\"slackToken\": \"xoxb-" + secrets.NewSecret(alphaNumeric("30")) + "\"",
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func SlackWebHook() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Slack Webhook",
|
||||||
|
RuleID: "slack-web-hook",
|
||||||
|
Regex: regexp.MustCompile(
|
||||||
|
`https:\/\/hooks.slack.com\/services\/[A-Za-z0-9+\/]{44,46}`),
|
||||||
|
Keywords: []string{
|
||||||
|
"hooks.slack.com",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
"https://hooks.slack.com/services/" + secrets.NewSecret(alphaNumeric("44")), // gitleaks:allow
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SquareAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "square-access-token",
|
||||||
|
Description: "Square Access Token",
|
||||||
|
Regex: generateUniqueTokenRegex(`sq0atp-[0-9A-Za-z\-_]{22}`),
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("square", secrets.NewSecret(`sq0atp-[0-9A-Za-z\-_]{22}`)),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func SquareSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "square-secret",
|
||||||
|
Description: "Square Secret",
|
||||||
|
Regex: generateUniqueTokenRegex(`sq0csp-[0-9A-Za-z\\-_]{43}`),
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("square", secrets.NewSecret(`sq0csp-[0-9A-Za-z\\-_]{43}`)),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SquareSpaceAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "squarespace-access-token",
|
||||||
|
Description: "Squarespace Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"squarespace"}, hex8_4_4_4_12()),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"squarespace",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("squarespace", secrets.NewSecret(hex8_4_4_4_12())),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,27 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func StripeAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Stripe",
|
||||||
|
RuleID: "stripe-access-token",
|
||||||
|
Regex: regexp.MustCompile(`(?i)(sk|pk)_(test|live)_[0-9a-z]{10,32}`),
|
||||||
|
Keywords: []string{
|
||||||
|
"sk_test",
|
||||||
|
"pk_test",
|
||||||
|
"sk_live",
|
||||||
|
"pk_live",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{"stripeToken := \"sk_test_" + secrets.NewSecret(alphaNumeric("30")) + "\""}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SumoLogicAccessID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "sumologic-access-id",
|
||||||
|
Description: "SumoLogic Access ID",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"sumo"},
|
||||||
|
alphaNumeric("14")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"sumo",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("sumo", secrets.NewSecret(alphaNumeric("14"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func SumoLogicAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "sumologic-access-token",
|
||||||
|
Description: "SumoLogic Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"sumo"},
|
||||||
|
alphaNumeric("64")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"sumo",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("sumo", secrets.NewSecret(alphaNumeric("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TrelloAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "trello-access-token",
|
||||||
|
Description: "Trello Access Token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"trello"}, `[a-zA-Z-0-9]{32}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"trello",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("trello", secrets.NewSecret(`[a-zA-Z-0-9]{32}`)),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Twilio() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Twilio API Key",
|
||||||
|
RuleID: "twilio-api-key",
|
||||||
|
Regex: regexp.MustCompile(`SK[0-9a-fA-F]{32}`),
|
||||||
|
Keywords: []string{"twilio"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
"twilioAPIKey := \"SK" + secrets.NewSecret(hex("32")) + "\"",
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
Loaded 100 of 205 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user