mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-27 19:54:24 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43fae355e6 | ||
|
|
a158e4fc15 | ||
|
|
b6e0eeeb0a | ||
|
|
722e7d8e73 | ||
|
|
961f2e674f | ||
|
|
e734fcf01d | ||
|
|
7206d6bc56 | ||
|
|
2db25f1367 | ||
|
|
e97695b852 | ||
|
|
0afb525e59 | ||
|
|
2068870c8d | ||
|
|
8cf93b9ad5 | ||
|
|
50c2818167 | ||
|
|
455ae0aab7 | ||
|
|
5407c44e0c | ||
|
|
d03d6c401b | ||
|
|
851c11ab1a | ||
|
|
8cfa6b2e43 | ||
|
|
9152eaa57a | ||
|
|
93acc6e82a | ||
|
|
83a57244cd |
No files matched your search
@@ -0,0 +1,12 @@
|
||||
# This is NOT the default gitleaks config. The default gitleaks config is located
|
||||
# here: https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml
|
||||
# This gitleaks config extends the default config and ignores secrets located in the `cmd/generate/config/rules`
|
||||
|
||||
title = "Gitleaks development"
|
||||
[extend]
|
||||
useDefault = true
|
||||
|
||||
[allowlist]
|
||||
paths = [
|
||||
'''(^|/)cmd/generate/config/rules''',
|
||||
]
|
||||
+171
@@ -767,3 +767,174 @@ adf617b3b4628e1160fa3d135b4c3dfd45c05e15:testdata/repos/small/api/ignoreGlobal.g
|
||||
adf617b3b4628e1160fa3d135b4c3dfd45c05e15:testdata/repos/small/api/ignoreCommit.go:aws-access-token:20
|
||||
f361c5ef71853923277e3f284890083bc7825205:detect/reader_test.go:aws-access-token:12
|
||||
|
||||
8cfa6b2e43544895f52d2e37535ccfe29a6cdfd3:cmd/generate/config/rules/infracost.go:infracost-api-token:24
|
||||
8cfa6b2e43544895f52d2e37535ccfe29a6cdfd3:cmd/generate/config/rules/infracost.go:generic-api-key:29
|
||||
8cfa6b2e43544895f52d2e37535ccfe29a6cdfd3:cmd/generate/config/rules/discord.go:discord-client-secret:64
|
||||
8cfa6b2e43544895f52d2e37535ccfe29a6cdfd3:cmd/generate/config/rules/grafana.go:grafana-cloud-api-token:42
|
||||
8cfa6b2e43544895f52d2e37535ccfe29a6cdfd3:cmd/generate/config/rules/grafana.go:grafana-service-account-token:80
|
||||
9152eaa57a91d7249bd0b3c3a86b9e837072a828:detect/reader_test.go:aws-access-token:12
|
||||
9152eaa57a91d7249bd0b3c3a86b9e837072a828:cmd/generate/config/rules/aws.go:aws-access-token:42
|
||||
93acc6e82adb46ef442fcb44bd9fd83489690ca3:cmd/generate/config/rules/1password.go:1password-service-account-token:25
|
||||
93acc6e82adb46ef442fcb44bd9fd83489690ca3:cmd/generate/config/rules/1password.go:1password-service-account-token:27
|
||||
93acc6e82adb46ef442fcb44bd9fd83489690ca3:cmd/generate/config/rules/1password.go:1password-service-account-token:28
|
||||
93acc6e82adb46ef442fcb44bd9fd83489690ca3:cmd/generate/config/rules/1password.go:generic-api-key:37
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:openai-api-key:125
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:curl-auth-header:100
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:curl-auth-header:102
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:curl-auth-header:108
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:curl-auth-header:112
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:curl-auth-header:121
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:curl-auth-header:122
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:curl-auth-header:123
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:curl-auth-header:126
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:curl-auth-header:131
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:curl-auth-header:134
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:curl-auth-header:137
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:curl-auth-header:137
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:generic-api-key:139
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:jwt:134
|
||||
83a57244cdd0bfe1634326ab04a29b9b139bf158:cmd/generate/config/rules/curl.go:jwt:170
|
||||
cf5334fd61d16fb4af1362856ebfb98397c5d4b3:cmd/generate/config/rules/curl.go:curl-auth-user:32
|
||||
cf5334fd61d16fb4af1362856ebfb98397c5d4b3:cmd/generate/config/rules/curl.go:curl-auth-user:33
|
||||
cf5334fd61d16fb4af1362856ebfb98397c5d4b3:cmd/generate/config/rules/curl.go:curl-auth-user:40
|
||||
cf5334fd61d16fb4af1362856ebfb98397c5d4b3:cmd/generate/config/rules/curl.go:curl-auth-user:42
|
||||
cf5334fd61d16fb4af1362856ebfb98397c5d4b3:cmd/generate/config/rules/curl.go:curl-auth-user:43
|
||||
cf5334fd61d16fb4af1362856ebfb98397c5d4b3:cmd/generate/config/rules/curl.go:curl-auth-user:44
|
||||
cf5334fd61d16fb4af1362856ebfb98397c5d4b3:cmd/generate/config/rules/curl.go:curl-auth-user:45
|
||||
aabe3815394d24d5b8198ba6068a99e0ba7601b1:config/config_test.go:aws-access-token:72
|
||||
b9f7fdaacb9e3799a9b3e4f7f6181963b8931b73:config/config_test.go:aws-access-token:67
|
||||
3ef444d24677c863bb724fa406dd12464b7f2362:config/config_test.go:aws-access-token:39
|
||||
8fb39ba8dc9d872d57cc3151b3750e8234b9b980:cmd/generate/config/rules/azure.go:azure-ad-client-secret:33
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/decoder_test.go:generic-api-key:22
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/decoder_test.go:generic-api-key:32
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/decoder_test.go:generic-api-key:37
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/decoder_test.go:generic-api-key:54
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/decoder_test.go:generic-api-key:59
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/decoder_test.go:generic-api-key:64
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/detect_test.go:private-key:23
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/detect_test.go:generic-api-key:39
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/detect_test.go:jwt:32
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/detect_test.go:private-key:365
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/detect_test.go:private-key:366
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/detect_test.go:private-key:368
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/detect_test.go:private-key:393
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/detect_test.go:private-key:394
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/detect_test.go:aws-access-token:407
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/detect_test.go:aws-access-token:408
|
||||
2278a2a97e422c8075207d17195b29e7f4ff15e1:detect/detect_test.go:generic-api-key:452
|
||||
f8dcd838da26f591c70acbbc3dea8d8b4d1649c7:detect/detect_test.go:generic-api-key:616
|
||||
f8dcd838da26f591c70acbbc3dea8d8b4d1649c7:detect/detect_test.go:generic-api-key:618
|
||||
f8dcd838da26f591c70acbbc3dea8d8b4d1649c7:testdata/repos/nogit/.env.prod:generic-api-key:4
|
||||
032c47e7e1ebfb745d3b66ef448697d4cbf6a406:detect/detect_test.go:generic-api-key:38
|
||||
032c47e7e1ebfb745d3b66ef448697d4cbf6a406:detect/detect_test.go:generic-api-key:451
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/detect_test.go:private-key:22
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/detect_test.go:jwt:31
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/decoder_test.go:generic-api-key:22
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/decoder_test.go:generic-api-key:32
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/decoder_test.go:generic-api-key:37
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/decoder_test.go:generic-api-key:54
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/decoder_test.go:generic-api-key:59
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/decoder_test.go:generic-api-key:64
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/detect_test.go:private-key:359
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/detect_test.go:private-key:360
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/detect_test.go:private-key:362
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/detect_test.go:private-key:387
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/detect_test.go:private-key:388
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/detect_test.go:aws-access-token:401
|
||||
6c5e01c144b3d5e48422ab66a353f4cbdc14b24a:detect/detect_test.go:aws-access-token:402
|
||||
78f7d3f5dfba03f816418f987ff3a78643c1eda7:cmd/generate/config/rules/flyio.go:flyio-access-token:26
|
||||
78f7d3f5dfba03f816418f987ff3a78643c1eda7:cmd/generate/config/rules/flyio.go:flyio-access-token:30
|
||||
78f7d3f5dfba03f816418f987ff3a78643c1eda7:cmd/generate/config/rules/flyio.go:flyio-access-token:34
|
||||
78f7d3f5dfba03f816418f987ff3a78643c1eda7:cmd/generate/config/rules/flyio.go:flyio-access-token:37
|
||||
78f7d3f5dfba03f816418f987ff3a78643c1eda7:cmd/generate/config/rules/flyio.go:flyio-access-token:38
|
||||
3698060a2bcf926b8ae459270d9bcb7b69339104:cmd/generate/config/rules/kubernetes.go:generic-api-key:56
|
||||
3698060a2bcf926b8ae459270d9bcb7b69339104:cmd/generate/config/rules/kubernetes.go:generic-api-key:68
|
||||
3698060a2bcf926b8ae459270d9bcb7b69339104:cmd/generate/config/rules/kubernetes.go:generic-api-key:79
|
||||
3698060a2bcf926b8ae459270d9bcb7b69339104:cmd/generate/config/rules/kubernetes.go:generic-api-key:147
|
||||
3698060a2bcf926b8ae459270d9bcb7b69339104:cmd/generate/config/rules/kubernetes.go:generic-api-key:153
|
||||
3698060a2bcf926b8ae459270d9bcb7b69339104:cmd/generate/config/rules/kubernetes.go:generic-api-key:162
|
||||
5740eddd75b2a1149374438afe80c7cf2535b35f:README.md:aws-access-token:221
|
||||
5740eddd75b2a1149374438afe80c7cf2535b35f:README.md:aws-access-token:223
|
||||
5740eddd75b2a1149374438afe80c7cf2535b35f:README.md:aws-access-token:259
|
||||
5740eddd75b2a1149374438afe80c7cf2535b35f:cmd/generate/config/rules/generic.go:clojars-api-token:42
|
||||
372d99cfdb92a1e177badbfc1cd65bd692df9025:cmd/generate/config/rules/hashicorp.go:hashicorp-tf-api-token:24
|
||||
372d99cfdb92a1e177badbfc1cd65bd692df9025:cmd/generate/config/rules/vault.go:vault-service-token:22
|
||||
372d99cfdb92a1e177badbfc1cd65bd692df9025:cmd/generate/config/rules/vault.go:vault-service-token:25
|
||||
3be7faa1ffc80f1aa071192a09141d5e829e1af3:cmd/generate/config/rules/vault.go:vault-service-token:22
|
||||
3be7faa1ffc80f1aa071192a09141d5e829e1af3:cmd/generate/config/rules/hashicorp.go:hashicorp-tf-api-token:24
|
||||
3be7faa1ffc80f1aa071192a09141d5e829e1af3:cmd/generate/config/rules/vault.go:vault-service-token:25
|
||||
840c3cb24dcf14bf3332793f0702e75085ff5de2:detect/verify_test.go:generic-api-key:39
|
||||
840c3cb24dcf14bf3332793f0702e75085ff5de2:detect/verify_test.go:generic-api-key:47
|
||||
840c3cb24dcf14bf3332793f0702e75085ff5de2:detect/verify_test.go:generic-api-key:88
|
||||
c1345e1b2b63260d860637530ba4d17571d547d6:cmd/generate/config/rules/openshift.go:openshift-user-token:27
|
||||
c1345e1b2b63260d860637530ba4d17571d547d6:cmd/generate/config/rules/openshift.go:openshift-user-token:28
|
||||
821b2323940b1792d9001d0812a2a4f7480a69c0:cmd/generate/config/rules/cloudflare.go:cloudflare-origin-ca-key:20
|
||||
821b2323940b1792d9001d0812a2a4f7480a69c0:cmd/generate/config/rules/cloudflare.go:cloudflare-origin-ca-key:21
|
||||
e265bfbbc3b208a23f0e46dd4a96795817068b77:detect/validate_test.go:generic-api-key:93
|
||||
9d06c40017ba6710032e9bc08ebbc056175629cf:detect/validate_test.go:github-pat:33
|
||||
9d06c40017ba6710032e9bc08ebbc056175629cf:detect/validate_test.go:github-pat:36
|
||||
9d06c40017ba6710032e9bc08ebbc056175629cf:detect/validate_test.go:generic-api-key:43
|
||||
9d06c40017ba6710032e9bc08ebbc056175629cf:detect/validate_test.go:generic-api-key:49
|
||||
9d06c40017ba6710032e9bc08ebbc056175629cf:detect/validate_test.go:generic-api-key:57
|
||||
e9135cf0b598738b5fc63ca004db8ab30845393d:cmd/generate/config/rules/jwt.go:jwt:48
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-organization-api-token:85
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-organization-api-token:86
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-organization-api-token:87
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-organization-api-token:88
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-organization-api-token:89
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-organization-api-token:90
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-organization-api-token:91
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-organization-api-token:93
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-organization-api-token:95
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-organization-api-token:96
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-organization-api-token:97
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:30
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:31
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:32
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:33
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:34
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:35
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:36
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:37
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:38
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:39
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:40
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:41
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:42
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:43
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:45
|
||||
9fb36b242d75aac1a2bf885724dfd9886db08ea7:cmd/generate/config/rules/huggingface.go:huggingface-access-token:46
|
||||
463d24618fa42fc7629dc30c9744ebe36c5df1ab:cmd/generate/config/rules/slack.go:slack-user-token:66
|
||||
463d24618fa42fc7629dc30c9744ebe36c5df1ab:cmd/generate/config/rules/slack.go:slack-config-access-token:115
|
||||
463d24618fa42fc7629dc30c9744ebe36c5df1ab:cmd/generate/config/rules/slack.go:slack-legacy-workspace-token:210
|
||||
025908808f2ad1ce244f9806b8dd593bd9afbab0:detect/detect_test.go:discord-api-token:326
|
||||
e002920355ac91770a329cfa69d6359bd665ba66:cmd/generate/config/rules/privatekey.go:private-key:26
|
||||
e890a8e8098ee8021d25a429315a6c153126db22:cmd/generate/config/rules/jwt.go:jwt:17
|
||||
9326f35380636bcbe61e94b0584d1618c4b5c2c2:detect/detect_test.go:pypi-upload-token:27
|
||||
9326f35380636bcbe61e94b0584d1618c4b5c2c2:detect/detect_test.go:pypi-upload-token:32
|
||||
9326f35380636bcbe61e94b0584d1618c4b5c2c2:detect/detect_test.go:pypi-upload-token:33
|
||||
3a3e13c3b5f85b0116cf2a0cd92529baf22d0ac9:testdata/repos/with_square_and_google/env:gcp-api-key:3
|
||||
45c898c5ea56ee503a048c1bac1404cf63855edc:test_data/test_repos/test_dir_2/env:gcp-api-key:3
|
||||
45c898c5ea56ee503a048c1bac1404cf63855edc:test_data/test_dir_one_google_leak_and_square_leak.json:gcp-api-key:20
|
||||
45c898c5ea56ee503a048c1bac1404cf63855edc:test_data/test_dir_one_google_leak_and_square_leak.json:gcp-api-key:22
|
||||
f6460a7365479a48581e0641b40147914542bb24:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:16
|
||||
f6460a7365479a48581e0641b40147914542bb24:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:17
|
||||
f6460a7365479a48581e0641b40147914542bb24:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:42
|
||||
f6460a7365479a48581e0641b40147914542bb24:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:43
|
||||
f6460a7365479a48581e0641b40147914542bb24:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:68
|
||||
f6460a7365479a48581e0641b40147914542bb24:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:69
|
||||
f6460a7365479a48581e0641b40147914542bb24:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:94
|
||||
f6460a7365479a48581e0641b40147914542bb24:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:95
|
||||
7bd55e33b504f76fc2aec27f4f479a5fb2606480:src/constants.go:private-key:42
|
||||
e79ffc6ae8f66931d687407e07bc0632fb262091:src/constants.go:private-key:29
|
||||
2b995fda446e03b7660c327fec41265f03199c71:config.go:private-key:34
|
||||
ccef3680d5552443c999345567ea60909c863c0a:checks_test.go:aws-access-token:52
|
||||
1cecd5e0908ab581f217ebb2cb58829204530c79:README.md:aws-access-token:25
|
||||
1cecd5e0908ab581f217ebb2cb58829204530c79:README.md:aws-access-token:27
|
||||
e56870aecf8ac2733affc82e1ac25e3be9092db3:cmd/generate/config/rules/curl.go:generic-api-key:116
|
||||
239e6323639b18ba8a1081f17788a658da075dd7:cmd/generate/config/rules/sumologic.go:sumologic-access-token:72
|
||||
239e6323639b18ba8a1081f17788a658da075dd7:cmd/generate/config/rules/sumologic.go:sumologic-access-id:40
|
||||
239e6323639b18ba8a1081f17788a658da075dd7:cmd/generate/config/rules/readme.go:readme-api-token:26
|
||||
239e6323639b18ba8a1081f17788a658da075dd7:cmd/generate/config/rules/prefect.go:prefect-api-token:26
|
||||
239e6323639b18ba8a1081f17788a658da075dd7:cmd/generate/config/rules/databricks.go:databricks-api-token:25
|
||||
239e6323639b18ba8a1081f17788a658da075dd7:cmd/generate/config/rules/databricks.go:generic-api-key:22
|
||||
@@ -50,6 +50,8 @@ func CreateGlobalConfig() config.Config {
|
||||
regexp.MustCompile(`^\{\d{0,2}}$`), // Python (https://docs.python.org/3/tutorial/inputoutput.html)
|
||||
// Urban Code Deploy (https://www.ibm.com/support/pages/replace-token-step-replaces-replacement-values-windows-variables)
|
||||
regexp.MustCompile(`^@([A-Z_]+|[a-z_]+)@$`),
|
||||
|
||||
// ----------- Miscellaneous -----------
|
||||
},
|
||||
Paths: []*regexp.Regexp{
|
||||
regexp.MustCompile(`gitleaks\.toml`),
|
||||
@@ -71,7 +73,7 @@ func CreateGlobalConfig() config.Config {
|
||||
regexp.MustCompile(`(^|/)mvnw(\.cmd)?$`),
|
||||
regexp.MustCompile(`(^|/)\.mvn/wrapper/MavenWrapperDownloader\.java$`),
|
||||
|
||||
// ----------- Node.js files -----------
|
||||
// ----------- JavaScript files -----------
|
||||
// Dependencies and lock files.
|
||||
regexp.MustCompile(`(^|/)node_modules/.*?$`),
|
||||
regexp.MustCompile(`(^|/)package-lock\.json$`),
|
||||
@@ -79,21 +81,15 @@ func CreateGlobalConfig() config.Config {
|
||||
regexp.MustCompile(`(^|/)pnpm-lock\.yaml$`),
|
||||
regexp.MustCompile(`(^|/)npm-shrinkwrap\.json$`),
|
||||
regexp.MustCompile(`(^|/)bower_components/.*?$`),
|
||||
// TODO: Add more common static assets, such as swagger-ui.
|
||||
regexp.MustCompile(`(^|/)(jquery(-?ui)?|swagger-?ui)[a-zA-Z0-9.-]+\.js(\.map)?$`),
|
||||
|
||||
// ----------- Python files -----------
|
||||
// Dependencies and lock files.
|
||||
regexp.MustCompile(`(^|/)Pipfile\.lock$`),
|
||||
regexp.MustCompile(`(^|/)poetry\.lock$`),
|
||||
regexp.MustCompile(`(^|/)(Pipfile|poetry)\.lock$`),
|
||||
// Virtual environments
|
||||
// env/lib/python3.7/site-packages/urllib3/util/url.py
|
||||
regexp.MustCompile(`(?i)/?(v?env|virtualenv)/lib/.+$`),
|
||||
// /python/3.7.4/Lib/site-packages/dask/bytes/tests/test_bytes_utils.py
|
||||
// python/3.7.4/Lib/site-packages/fsspec/utils.py
|
||||
// python/2.7.16.32/Lib/bsddb/test/test_dbenv.py
|
||||
regexp.MustCompile(`(?i)/?python/[23](\.\d{1,2})+/lib/.+$`),
|
||||
// python/lib/python3.8/site-packages/boto3/data/ec2/2016-04-01/resources-1.json
|
||||
// python/lib/python3.8/site-packages/botocore/data/alexaforbusiness/2017-11-09/service-2.json
|
||||
regexp.MustCompile(`(?i)/?python/lib/python[23](\.\d{1,2})+/.+$`),
|
||||
regexp.MustCompile(`(?i)/?(v?env|virtualenv)/lib(64)?/.+$`),
|
||||
regexp.MustCompile(`(?i)(^|/)(lib(64)?/python[23](\.\d{1,2})+/|python/[23](\.\d{1,2})+/lib(64)?/).+$`),
|
||||
// dist-info directory (https://py-pkgs.org/04-package-structure.html#building-sdists-and-wheels)
|
||||
regexp.MustCompile(`(?i)(^|/)[a-z0-9_.]+-[0-9.]+\.dist-info/.+$`),
|
||||
|
||||
@@ -106,6 +102,11 @@ func CreateGlobalConfig() config.Config {
|
||||
regexp.MustCompile(`Database.refactorlog`),
|
||||
//regexp.MustCompile(`vendor`),
|
||||
},
|
||||
StopWords: []string{
|
||||
// ----------- Secrets -----------
|
||||
// Checkmarx client secret. (https://github.com/checkmarx-ts/checkmarx-python-sdk/blob/86560f6e2a3e46d16322101294da10d5d190312d/README.md?plain=1#L56)
|
||||
"014df517-39d1-4453-b7b3-9930c563627c",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -83,3 +83,60 @@ func TestConfigAllowlistRegexes(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestConfigAllowlistPaths(t *testing.T) {
|
||||
tests := map[string]struct {
|
||||
invalid []string
|
||||
valid []string
|
||||
}{
|
||||
"javascript - common static assets": {
|
||||
invalid: []string{
|
||||
`src/main/resources/static/jquery-ui-1.12.1/jquery-ui-min.js`,
|
||||
`src/main/resources/static/js/jquery-ui-1.10.4.min.js`,
|
||||
`swagger/swaggerui/swagger-ui-bundle.js.map`,
|
||||
`swagger/swaggerui/swagger-ui-es-bundle.js.map`,
|
||||
`src/main/static/swagger-ui.min.js`,
|
||||
},
|
||||
},
|
||||
"python": {
|
||||
invalid: []string{
|
||||
// lock files
|
||||
`Pipfile.lock`, `poetry.lock`,
|
||||
// virtual environments
|
||||
"env/lib/python3.7/site-packages/urllib3/util/url.py",
|
||||
"venv/Lib/site-packages/regex-2018.08.29.dist-info/DESCRIPTION.rst",
|
||||
"venv/lib64/python3.5/site-packages/pynvml.py",
|
||||
"python/python3/virtualenv/Lib/site-packages/pyphonetics/utils.py",
|
||||
"virtualenv/lib64/python3.7/base64.py",
|
||||
// packages
|
||||
"cde-root/usr/lib64/python2.4/site-packages/Numeric.pth",
|
||||
"lib/python3.9/site-packages/setuptools/_distutils/msvccompiler.py",
|
||||
"lib/python3.8/site-packages/botocore/data/alexaforbusiness/2017-11-09/service-2.json",
|
||||
"code/python/3.7.4/Lib/site-packages/dask/bytes/tests/test_bytes_utils.py",
|
||||
"python/3.7.4/Lib/site-packages/fsspec/utils.py",
|
||||
"python/2.7.16.32/Lib/bsddb/test/test_dbenv.py",
|
||||
"python/lib/python3.8/site-packages/boto3/data/ec2/2016-04-01/resources-1.json",
|
||||
// distinfo
|
||||
"libs/PyX-0.15.dist-info/AUTHORS",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
cfg := CreateGlobalConfig()
|
||||
allowlist := cfg.Allowlist
|
||||
for name, cases := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
for _, c := range cases.invalid {
|
||||
if !allowlist.PathAllowed(c) {
|
||||
t.Errorf("invalid path not marked as allowed: %s", c)
|
||||
}
|
||||
}
|
||||
|
||||
for _, c := range cases.valid {
|
||||
if allowlist.PathAllowed(c) {
|
||||
t.Errorf("valid path marked as allowed: %s", c)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/base"
|
||||
"os"
|
||||
"text/template"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/base"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/rules"
|
||||
@@ -25,6 +26,7 @@ func main() {
|
||||
gitleaksConfigPath := os.Args[1]
|
||||
|
||||
configRules := []*config.Rule{
|
||||
rules.OnePasswordServiceAccountToken(),
|
||||
rules.AdafruitAPIKey(),
|
||||
rules.AdobeClientID(),
|
||||
rules.AdobeClientSecret(),
|
||||
@@ -54,6 +56,7 @@ func main() {
|
||||
rules.ConfluentAccessToken(),
|
||||
rules.ConfluentSecretKey(),
|
||||
rules.Contentful(),
|
||||
rules.CurlHeaderAuth(),
|
||||
rules.CurlBasicAuth(),
|
||||
rules.Databricks(),
|
||||
rules.DatadogtokenAccessToken(),
|
||||
@@ -97,9 +100,19 @@ func main() {
|
||||
rules.GitHubOauth(),
|
||||
rules.GitHubApp(),
|
||||
rules.GitHubRefresh(),
|
||||
rules.GitlabCiCdJobToken(),
|
||||
rules.GitlabDeployToken(),
|
||||
rules.GitlabFeatureFlagClientToken(),
|
||||
rules.GitlabFeedToken(),
|
||||
rules.GitlabIncomingMailToken(),
|
||||
rules.GitlabKubernetesAgentToken(),
|
||||
rules.GitlabOauthAppSecret(),
|
||||
rules.GitlabPat(),
|
||||
rules.GitlabPipelineTriggerToken(),
|
||||
rules.GitlabRunnerRegistrationToken(),
|
||||
rules.GitlabRunnerAuthenticationToken(),
|
||||
rules.GitlabScimToken(),
|
||||
rules.GitlabSessionCookie(),
|
||||
rules.GitterAccessToken(),
|
||||
rules.GrafanaApiKey(),
|
||||
rules.GrafanaCloudApiToken(),
|
||||
@@ -144,6 +157,7 @@ func main() {
|
||||
rules.NPM(),
|
||||
rules.NugetConfigPassword(),
|
||||
rules.NytimesAccessToken(),
|
||||
rules.OctopusDeployApiKey(),
|
||||
rules.OktaAccessToken(),
|
||||
rules.OpenAI(),
|
||||
rules.OpenshiftUserToken(),
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// https://developer.1password.com/docs/service-accounts/security/?token-example=encoded
|
||||
func OnePasswordServiceAccountToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
RuleID: "1password-service-account-token",
|
||||
Description: "Uncovered a possible 1Password service account token, potentially compromising access to secrets in vaults.",
|
||||
Regex: regexp.MustCompile(`ops_eyJ[a-zA-Z0-9+/]{250,}={0,3}`),
|
||||
Entropy: 4,
|
||||
Keywords: []string{"ops_"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("1password", secrets.NewSecret(`ops_eyJ[a-zA-Z0-9+/]{250,}={0,3}`)),
|
||||
`### 1Password System Vault Name
|
||||
export OP_SERVICE_ACCOUNT_TOKEN=ops_eyJzaWduSW5BZGRyZXNzIjoibXkuMXBhc3N3b3JkLmNvbSIsInVzZXJBdXRoIjp7Im1ldGhvZCI6IlNSUGctNDA5NiIsImFsZyI6IlBCRVMyZy1IUzI1NiIsIml0ZXJhdGlvbnMiOjY1MdAwMCwic2FsdCI6InE2dE0tYzNtRDhiNUp2OHh1YVzsUmcifSwiZW1haWwiOiJ5Z3hmcm0zb21oY3NtQDFwYXNzd29yZHNlcnZpY2VhY2NvdW50cy5jb20iLCJzcnBYIjoiM2E5NDdhZmZhMDQ5NTAxZjkxYzk5MGFiY2JiYWRlZjFjMjM5Y2Q3YTMxYmI1MmQyZjUzOTA2Y2UxOTA1OTYwYiIsIm11ayI6eyJhbGciOiJBMjU2R0NNIiwiZXh0Ijp0cnVlLCJrIjoiVVpleERsLVgyUWxpa0VqRjVUUjRoODhOd29ZcHRqSHptQmFTdlNrWGZmZyIsImtleV9vcHMiOlsiZW5jcnlwdCIsImRlY3J5cHQiXSwia3R5Ijoib2N0Iiwia2lkIjoibXAifSwic2VjcmV0S2V5IjoiQTMtNDZGUUVNLUVZS1hTQS1NUU0yUy04U0JSUS01QjZGUC1HS1k2ViIsInRocm90dGxlU2VjcmV0Ijp7InNlZWQiOiJjZmU2ZTU0NGUxZTlmY2NmZjJlYjBhYWZmYTEzNjZlMmE2ZmUwZDVlZGI2ZTUzOTVkZTljZmY0NDY3NDUxOGUxIiwidXVpZCI6IjNVMjRMNVdCNkpFQ0pEQlhJNFZOSTRCUzNRIn0sImRldmljZVV1aWQiOiJqaGVlY3F4cm41YTV6ZzRpMnlkbjRqd3U3dSJ9
|
||||
`,
|
||||
`PYTEST_SVC_ACCT_TOKEN=ops_eyJzaWduSW5BZGRyZXNzIjoiemFjaC1hbmQtbGVhbm5lLjFwYXNzd29yZC5jb20iLCJ1c2VyQXV0aCI6eyJtZXRob2QiOiJTUlBnLTQwOTYiLCJhbGciOiJQQkVLMmctSFMyNTYiLCJpdGVyYXRpb25zIjo2NTAwMDAsInNhbHQiOiJlYUZRQmNVemJyTHhnM2d4bHFQLVVBIn0sImVtYWlsIjoiMm9iNGRpeDdiNTdrYUAxcGFzc3dvcmRzZXJ2aWNlYWNjb3VudHMuY29tIiwic3JwWCI6ImVmZDY4YjNhZTkwMmRjZjRiMzEzYjE5MjYwZmY0OGUzMjU2ZDlhOGNkM2JmMmY3YzI2YzU1ZWJkNjZlZGU4NWEiLCJtdWsiOnsiYWxnIjoiQTI1NkdDTSIsImV4dCI6dHJ1ZSwiayI6IlMwaGE0SDhqbEhRblJCWmxvYnBmR1BneERmbS1pRGNkZWY0bFdYU0VSbmMiLCJrZXlfb3BzIjpbImRlY3J5cHQiLCJlbmNyeXB0Il0sImt0eSI6Im9jdCIsImtpZCI6Im1wIn0sInNlY3JldEtleSI6IkEzLUdHOUVRNi1LUzQ0QVctQU5QVkYtUkdQTDktQlNKUTMtR1NHR0giLCJ0aHJvdHRsZVNlY3JldCI6eyJzZWVkIjoiN2I0OTMxMmJiOTlkZTFiNjU5ODZkYzIzOWU4YWNmZWMxMTU0M2E2OGQxYmYwMjZmZTgzMjg3NWYxNmJlOWY2NiIsInV1aWQiOiJDV1RHQ0hMNlNWRkdSTlg0SzNENUJVSDZDSSJ9LCJkZXZpY2VVdWlkIjoiMnFld3JpaGtqbmt1Zmh6ZGdmZ2hnNmM1cGUifQ`,
|
||||
` "sourceContent": "ops_eyJlbWFpbCI6ImVqd2U2NHFtbHhocmlAMXBhc3N3b3Jkc2VydmljZWFjY291bnRzLmxjbCIsIm11ayI6eyJhbGciOiJBMjU2R0NNIiwiZXh0Ijp0cnVlLCJrIjoiTThWUGZJYzhWRWZUaGNNWExhS0NLRjhzTWg1Sk1ac1BBdHU5MmZRTmItbyIsImtleV9vcHMiOlsiZW5jcnlwdCIsImRlY3J5cHQiXSwia3R5Ijoib2N0Iiwia2lkIjoibXAifSwic2VjcmV0S2V5IjoiQTMtQzRaSk1OLVBRVFpUTC1IR0w4NC1HNjRNNy1LVlpSTi00WlZQNiIsInNycFgiOiI4NzBkNjdhOWU2MjY2MjVkOWUzNjg1MDc4MDRjOWMzMmU2NjFjNTdlN2U1NTg3NzgyOTFiZjI5ZDVhMjc5YWUxIiwic2lnbkluQWRkcmVzcyI6ImdvdGhhbS5iNWxvY2FsLmNvbTo0MDAwIiwidXNlckF1dGgiOnsibWV0aG9kIjoiU1JQZy00MDk2IiwiYWxnIjoiUEJFUzJnLUhTMjU2IiwiaXRlcmF0aW9ucyI6MTAwMDAwLCJzYWx0IjoiRk1SVVBpeXJONFhmXzhIb2g2WVJYUSJ9fQ\n\nops_token is secret.\n",`,
|
||||
}
|
||||
fps := []string{
|
||||
// Invalid
|
||||
` login:
|
||||
serviceAccountToken:
|
||||
fn::secret: ops_eyJzaWduSW5B..[Redacted]`,
|
||||
`: To start using this service account, run the following command:
|
||||
:
|
||||
: export OP_SERVICE_ACCOUNT_TOKEN=ops_eyJzaWduSW5BZGRyZXNzIjoiaHR0cHM6...`,
|
||||
// Low entropy.
|
||||
`ops_eyJxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -9,9 +9,10 @@ import (
|
||||
func AdobeClientID() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a pattern that resembles an Adobe OAuth Web Client ID, posing a risk of compromised Adobe integrations and data breaches.",
|
||||
RuleID: "adobe-client-id",
|
||||
Description: "Detected a pattern that resembles an Adobe OAuth Web Client ID, posing a risk of compromised Adobe integrations and data breaches.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"adobe"}, utils.Hex("32"), true),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"adobe"},
|
||||
}
|
||||
|
||||
@@ -25,9 +26,10 @@ func AdobeClientID() *config.Rule {
|
||||
func AdobeClientSecret() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a potential Adobe Client Secret, which, if exposed, could allow unauthorized Adobe service access and data manipulation.",
|
||||
RuleID: "adobe-client-secret",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(p8e-)(?i)[a-z0-9]{32}`, true),
|
||||
Description: "Discovered a potential Adobe Client Secret, which, if exposed, could allow unauthorized Adobe service access and data manipulation.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`p8e-(?i)[a-z0-9]{32}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"p8e-"},
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@ import (
|
||||
func AlibabaAccessKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected an Alibaba Cloud AccessKey ID, posing a risk of unauthorized cloud resource access and potential data compromise.",
|
||||
RuleID: "alibaba-access-key-id",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(LTAI)(?i)[a-z0-9]{20}`, true),
|
||||
Description: "Detected an Alibaba Cloud AccessKey ID, posing a risk of unauthorized cloud resource access and potential data compromise.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`LTAI(?i)[a-z0-9]{20}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"LTAI"},
|
||||
}
|
||||
|
||||
@@ -26,12 +27,11 @@ func AlibabaAccessKey() *config.Rule {
|
||||
func AlibabaSecretKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a potential Alibaba Cloud Secret Key, potentially allowing unauthorized operations and data access within Alibaba Cloud.",
|
||||
RuleID: "alibaba-secret-key",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"alibaba"},
|
||||
utils.AlphaNumeric("30"), true),
|
||||
|
||||
Keywords: []string{"alibaba"},
|
||||
Description: "Discovered a potential Alibaba Cloud Secret Key, potentially allowing unauthorized operations and data access within Alibaba Cloud.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"alibaba"}, utils.AlphaNumeric("30"), true),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"alibaba"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -12,9 +12,10 @@ func Authress() *config.Rule {
|
||||
// Rule Definition
|
||||
// (Note: When changes are made to this, rerun `go generate ./...` and commit the config/gitleaks.toml file
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a possible Authress Service Client Access Key, which may compromise access control services and sensitive data.",
|
||||
RuleID: "authress-service-client-access-key",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.acc[_-][a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120}`, true),
|
||||
Description: "Uncovered a possible Authress Service Client Access Key, which may compromise access control services and sensitive data.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(?:sc|ext|scauth|authress)_(?i)[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.(?-i:acc)[_-][a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"sc_", "ext_", "scauth_", "authress_"},
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
@@ -12,17 +13,40 @@ func AWS() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a pattern that may indicate AWS credentials, risking unauthorized cloud resource access and data breaches on AWS platforms.",
|
||||
RuleID: "aws-access-token",
|
||||
Regex: regexp.MustCompile(
|
||||
"(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}"),
|
||||
Regex: utils.GenerateUniqueTokenRegex("(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}", false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"AKIA",
|
||||
"ASIA",
|
||||
"ABIA",
|
||||
"ACCA",
|
||||
// https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-unique-ids
|
||||
"A3T", // todo: might not be a valid AWS token
|
||||
"AKIA", // Access key
|
||||
"ASIA", // Temporary (AWS STS) access key
|
||||
"ABIA", // AWS STS service bearer token
|
||||
"ACCA", // Context-specific credential
|
||||
},
|
||||
Allowlists: []config.Allowlist{
|
||||
{
|
||||
Regexes: []*regexp.Regexp{
|
||||
regexp.MustCompile(`.+EXAMPLE$`),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{utils.GenerateSampleSecret("AWS", "AKIALALEMEL33243OLIB")} // gitleaks:allow
|
||||
return utils.Validate(r, tps, nil)
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("AWS", "AKIALALEMEL33243OLIB"), // gitleaks:allow
|
||||
// current AWS tokens cannot contain [0,1,8,9], so their entropy is slightly lower than expected.
|
||||
utils.GenerateSampleSecret("AWS", "AKIA"+secrets.NewSecret("[A-Z2-7]{16}")),
|
||||
utils.GenerateSampleSecret("AWS", "ASIA"+secrets.NewSecret("[A-Z2-7]{16}")),
|
||||
utils.GenerateSampleSecret("AWS", "ABIA"+secrets.NewSecret("[A-Z2-7]{16}")),
|
||||
utils.GenerateSampleSecret("AWS", "ACCA"+secrets.NewSecret("[A-Z2-7]{16}")),
|
||||
}
|
||||
fps := []string{
|
||||
`key = AKIAXXXXXXXXXXXXXXXX`, // Low entropy
|
||||
`aws_access_key: AKIAIOSFODNN7EXAMPLE`, // Placeholder
|
||||
`msgstr "Näytä asiakirjamallikansio."`, // Lowercase
|
||||
`TODAYINASIAASACKOFRICEFELLOVER`, // wrong length
|
||||
`CTTCATAGGGTTCACGCTGTGTAAT-ACG--CCTGAGGC-CACA-AGGGGACTTCAGCAACCGTCGGG-GATTC-ATTGCCA-A--TGGAAGCAATC-TA-TGGGTTA-TCGCGGAGTCCGCAAAGACGGCCAGTATG-AAGCAGATTTCGCAC-CAATGTGACTGCATTTCGTG-ATCGGGGTAAGTA-TC-GCCGATTC-GC--CCGTCCA-AGT-CGAAG-TA--GGCAATATAAAGCTGC-CATTGCCGAAGCTATCTCGCTA-TACTTGAT-AATCGGCGG-TAG-CACAG-GTCGCAGTATCG-AC-T--AGG-CCTCTCAAAAGTT-GGGTCCCGGCCTCTGGGAAAAACACCTCT-A-AGCGTCAATCAGCTCGGTTTCGCATATTA-TGATATCCCCCGTTGACCAATTGA--TAGTACCCGAGCTTACCGTCGG-ATTCTGGAGTCTT-ATGAGGTTACCGACGA-CGCAGTACCATAAGT-GCGCAATTTGACTGTTCCCGTCGAGTAACCA-AGCTTTGCTCA-CCGGGATGCGCGCCGATGTGACCAGGGGGCGCATGTTACATTGAC-A-GCTGGATCATGTTATGAC-GTGGGTC-ATGCTAAAAGCCTAAAGGACGGT-GCATTAGTAT-TACCGGGACCTCATATCAATGCGCTCGCTAGTTCCTCTTCTCTTGATAACGTATATGCGTCAGGCGCCCGTCCGCCTCCAATACGTG-ACAACGTC-AGTACTGAGCCTC--AA-ACATCGTCTTGTTCG-CC-TACAAAGGATCGGTAGAAAACTCAATATTCGGGTATAAGGTCGTAGGAAGTGTGTCGCCCAGGGCCG-CTAGA-AGCGCACACAAGCG-CTCCTGTCAAGGAGTTG-GTGAAAA-ATGAAC--GACT-ATTGCGTCAC--CTACCTCT-AAGTTTTT-GACAATTTCATGGACGAATTGA-AGCGTCCACAAGCATCTGCCGTAGATATGCGGTAGGTTTTTACATATG-TCACTGCAGAGTCACGGACA-CACATCGCTGTCAAAATGCTCGTACCTAGT-GT-TTGCGATCCCCC-GCGGCATTA-TCTTTTGAACCCTCGTCCCTGTGG-CTCTGATGATTGAG-GTCTGTA-TTCCCTCGTTGTGGGGGGATTGGACCTT-TGTATAGGTTCTTTAACCG-ATGGGGGGCCG--ATCGA-A-TA-TGCTCCTGTTTGCCCCGAACCTT-ACCTCGG-TCCAGACA-CTAAGAAAAACCCC-C-ACTGTAAGGTGCTGAGCCTTTGGATAGCC-CGCGAATGAT-CC-TAGTTGACAA-CTGAACGCGCTCGAACA-TGCCC-GCCCTCTGA--CTGCTGTCTG-GCACCTTTAGACACGCGTCGAC-CATATATT-AGCGCTGTCTGTGG-AGGT-TGTGTCTTGTTGCTCA-CT-CATTATCTGT-AACTGGCTCC-CTC-CCAT-TGGCGTCTTTACACCAACCGCTAGGTTACAGTGCA-TCTAGCGCCTATTATCAGGGCGT-TTGCAGCGGCGCGGTGGCTATGT-GTTAGACATATC-CTTACACTGTATGCTAG-AGCAAGCCAC-TCTGAATGGGTTGC-CGATGAATGA-TCTTGATC-GAGCTCGCA-AC---TACATGGAGTCCGAAGTGAACCTACGGATGATCGTATTCCAACACGAGGATC-TATACGTATAGG-A-GGCG-TAATCCACAATTTAGTAACTCTTGACGC---GGATGAAAAT-GTCGTTACACCTTCCAGAGGCTCGG-GTATATATATGACCT--TGTGATTGAGGACGATCTAGAATAA-CT-GT-G-CT-AAAGTACAGTAGTTTCTATGT-GGTAGGTGGAGAATACAGAGTAG-ATGATTC-GTGGGCCACA-C--T-ACTTTCAT-TAGAGCAGAGA-C-GTGAGTGAGTTTTACACTAGCCAGATGGACCG-GTGA-AGTCTAACAGCCACCGCTT-GTGAGGTCGTTTCCCAGTC-ACCCTACTACAGGCAAAAACTCAGTGT-CC-GTGA-GTGCGTTAGTGATATTCCCTAACGGTTAGGTAACT-CATGAATTCA-AT-TAAGCGTGTCC-CGGT-CACGCCCCCATGGGGGCCTTCTTGGGAGG--AGCATCTTAT--AT-GCTCACGTGGTT-GATAGG-A-T-AATACACTTTTAGTCAGTCCATCAATAAC-AAAGGAAC---CAGGTGGTCGCAGATA-TCCCGCTGATATAGCACTGTGTAAACTCAGGTGATA-CTAAGC--GCTCTAAT-ACG-CTTAATGGCAATGCCCAGTTC--ACGACTAGCTTATGAGGCCCAGCTATGGACTGCGGC-GGCATGTCGGC-GATGGTTGCCCTCGCCCTAAATTATGTACGA-T-ACCGCCT-CTTGTTCT-CCGCCCATAGGGT-C--AGCAGGCGATAGACTCCCAGAAATTTCCTCGTCGT-CCGAATAAGACTAACACGACTA-TT-CCTCTAC-GT-G-AA-CTTATCA-CAAATG-GCT-TACC-TAGGTGGTGGCAGATCACTTTCCGGTG-TATTACGAATTGACGCATACCGAC-A-CGC-GCTTGTTGGATAATCGACTCTAACCTCCTCTCTGGCACATGT-GCTGGATTACCTC-TATTTT-TCTCGCTTAG--GGAACG-T-CCTCTGTCGCGTGAG-GTACGTTTCACGGGAG-CGGCTTGTTCATGCCACGTCCATTATCGA-AGTG-C-GTAAGG-A-GAGCCCTA--GACTCTACACGGAAA-TC-AAC-GTAGAAGGCTC-A-CT`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -11,10 +11,11 @@ import (
|
||||
func Clojars() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a possible Clojars API token, risking unauthorized access to Clojure libraries and potential code manipulation.",
|
||||
RuleID: "clojars-api-token",
|
||||
Description: "Uncovered a possible Clojars API token, risking unauthorized access to Clojure libraries and potential code manipulation.",
|
||||
Regex: regexp.MustCompile(`(?i)CLOJARS_[a-z0-9]{60}`),
|
||||
Keywords: []string{"clojars"},
|
||||
Entropy: 2,
|
||||
Keywords: []string{"clojars_"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -27,11 +27,11 @@ var identifiers = []string{"cloudflare"}
|
||||
func CloudflareGlobalAPIKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Cloudflare Global API Key, potentially compromising cloud application deployments and operational security.",
|
||||
RuleID: "cloudflare-global-api-key",
|
||||
Description: "Detected a Cloudflare Global API Key, potentially compromising cloud application deployments and operational security.",
|
||||
Regex: utils.GenerateSemiGenericRegex(identifiers, utils.Hex("37"), true),
|
||||
|
||||
Keywords: identifiers,
|
||||
Entropy: 2,
|
||||
Keywords: identifiers,
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -44,11 +44,11 @@ func CloudflareGlobalAPIKey() *config.Rule {
|
||||
func CloudflareAPIKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Cloudflare API Key, potentially compromising cloud application deployments and operational security.",
|
||||
RuleID: "cloudflare-api-key",
|
||||
Description: "Detected a Cloudflare API Key, potentially compromising cloud application deployments and operational security.",
|
||||
Regex: utils.GenerateSemiGenericRegex(identifiers, utils.AlphaNumericExtendedShort("40"), true),
|
||||
|
||||
Keywords: identifiers,
|
||||
Entropy: 2,
|
||||
Keywords: identifiers,
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -65,8 +65,8 @@ func CloudflareOriginCAKey() *config.Rule {
|
||||
Description: "Detected a Cloudflare Origin CA Key, potentially compromising cloud application deployments and operational security.",
|
||||
RuleID: "cloudflare-origin-ca-key",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`v1\.0-`+utils.Hex("24")+"-"+utils.Hex("146"), false),
|
||||
|
||||
Keywords: ca_identifiers,
|
||||
Entropy: 2,
|
||||
Keywords: ca_identifiers,
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -22,6 +22,9 @@ regexes = [{{ range $i, $regex := . }}
|
||||
paths = [{{ range $i, $path := . }}
|
||||
'''{{ $path }}''',{{ end }}
|
||||
]{{ end }}
|
||||
{{- with .Allowlist.StopWords }}{{println}}stopwords = [{{ range $j, $stopword := . }}
|
||||
"{{ $stopword }}",{{ end }}
|
||||
]{{ end }}
|
||||
|
||||
{{ range $i, $rule := .Rules }}[[rules]]
|
||||
id = "{{$rule.RuleID}}"
|
||||
@@ -52,20 +55,18 @@ tags = [
|
||||
{{- if eq (len $rule.Allowlists) 1 }}{{ with index $rule.Allowlists 0}}{{ if or .Regexes .Paths .Commits .StopWords }}
|
||||
# NOTE: Gitleaks >= v8.21.0 should use [[rules.allowlists] instead.
|
||||
[rules.allowlist]
|
||||
{{ with .MatchCondition }}condition = "{{ . }}"
|
||||
{{ end -}}
|
||||
{{- with .Commits }}commits = [
|
||||
{{- with .MatchCondition }}{{println}}condition = "{{ .MatchCondition.String }}"{{ end }}
|
||||
{{- with .Commits -}}{{println}}commits = [
|
||||
{{ range $j, $commit := . }}"{{ $commit }}",{{ end }}
|
||||
]{{ end }}
|
||||
{{- with .Paths }}paths = [
|
||||
{{- with .Paths }}{{println}}paths = [
|
||||
{{ range $j, $path := . }}'''{{ $path }}''',{{ end }}
|
||||
]{{ end }}
|
||||
{{- with .RegexTarget }}regexTarget = "{{ . }}"
|
||||
{{ end -}}
|
||||
{{- with .Regexes }}regexes = [{{ range $i, $regex := . }}
|
||||
{{- if and .RegexTarget .Regexes }}{{println}}regexTarget = "{{ .RegexTarget }}"{{ end -}}
|
||||
{{- with .Regexes }}{{println}}regexes = [{{ range $i, $regex := . }}
|
||||
'''{{ $regex }}''',{{ end }}
|
||||
]{{ end }}
|
||||
{{- with .StopWords }}stopwords = [{{ range $j, $stopword := . }}
|
||||
{{- with .StopWords }}{{println}}stopwords = [{{ range $j, $stopword := . }}
|
||||
"{{ $stopword }}",{{ end }}
|
||||
]{{ end }}{{ end }}{{ end }}
|
||||
{{ else }}
|
||||
@@ -84,7 +85,7 @@ tags = [
|
||||
{{- with $allowlist.Regexes }}regexes = [{{ range $i, $regex := . }}
|
||||
'''{{ $regex }}''',{{ end }}
|
||||
]{{ end }}
|
||||
{{- with $allowlist.StopWords }}stopwords = [{{ range $j, $stopword := . }}
|
||||
{{ with $allowlist.StopWords }}stopwords = [{{ range $j, $stopword := . }}
|
||||
"{{ $stopword }}",{{ end }}
|
||||
]{{ end }}{{ end }}{{ end }}
|
||||
{{ end }}{{ end }}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
@@ -12,15 +13,18 @@ func CurlBasicAuth() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "curl-auth-user",
|
||||
// TODO: Description: "",
|
||||
Regex: regexp.MustCompile(`\bcurl\b(?:.*|.*(?:[\r\n]{1,2}.*){1,5})[ \t\n\r](?:-u|--user)[ =](?:("[^:"]{3,}:[^"]{3,}")|('[^:']{3,}:[^']{3,}')|((?:"[^"]{3,}"|'[^']{3,}'|[\w$@.-]+):(?:"[^"]{3,}"|'[^']{3,}'|[\w$@.-]+))|)(?:\s|\z)`),
|
||||
Regex: regexp.MustCompile(`\bcurl\b(?:.*|.*(?:[\r\n]{1,2}.*){1,5})[ \t\n\r](?:-u|--user)(?:=|[ \t]{0,5})(?:"([^:"]{3,}:[^"]{3,})"|'([^:']{3,}:[^']{3,})'|((?:"[^"]{3,}"|'[^']{3,}'|[\w$@.-]+):(?:"[^"]{3,}"|'[^']{3,}'|[\w${}@.-]+)))(?:\s|\z)`),
|
||||
Keywords: []string{"curl"},
|
||||
Entropy: 2,
|
||||
Allowlists: []config.Allowlist{
|
||||
{
|
||||
Regexes: []*regexp.Regexp{
|
||||
regexp.MustCompile(`[^:]+:(changeme|pass(word)?|pwd|\*+|x+)`), // common placeholder passwords
|
||||
regexp.MustCompile(`<[^>]+>:<[^>]+>|<[^:]+:[^>]+>`), // <placeholder>
|
||||
regexp.MustCompile(`[^:]+:\[[^]]+]`), // [placeholder]
|
||||
regexp.MustCompile(`(?i)[^:]+:\$(\d|[a-z]\w+|(\{\d|[a-z]\w+}))`), // $1 or $VARIABLE
|
||||
regexp.MustCompile(`[^:]+:(change(it|me)|pass(word)?|pwd|test|token|\*+|x+)`), // common placeholder passwords
|
||||
regexp.MustCompile(`['"]?<[^>]+>['"]?:['"]?<[^>]+>|<[^:]+:[^>]+>['"]?`), // <placeholder>
|
||||
regexp.MustCompile(`[^:]+:\[[^]]+]`), // [placeholder]
|
||||
regexp.MustCompile(`['"]?[^:]+['"]?:['"]?\$(\d|\w+|\{(\d|\w+)})['"]?`), // $1 or $VARIABLE
|
||||
regexp.MustCompile(`\$\([^)]+\):\$\([^)]+\)`), // $(cat login.txt)
|
||||
regexp.MustCompile(`['"]?\$?{{[^}]+}}['"]?:['"]?\$?{{[^}]+}}['"]?`), // ${{ secrets.FOO }} or {{ .Values.foo }}
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -36,6 +40,7 @@ func CurlBasicAuth() *config.Rule {
|
||||
-u developer:yqDVtkqPECriaLRi`, // different line
|
||||
|
||||
// long
|
||||
`curl -sw '%{http_code}' -X POST --user 'johns:h0pk1ns~21s' $GItHUB_API_URL/$GIT_COMMIT --data`,
|
||||
`curl --user roger23@gmail.com:pQ9wTxu4Fg https://www.dropbox.com/cli_link?host_id=abcdefg -v`, // same line, no quotes
|
||||
`curl -s --user 'api:d2LkV78zLx!t' \
|
||||
https://api.mailgun.net/v2/sandbox91d3515882ecfaa1c65be642.mailgun.org/messages`, // same line, single quotes
|
||||
@@ -51,13 +56,26 @@ func CurlBasicAuth() *config.Rule {
|
||||
}
|
||||
fps := []string{
|
||||
// short
|
||||
`curl -i -u 'test:test'`,
|
||||
` curl -sL --user "$1:$2" "$3" > "$4"`, // environment variable
|
||||
`curl -u <user:password> https://test.com/endpoint`, // placeholder
|
||||
`curl --user neo4j:[PASSWORD] http://[IP]:7474/db/data/`, // placeholder
|
||||
`curl -u "myusername" http://localhost:15130/api/check_user/`, // no password
|
||||
`curl -u username:token`,
|
||||
`curl -u "${_username}:${_password}"`,
|
||||
`curl -u "${username}":"${password}"`,
|
||||
`curl -k -X POST -I -u "SRVC_JENKINS:${APPID}"`,
|
||||
|
||||
// long
|
||||
` curl -sL --user "$GITHUB_USERNAME:$GITHUB_PASSWORD" "$GITHUB_URL" > "$TESTS_PATH"`, // environment variable
|
||||
`curl -sw '%{http_code}' -X POST --user '$USERNAME:$PASSWORD' $GItHUB_API_URL/$GIT_COMMIT --data`,
|
||||
`curl --user "xxx:yyy"`,
|
||||
` curl -sL --user "$GITHUB_USERNAME:$GITHUB_PASSWORD" "$GITHUB_URL" > "$TESTS_PATH"`, // environment variable
|
||||
// variable interpolation
|
||||
`curl --silent --fail {{- if and $.Values.username $.Values.password }} --user "{{ $.Values.username }}:{{ $.Values.password }}"`,
|
||||
`curl -XGET -i -u "${{ env.ELK_ID }}:${{ build.env.ELK_PASS }}"`,
|
||||
`curl -XGET -i -u "${{needs.vault.outputs.account_id}}:${{needs.vault.outputs.account_password}}"`,
|
||||
`curl -XGET -i -u "${{ steps.vault.outputs.account_id }}:${{ steps.vault.outputs.account_password }}"`,
|
||||
`curl -X POST --user "$(cat ./login.txt):$(cat ./password.txt)"`, // command
|
||||
`curl http://127.0.0.1:5000/file --user user:pass --digest # digest auth`, // placeholder
|
||||
` curl -X GET --insecure --user "username:password" \`, // placeholder
|
||||
`curl --silent --insecure --user ${f5user}:${f5pass} \`, // placeholder
|
||||
@@ -75,3 +93,106 @@ nc -u -l 41234`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
|
||||
// https://curl.se/docs/manpage.html#-H
|
||||
func CurlHeaderAuth() *config.Rule {
|
||||
// language=regexp
|
||||
authPat := `(?i)(?:Authorization:[ \t]{0,5}(?:Basic[ \t]([a-z0-9+/]{8,}={0,3})|(?:Bearer|(?:Api-)?Token)[ \t]([\w=~@.+/-]{8,})|([\w=~@.+/-]{8,}))|(?:(?:X-(?:[a-z]+-)?)?(?:Api-?)?(?:Key|Token)):[ \t]{0,5}([\w=~@.+/-]{8,}))`
|
||||
r := config.Rule{
|
||||
RuleID: "curl-auth-header",
|
||||
// TODO: Description: "",
|
||||
Regex: regexp.MustCompile(
|
||||
// language=regexp
|
||||
fmt.Sprintf(`\bcurl\b(?:.*?|.*?(?:[\r\n]{1,2}.*?){1,5})[ \t\n\r](?:-H|--header)(?:=|[ \t]{0,5})(?:"%s"|'%s')(?:\B|\s|\z)`, authPat, authPat)),
|
||||
Entropy: 2.75,
|
||||
Keywords: []string{"curl"},
|
||||
//Allowlists: []config.Allowlist{
|
||||
// {
|
||||
// Regexes: []*regexp.Regexp{},
|
||||
// },
|
||||
//},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
`curl --header 'Authorization: 5eb4223e-5008-46e5-be67-c7b8f2732305'`,
|
||||
// Short flag.
|
||||
`curl -H 'Authorization: Basic YnJvd3Nlcjo=' \`, // same line, single quotes
|
||||
// TODO: Handle short flags combined.
|
||||
//`TOKEN=$(curl -sH "Authorization: Basic $BASIC_TOKEN" "https://$REGISTRY/oauth2/token?service=$REGISTRY&scope=repository:$REPO:pull" | jq -r .access_token)`,
|
||||
|
||||
// Long flag.
|
||||
`curl -k -X POST --header "Authorization: Basic djJlNEpYa0NJUHZ5a2FWT0VRXzRqZmZUdDkwYTp2emNBZGFzZWpmlWZiUDc2VUJjNDNNVDExclVh" "https://api-qa.example.com:8243/token" -d "grant_type=client_credentials"`, // same line, double quotes
|
||||
|
||||
// Basic auth.
|
||||
`curl -X POST -H "Content-Type: application/json" \
|
||||
-H "Authorization: Basic MzUzYjMwMmM0NDU3NGY1NjUwNDU2ODdlNTM0ZTdkNmE6Mjg2OTI0Njk3ZTYxNWE2NzJhNjQ2YTQ5MzU0NTY0NmM=" \
|
||||
-d '{"user":{"emailAddress":"test@example.com"}, "password":"password"}' \
|
||||
'http://localhost:8080/oauth2-provider/v1.0/users'`, // different line, double quotes
|
||||
`#curl -X POST \
|
||||
# https://api.mailgun.net/v3/sandbox7dbcabccd4314c123e8b23599d35f5b6.mailgun.org/messages \
|
||||
# -H 'Authorization: Basic YXBpOmtleS1hN2MzNDJ3MzNhNWQxLTU2M2U3MjlwLTZhYjI3YzYzNzM0Ng==' \
|
||||
# -F from='Excited User <mailgun@sandbox7dbc123bccd4314c0aae8b23599d35f5b6.mailgun.org>' \
|
||||
# -F to='joe@example.com' \
|
||||
# -F subject='Hello' \
|
||||
# -F text='Testing some Mailgun awesomness!'`, // different line, single quotes
|
||||
|
||||
// Bearer auth
|
||||
`# curl -X GET "http://localhost:3000/api/cron/status" -H "Authorization: Bearer cfcabd11c7ed9a41b1a3e063c32d5114"`, // same line, double quotes
|
||||
`curl -X PUT -H 'Authorization: Bearer jC+6TUUjCNHcVtAXpcqBCgxnA8r+qD6MatnYaf/+289y7HWpK0BWPyLHv/K4DMN32fufwmeVVjlo8zjgBh8kx3GfS6IqO70w1DVMSCTwX7fhEpiXaxzv0mhSMHDX9Kw63Q6DkavUWUV+MDNhCF5wGQrcdQNncVRF3YkuDHDT/xw2YWyZ/DX8k+gAYiC8gcD8Ueg0ljBVS1IDwPjuGoFPESJVxYr0MDPF2D8Pn2S5rq692U4D9ZLuluS46VA4DK6ig5P7QM5XVXi4V7vXM8qpN/zqneyz+w4PUh6NIX7QG6JczMhYd9maWRWVat5jDdyII63P6sNAy9QZjw+ClW211Q==' -d 'user={"account":"user@domain.com", "roles":["user"]}' http://127.0.0.1:8443/desks/1/occupy`, // same line, single quotes
|
||||
`curl https://api.openai.com/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer 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" \`, // different line, double quotes
|
||||
`curl -X GET "https://api.cloudflare.com/client/v4/user/tokens/verify" \
|
||||
-H "Authorization: Bearer _FXNljbSRYMWx3TWrd7lgKhLtVZX6iskC8Wcbb4b" \
|
||||
-H "Content-Type:application/json"`,
|
||||
`curl -H "Authorization: Bearer sha256~bRLFnzd59Z3XpZH5_seJPHALOuvbWiKwbFKSsoALkgp"`,
|
||||
|
||||
// Token auth
|
||||
`curl -H "Authorization: Api-Token 22cb987851bc5659l29114c62e60c79abd0d2c08" --request PUT https://appsecclass.report/api/use/635`, // token
|
||||
`curl -H "Authorization: Token 22cb987851bc5659229114c62e60c79abd0d2c08" --request PUT https://appsecclass.report/api/use/635`, // token
|
||||
|
||||
// Nothing
|
||||
`curl -L -H "Authorization:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb25maWRlbmNlIjowLjh9.kvRPfjAhLhtRTczoRgctVGp7KY1QVH3UBZM-gM0x8ec" service1.local -> correct jwt `, // no prefix
|
||||
`curl -L -H "Authorization: sha256~bRLFnzd5@=-.a+/hgdS"`, // no prefix
|
||||
|
||||
// Non-authorization headers.
|
||||
`curl -X GET \
|
||||
-H "apikey: c4ed6c21-9dd5-4a05-8e3f-c56d1151cce8" \
|
||||
-H "Accept: application/json" \`, // apikey
|
||||
`curl -X POST --header "Api-Token: Sk94HG7f6KB"`, // api-token
|
||||
`curl -XPOST http://localhost:8080/api/tasks -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "Token: 3fea6af1349166ea" -d "content=hello-curl"`, // token
|
||||
`curl -X GET https://octopus.corp.net/
|
||||
-H "X-Octopus-ApiKey: 3a16750d-d363-41a4-8ebd-035408f7730f" \`, // X-$thing-ApiKey
|
||||
}
|
||||
fps := []string{
|
||||
// Placeholders
|
||||
`curl https://example.com/micropub -d h=entry -d "content=Hello World" -H "Authorization: Bearer XXXXXXXXXXXX"`,
|
||||
`curl -X POST https://accounts.spotify.com/api/token -d grant_type=client_credentials --header "Authorization: Basic ..."`,
|
||||
`curl \
|
||||
-H "Authorization: Bearer <Openverse API token>" \
|
||||
"https://api.openverse.org/v1/audio/?q=test"`,
|
||||
`curl -v -v -v -X POST https://domain/api/v1/authentication/sso/login-url/ \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H "Authorization: Token **********" \
|
||||
-d '{"username": "test", "next": "/luna/"}'`,
|
||||
|
||||
// Variables
|
||||
`curl -XPOST http://localhost:8080/api/token -H "Authorization: basic {base64(email:password[\n])}" => token`, // same line, invalid base64
|
||||
`curl -X GET \
|
||||
-H "apikey: $API_KEY" \
|
||||
-H "Accept: $FORMAT" \
|
||||
"$API_URL/rest/v1/stats_derniere_labellisation"`, // API Key placeholder
|
||||
`$ curl -X POST "http://localhost:8000/v1/chat/completions" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $API_KEY" \
|
||||
-d '{
|
||||
"model": "chatglm3-6b-32k",
|
||||
"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello!"}]
|
||||
}'`, // different line, placeholder
|
||||
`curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $(gcloud auth print-access-token)" https://workflowexecutions.googleapis.com/v1/projects/244283331594/locations/us-central1/workflows/sample-workflow/executions/43c925aa-514a-44c1-a0a4-a9f8f26fd2cb/callbacks/1705791f-d446-4e92-a6d0-a13622422e80_31864a51-8c13-4b03-ad4d-945cdc8d0631`, // script
|
||||
|
||||
// Not valid BASIC
|
||||
`curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb25maWRlbmNlIjowLjh9.kvRPfjAhLhtRTczoRgctVGp7KY1QVH3UBZM-gM0x8ec" \`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -9,15 +9,20 @@ import (
|
||||
func Databricks() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a Databricks API token, which may compromise big data analytics platforms and sensitive data processing.",
|
||||
RuleID: "databricks-api-token",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`dapi[a-h0-9]{32}`, true),
|
||||
Description: "Uncovered a Databricks API token, which may compromise big data analytics platforms and sensitive data processing.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`dapi[a-f0-9]{32}(?:-\d)?`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"dapi"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("databricks", "dapi"+secrets.NewSecret(utils.Hex("32"))),
|
||||
`token = dapif13ac4b49d1cb31f69f678e39602e381-2`, // gitleaks:ignore
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
`DATABRICKS_TOKEN=dapi123456789012345678a9bc01234defg5`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -8,9 +8,10 @@ import (
|
||||
|
||||
func DigitalOceanPAT() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discovered a DigitalOcean Personal Access Token, posing a threat to cloud infrastructure security and data privacy.",
|
||||
RuleID: "digitalocean-pat",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`dop_v1_[a-f0-9]{64}`, true),
|
||||
Description: "Discovered a DigitalOcean Personal Access Token, posing a threat to cloud infrastructure security and data privacy.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`dop_v1_[a-f0-9]{64}`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"dop_v1_"},
|
||||
}
|
||||
|
||||
@@ -22,11 +23,11 @@ func DigitalOceanPAT() *config.Rule {
|
||||
|
||||
func DigitalOceanOAuthToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Found a DigitalOcean OAuth Access Token, risking unauthorized cloud resource access and data compromise.",
|
||||
RuleID: "digitalocean-access-token",
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`doo_v1_[a-f0-9]{64}`, true),
|
||||
Keywords: []string{"doo_v1_"},
|
||||
Description: "Found a DigitalOcean OAuth Access Token, risking unauthorized cloud resource access and data compromise.",
|
||||
Entropy: 3,
|
||||
Regex: utils.GenerateUniqueTokenRegex(`doo_v1_[a-f0-9]{64}`, false),
|
||||
Keywords: []string{"doo_v1_"},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
func DiscordAPIToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Discord API key, potentially compromising communication channels and user data privacy on Discord.",
|
||||
RuleID: "discord-api-token",
|
||||
Description: "Detected a Discord API key, potentially compromising communication channels and user data privacy on Discord.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"discord"}, utils.Hex("64"), true),
|
||||
Keywords: []string{"discord"},
|
||||
}
|
||||
@@ -25,9 +25,10 @@ func DiscordAPIToken() *config.Rule {
|
||||
func DiscordClientID() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a Discord client ID, which may lead to unauthorized integrations and data exposure in Discord applications.",
|
||||
RuleID: "discord-client-id",
|
||||
Description: "Identified a Discord client ID, which may lead to unauthorized integrations and data exposure in Discord applications.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"discord"}, utils.Numeric("18"), true),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"discord"},
|
||||
}
|
||||
|
||||
@@ -35,15 +36,20 @@ func DiscordClientID() *config.Rule {
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("discord", secrets.NewSecret(utils.Numeric("18"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
// Low entropy
|
||||
`discord=000000000000000000`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
|
||||
func DiscordClientSecret() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a potential Discord client secret, risking compromised Discord bot integrations and data leaks.",
|
||||
RuleID: "discord-client-secret",
|
||||
Description: "Discovered a potential Discord client secret, risking compromised Discord bot integrations and data leaks.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"discord"}, utils.AlphaNumericExtended("32"), true),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"discord"},
|
||||
}
|
||||
|
||||
@@ -51,5 +57,11 @@ func DiscordClientSecret() *config.Rule {
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("discord", secrets.NewSecret(utils.Numeric("32"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
// Low entropy
|
||||
`discord=00000000000000000000000000000000`,
|
||||
// TODO:
|
||||
//`discord=01234567890123456789012345678901`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -11,10 +11,11 @@ import (
|
||||
func Doppler() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Doppler API token, posing a risk to environment and secrets management security.",
|
||||
RuleID: "doppler-api-token",
|
||||
Description: "Discovered a Doppler API token, posing a risk to environment and secrets management security.",
|
||||
Regex: regexp.MustCompile(`dp\.pt\.(?i)[a-z0-9]{43}`),
|
||||
Keywords: []string{"doppler"},
|
||||
Entropy: 2,
|
||||
Keywords: []string{`dp.pt.`},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -14,7 +14,8 @@ func Duffel() *config.Rule {
|
||||
RuleID: "duffel-api-token",
|
||||
Description: "Uncovered a Duffel API token, which may compromise travel platform integrations and sensitive customer data.",
|
||||
Regex: regexp.MustCompile(`duffel_(?:test|live)_(?i)[a-z0-9_\-=]{43}`),
|
||||
Keywords: []string{"duffel"},
|
||||
Entropy: 2,
|
||||
Keywords: []string{"duffel_"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -11,10 +11,11 @@ import (
|
||||
func Dynatrace() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Dynatrace API token, potentially risking application performance monitoring and data exposure.",
|
||||
RuleID: "dynatrace-api-token",
|
||||
Description: "Detected a Dynatrace API token, potentially risking application performance monitoring and data exposure.",
|
||||
Regex: regexp.MustCompile(`dt0c01\.(?i)[a-z0-9]{24}\.[a-z0-9]{64}`),
|
||||
Keywords: []string{"dynatrace"},
|
||||
Entropy: 4,
|
||||
Keywords: []string{"dt0c01"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -11,9 +11,10 @@ import (
|
||||
func EasyPost() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified an EasyPost API token, which could lead to unauthorized postal and shipment service access and data exposure.",
|
||||
RuleID: "easypost-api-token",
|
||||
Description: "Identified an EasyPost API token, which could lead to unauthorized postal and shipment service access and data exposure.",
|
||||
Regex: regexp.MustCompile(`\bEZAK(?i)[a-z0-9]{54}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"EZAK"},
|
||||
}
|
||||
|
||||
@@ -27,9 +28,10 @@ func EasyPost() *config.Rule {
|
||||
func EasyPostTestAPI() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected an EasyPost test API token, risking exposure of test environments and potentially sensitive shipment data.",
|
||||
RuleID: "easypost-test-api-token",
|
||||
Description: "Detected an EasyPost test API token, risking exposure of test environments and potentially sensitive shipment data.",
|
||||
Regex: regexp.MustCompile(`\bEZTK(?i)[a-z0-9]{54}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"EZTK"},
|
||||
}
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
func FacebookSecret() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Facebook Application secret, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
|
||||
RuleID: "facebook-secret",
|
||||
Description: "Discovered a Facebook Application secret, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"facebook"}, utils.Hex("32"), true),
|
||||
|
||||
Keywords: []string{"facebook"},
|
||||
Entropy: 3,
|
||||
Keywords: []string{"facebook"},
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -31,9 +31,10 @@ func FacebookSecret() *config.Rule {
|
||||
func FacebookAccessToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Facebook Access Token, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
|
||||
RuleID: "facebook-access-token",
|
||||
Description: "Discovered a Facebook Access Token, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`\d{15,16}(\||%)[0-9a-z\-_]{27,40}`, true),
|
||||
Entropy: 3,
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -49,9 +50,10 @@ func FacebookAccessToken() *config.Rule {
|
||||
func FacebookPageAccessToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Facebook Page Access Token, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
|
||||
RuleID: "facebook-page-access-token",
|
||||
Regex: utils.GenerateUniqueTokenRegex("EAA[MC]"+utils.AlphaNumeric("20,"), true),
|
||||
Description: "Discovered a Facebook Page Access Token, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
|
||||
Regex: utils.GenerateUniqueTokenRegex("EAA[MC](?i)"+utils.AlphaNumeric("20,"), false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"EAAM", "EAAC"},
|
||||
}
|
||||
|
||||
@@ -62,5 +64,8 @@ func FacebookPageAccessToken() *config.Rule {
|
||||
`- name: FACEBOOK_TOKEN
|
||||
value: "EAACEdEose0cBA1bad3afsf2aew"`, // gitleaks:allow
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
`eaaaC0b75a9329fded2ffa9a02b47e0117831b82`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -11,9 +11,10 @@ import (
|
||||
func FlutterwavePublicKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Finicity Public Key, potentially exposing public cryptographic operations and integrations.",
|
||||
RuleID: "flutterwave-public-key",
|
||||
Description: "Detected a Finicity Public Key, potentially exposing public cryptographic operations and integrations.",
|
||||
Regex: regexp.MustCompile(`FLWPUBK_TEST-(?i)[a-h0-9]{32}-X`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"FLWPUBK_TEST"},
|
||||
}
|
||||
|
||||
@@ -27,9 +28,10 @@ func FlutterwavePublicKey() *config.Rule {
|
||||
func FlutterwaveSecretKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a Flutterwave Secret Key, risking unauthorized financial transactions and data breaches.",
|
||||
RuleID: "flutterwave-secret-key",
|
||||
Description: "Identified a Flutterwave Secret Key, risking unauthorized financial transactions and data breaches.",
|
||||
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{32}-X`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"FLWSECK_TEST"},
|
||||
}
|
||||
|
||||
@@ -43,9 +45,10 @@ func FlutterwaveSecretKey() *config.Rule {
|
||||
func FlutterwaveEncKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a Flutterwave Encryption Key, which may compromise payment processing and sensitive financial information.",
|
||||
RuleID: "flutterwave-encryption-key",
|
||||
Description: "Uncovered a Flutterwave Encryption Key, which may compromise payment processing and sensitive financial information.",
|
||||
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{12}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"FLWSECK_TEST"},
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@ package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func GenericCredential() *config.Rule {
|
||||
@@ -11,47 +13,162 @@ func GenericCredential() *config.Rule {
|
||||
RuleID: "generic-api-key",
|
||||
Description: "Detected a Generic API Key, potentially exposing access to various services and sensitive operations.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{
|
||||
"access",
|
||||
"auth",
|
||||
`(?-i:[Aa]pi|API)`,
|
||||
"credential",
|
||||
"creds",
|
||||
"key",
|
||||
"api",
|
||||
"token",
|
||||
"secret",
|
||||
"client",
|
||||
"passwd",
|
||||
"password",
|
||||
"auth",
|
||||
"access",
|
||||
}, `[0-9a-z\-_.=]{10,150}`, true),
|
||||
"secret",
|
||||
"token",
|
||||
}, `[\w.=-]{10,150}`, true),
|
||||
Keywords: []string{
|
||||
"key",
|
||||
"access",
|
||||
"api",
|
||||
"token",
|
||||
"secret",
|
||||
"client",
|
||||
"auth",
|
||||
"key",
|
||||
"credential",
|
||||
"creds",
|
||||
"passwd",
|
||||
"password",
|
||||
"auth",
|
||||
"access",
|
||||
"secret",
|
||||
"token",
|
||||
},
|
||||
Entropy: 3.5,
|
||||
Allowlists: []config.Allowlist{
|
||||
{
|
||||
StopWords: DefaultStopWords,
|
||||
Description: "Allowlist for Generic API Keys",
|
||||
MatchCondition: config.AllowlistMatchOr,
|
||||
Regexes: []*regexp.Regexp{
|
||||
regexp.MustCompile(`(?i)(` +
|
||||
// Access
|
||||
`accessor` +
|
||||
// API
|
||||
`|api[_.-]?(version|id)` + // version/id -> not a secret
|
||||
`|rapid|capital` + // common words containing "api"
|
||||
// Auth
|
||||
`|author` +
|
||||
// Credentials
|
||||
`|(?-i:(?:c|jobC)redentials?Id|withCredentials)` + // Jenkins plugins
|
||||
// Key
|
||||
`|key[_.-]?(alias|board|code|ring|stone|storetype|word|up|down|left|right)` +
|
||||
`|issuerkeyhash` + // part of ssl cert
|
||||
`|(bucket|primary|foreign|natural|hot)[_.-]?key` +
|
||||
`|(?-i:[DdMm]onkey|[DM]ONKEY)|keying` + // common words containing "key"
|
||||
// Secret
|
||||
`|(secret)[_.-]?name` + // name of e.g. env variable
|
||||
// Token
|
||||
|
||||
// General
|
||||
`|public[_.-]?(key|token)` + // public key -> not a secret
|
||||
`|(key|token)[_.-]?file` +
|
||||
`)`),
|
||||
},
|
||||
RegexTarget: "match",
|
||||
StopWords: DefaultStopWords,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
// Access
|
||||
`'access_token': 'eyJ0eXAioiJKV1slS3oASx=='`,
|
||||
|
||||
// API
|
||||
`some_api_token_123 = "` + newPlausibleSecret(`[a-zA-Z0-9]{60}`) + `"`,
|
||||
|
||||
// Auth
|
||||
// Credentials
|
||||
`"credentials" : "0afae57f3ccfd9d7f5767067bc48b30f719e271ba470488056e37ab35d4b6506"`,
|
||||
`creds = ` + newPlausibleSecret(`[a-zA-Z0-9]{30}`),
|
||||
|
||||
// Key
|
||||
`private-key: ` + newPlausibleSecret(`[a-zA-Z0-9\-_.=]{100}`),
|
||||
|
||||
// Password
|
||||
`passwd = ` + newPlausibleSecret(`[a-zA-Z0-9\-_.=]{30}`),
|
||||
|
||||
// Secret
|
||||
`"client_secret" : "6da89121079f83b2eb6acccf8219ea982c3d79bccc3e9c6a85856480661f8fde",`,
|
||||
`mySecretString=` + newPlausibleSecret(`[a-zA-Z0-9]{30}`),
|
||||
`todo_secret_do_not_commit = ` + newPlausibleSecret(`[a-zA-Z0-9]{30}`),
|
||||
|
||||
// Token
|
||||
utils.GenerateSampleSecret("generic", "CLOJARS_34bf0e88955ff5a1c328d6a7491acc4f48e865a7b8dd4d70a70749037443"), //gitleaks:allow
|
||||
utils.GenerateSampleSecret("generic", "Zf3D0LXCM3EIMbgJpUNnkRtOfOueHznB"),
|
||||
`"client_id" : "0afae57f3ccfd9d7f5767067bc48b30f719e271ba470488056e37ab35d4b6506"`,
|
||||
`"client_secret" : "6da89121079f83b2eb6acccf8219ea982c3d79bccc3e9c6a85856480661f8fde",`,
|
||||
}
|
||||
fps := []string{
|
||||
`client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.client-vpn-endpoint.id`,
|
||||
// Access
|
||||
`"accessor":"rA1wk0Y45YCufyfq",`,
|
||||
|
||||
// API
|
||||
`this.ultraPictureBox1.Name = "ultraPictureBox1";`,
|
||||
`rapidstring:marm64-uwp=fail`,
|
||||
`event-bus-message-api:rc0.15.0_20231217_1420-SNAPSHOT'`,
|
||||
`COMMUNICATION_API_VERSION=rc0.13.0_20230412_0712-SNAPSHOT`,
|
||||
`MantleAPI_version=9a038989604e8da62ecddbe2094b16ce1b778be1`,
|
||||
|
||||
// Auth
|
||||
`author = "james.fake@ymail.com",`,
|
||||
|
||||
// Credentials
|
||||
`withCredentials([usernamePassword(credentialsId: '29f63271-dc2f-4734-8221-5b31b5169bac', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {`,
|
||||
`credentialsId: 'ff083f76-7804-4ef1-80e4-fe975bb9141b'`,
|
||||
`jobCredentialsId: 'f4aeb6bc-2a25-458a-8111-9be9e502c0e7'`,
|
||||
` "credentialId": "B9mTcFSck2LzJO2S3ols63",`,
|
||||
|
||||
// Key
|
||||
`keyword: "Befaehigung_P2"`,
|
||||
`public_key = "9Cnzj4p4WGeKLs1Pt8QuKUpRKfFLfRYC9AIKjbJTWit"`,
|
||||
`monkeys-audio:mx64-uwp=fail`,
|
||||
`primaryKey=` + newPlausibleSecret(`[a-zA-Z0-9\-_.=]{30}`),
|
||||
`foreignKey=` + newPlausibleSecret(`[a-zA-Z0-9\-_.=]{30}`),
|
||||
`key_down_event=` + newPlausibleSecret(`[a-zA-Z0-9\-_.=]{30}`),
|
||||
`issuerKeyHash=` + newPlausibleSecret(`[a-zA-Z0-9\-_.=]{30}`),
|
||||
`<entry key="jetbrains.mps.v8_elimination" value="executed" />`,
|
||||
`minisat-master-keying:x64-uwp=fail`,
|
||||
`IceSSL.KeyFile=s_rsa1024_priv.pem`,
|
||||
`"bucket_key": "SalesResults-1.2"`,
|
||||
//`<TAR key="REF_ID_923.properties" value="/opts/config/alias/"/>`,
|
||||
`<key tag="SecurityIdentifier" name="SecurityIdentifier" type="STRING" />`,
|
||||
//`packageKey":` + newPlausibleSecret(`[a-zA-Z0-9\-_.=]{30}`),
|
||||
|
||||
// Password
|
||||
`password combination.
|
||||
|
||||
R5: Regulatory--21`,
|
||||
`PuttyPassword=0`,
|
||||
|
||||
// Secret
|
||||
`LLM_SECRET_NAME = "NEXUS-GPT4-API-KEY"`,
|
||||
|
||||
// Token
|
||||
`publicToken = "9Cnzj4p4WGeKLs1Pt8QuKUpRKfFLfRYC9AIKjbJTWit"`,
|
||||
`<SourceFile SourceLocation="F:\Extracts\" TokenFile="RTL_INST_CODE.cer">`,
|
||||
|
||||
// General
|
||||
`clientId = "73082700-1f09-405b-80d0-3131bfd6272d"`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
|
||||
func newPlausibleSecret(regex string) string {
|
||||
allowList := config.Allowlist{StopWords: DefaultStopWords}
|
||||
// attempt to generate a random secret,
|
||||
// retrying until it contains at least one digit and no stop words
|
||||
// TODO: currently the DefaultStopWords list contains many short words,
|
||||
// so there is a significant chance of generating a secret that contains a stop word
|
||||
for {
|
||||
secret := secrets.NewSecret(regex)
|
||||
if !regexp.MustCompile(`[1-9]`).MatchString(secret) {
|
||||
continue
|
||||
}
|
||||
if allowList.ContainsStopWord(secret) {
|
||||
continue
|
||||
}
|
||||
return secret
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,24 @@ import (
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
var githubAllowlist = []config.Allowlist{
|
||||
{
|
||||
Paths: []*regexp.Regexp{
|
||||
// https://github.com/octokit/auth-token.js/?tab=readme-ov-file#createtokenauthtoken-options
|
||||
regexp.MustCompile(`(^|/)@octokit/auth-token/README\.md$`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func GitHubPat() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a GitHub Personal Access Token, potentially leading to unauthorized repository access and sensitive content exposure.",
|
||||
RuleID: "github-pat",
|
||||
Description: "Uncovered a GitHub Personal Access Token, potentially leading to unauthorized repository access and sensitive content exposure.",
|
||||
Regex: regexp.MustCompile(`ghp_[0-9a-zA-Z]{36}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"ghp_"},
|
||||
Allowlists: githubAllowlist,
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -31,8 +41,8 @@ func GitHubPat() *config.Rule {
|
||||
func GitHubFineGrainedPat() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Found a GitHub Fine-Grained Personal Access Token, risking unauthorized repository access and code manipulation.",
|
||||
RuleID: "github-fine-grained-pat",
|
||||
Description: "Found a GitHub Fine-Grained Personal Access Token, risking unauthorized repository access and code manipulation.",
|
||||
Regex: regexp.MustCompile(`github_pat_\w{82}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"github_pat_"},
|
||||
@@ -51,8 +61,8 @@ func GitHubFineGrainedPat() *config.Rule {
|
||||
func GitHubOauth() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a GitHub OAuth Access Token, posing a risk of compromised GitHub account integrations and data leaks.",
|
||||
RuleID: "github-oauth",
|
||||
Description: "Discovered a GitHub OAuth Access Token, posing a risk of compromised GitHub account integrations and data leaks.",
|
||||
Regex: regexp.MustCompile(`gho_[0-9a-zA-Z]{36}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"gho_"},
|
||||
@@ -71,11 +81,12 @@ func GitHubOauth() *config.Rule {
|
||||
func GitHubApp() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitHub App Token, which may compromise GitHub application integrations and source code security.",
|
||||
RuleID: "github-app-token",
|
||||
Description: "Identified a GitHub App Token, which may compromise GitHub application integrations and source code security.",
|
||||
Regex: regexp.MustCompile(`(?:ghu|ghs)_[0-9a-zA-Z]{36}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"ghu_", "ghs_"},
|
||||
Allowlists: githubAllowlist,
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -93,8 +104,8 @@ func GitHubApp() *config.Rule {
|
||||
func GitHubRefresh() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a GitHub Refresh Token, which could allow prolonged unauthorized access to GitHub services.",
|
||||
RuleID: "github-refresh-token",
|
||||
Description: "Detected a GitHub Refresh Token, which could allow prolonged unauthorized access to GitHub services.",
|
||||
Regex: regexp.MustCompile(`ghr_[0-9a-zA-Z]{36}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"ghr_"},
|
||||
|
||||
@@ -1,57 +1,211 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
// overview with all GitLab tokens:
|
||||
// https://docs.gitlab.com/ee/security/tokens/index.html#token-prefixes
|
||||
|
||||
func GitlabCiCdJobToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitLab CI/CD Job Token, potential access to projects and some APIs on behalf of a user while the CI job is running.",
|
||||
RuleID: "gitlab-cicd-job-token",
|
||||
Regex: regexp.MustCompile(`glcbt-[0-9a-zA-Z]{1,5}_[0-9a-zA-Z_-]{20}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glcbt-"},
|
||||
}
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glcbt-"+secrets.NewSecret(utils.AlphaNumeric("5"))+"_"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabDeployToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitLab Deploy Token, risking access to repositories, packages and containers with write access.",
|
||||
RuleID: "gitlab-deploy-token",
|
||||
Regex: regexp.MustCompile(`gldt-[0-9a-zA-Z_\-]{20}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"gldt-"},
|
||||
}
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "gldt-"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabFeatureFlagClientToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitLab feature flag client token, risks exposing user lists and features flags used by an application.",
|
||||
RuleID: "gitlab-feature-flag-client-token",
|
||||
Regex: regexp.MustCompile(`glffct-[0-9a-zA-Z_\-]{20}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glffct-"},
|
||||
}
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glffct-"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabFeedToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitLab feed token, risking exposure of user data.",
|
||||
RuleID: "gitlab-feed-token",
|
||||
Regex: regexp.MustCompile(`glft-[0-9a-zA-Z_\-]{20}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glft-"},
|
||||
}
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glft-"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabIncomingMailToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitLab incoming mail token, risking manipulation of data sent by mail.",
|
||||
RuleID: "gitlab-incoming-mail-token",
|
||||
Regex: regexp.MustCompile(`glimt-[0-9a-zA-Z_\-]{25}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glimt-"},
|
||||
}
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glimt-"+secrets.NewSecret(utils.AlphaNumeric("25"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabKubernetesAgentToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitLab Kubernetes Agent token, risking access to repos and registry of projects connected via agent.",
|
||||
RuleID: "gitlab-kubernetes-agent-token",
|
||||
Regex: regexp.MustCompile(`glagent-[0-9a-zA-Z_\-]{50}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glagent-"},
|
||||
}
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glagent-"+secrets.NewSecret(utils.AlphaNumeric("50"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabOauthAppSecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitLab OIDC Application Secret, risking access to apps using GitLab as authentication provider.",
|
||||
RuleID: "gitlab-oauth-app-secret",
|
||||
Regex: regexp.MustCompile(`gloas-[0-9a-zA-Z_\-]{64}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"gloas-"},
|
||||
}
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "gloas-"+secrets.NewSecret(utils.AlphaNumeric("64"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabPat() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitLab Personal Access Token, risking unauthorized access to GitLab repositories and codebase exposure.",
|
||||
RuleID: "gitlab-pat",
|
||||
Regex: regexp.MustCompile(`glpat-[0-9a-zA-Z\-\_]{20}`),
|
||||
Description: "Identified a GitLab Personal Access Token, risking unauthorized access to GitLab repositories and codebase exposure.",
|
||||
Regex: regexp.MustCompile(`glpat-[\w-]{20}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glpat-"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glpat-"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
"glpat-XXXXXXXXXXX-XXXXXXXX",
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
|
||||
func GitlabPipelineTriggerToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Found a GitLab Pipeline Trigger Token, potentially compromising continuous integration workflows and project security.",
|
||||
RuleID: "gitlab-ptt",
|
||||
Description: "Found a GitLab Pipeline Trigger Token, potentially compromising continuous integration workflows and project security.",
|
||||
Regex: regexp.MustCompile(`glptt-[0-9a-f]{40}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glptt-"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glptt-"+secrets.NewSecret(utils.Hex("40"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
"glptt-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
|
||||
func GitlabRunnerRegistrationToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a GitLab Runner Registration Token, posing a risk to CI/CD pipeline integrity and unauthorized access.",
|
||||
RuleID: "gitlab-rrt",
|
||||
Regex: regexp.MustCompile(`GR1348941[0-9a-zA-Z\-\_]{20}`),
|
||||
Description: "Discovered a GitLab Runner Registration Token, posing a risk to CI/CD pipeline integrity and unauthorized access.",
|
||||
Regex: regexp.MustCompile(`GR1348941[\w-]{20}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"GR1348941"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "GR1348941"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
fps := []string{
|
||||
"GR134894112312312312312312312",
|
||||
"GR1348941XXXXXXXXXXXXXXXXXXXX",
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
|
||||
func GitlabRunnerAuthenticationToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discovered a GitLab Runner Authentication Token, posing a risk to CI/CD pipeline integrity and unauthorized access.",
|
||||
RuleID: "gitlab-runner-authentication-token",
|
||||
Regex: regexp.MustCompile(`glrt-[0-9a-zA-Z_\-]{20}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glrt-"},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glrt-"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabScimToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discovered a GitLab SCIM Token, posing a risk to unauthorized access for a organization or instance.",
|
||||
RuleID: "gitlab-scim-token",
|
||||
Regex: regexp.MustCompile(`glsoat-[0-9a-zA-Z_\-]{20}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glsoat-"},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glsoat-"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabSessionCookie() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discovered a GitLab Session Cookie, posing a risk to unauthorized access to a user account.",
|
||||
RuleID: "gitlab-session-cookie",
|
||||
Regex: regexp.MustCompile(`_gitlab_session=[0-9a-z]{32}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"_gitlab_session="},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "_gitlab_session="+secrets.NewSecret(utils.AlphaNumeric("32"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -9,18 +9,16 @@ import (
|
||||
func GrafanaApiKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a Grafana API key, which could compromise monitoring dashboards and sensitive data analytics.",
|
||||
RuleID: "grafana-api-key",
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`eyJrIjoi[A-Za-z0-9]{70,400}={0,2}`, true),
|
||||
Keywords: []string{"eyJrIjoi"},
|
||||
Description: "Identified a Grafana API key, which could compromise monitoring dashboards and sensitive data analytics.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`eyJrIjoi[A-Za-z0-9]{70,400}={0,3}`, true),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"eyJrIjoi"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("grafana-api-key",
|
||||
"eyJrIjoi"+
|
||||
secrets.NewSecret(utils.AlphaNumeric("70"))),
|
||||
utils.GenerateSampleSecret("grafana-api-key", "eyJrIjoi"+secrets.NewSecret(utils.AlphaNumeric("70"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -28,11 +26,11 @@ func GrafanaApiKey() *config.Rule {
|
||||
func GrafanaCloudApiToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Found a Grafana cloud API token, risking unauthorized access to cloud-based monitoring services and data exposure.",
|
||||
RuleID: "grafana-cloud-api-token",
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`glc_[A-Za-z0-9+/]{32,400}={0,2}`, true),
|
||||
Keywords: []string{"glc_"},
|
||||
Description: "Found a Grafana cloud API token, risking unauthorized access to cloud-based monitoring services and data exposure.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`glc_[A-Za-z0-9+/]{32,400}={0,3}`, true),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glc_"},
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -40,18 +38,35 @@ func GrafanaCloudApiToken() *config.Rule {
|
||||
utils.GenerateSampleSecret("grafana-cloud-api-token",
|
||||
"glc_"+
|
||||
secrets.NewSecret(utils.AlphaNumeric("32"))),
|
||||
`loki_key: glc_eyJvIjoiNzQ0NTg3IiwibiI7InN0YWlrLTQ3NTgzMC1obC13cml0ZS1oYW5kc29uJG9raSIsImsiOiI4M2w3cmdYUlBoMTUyMW1lMU023nl5UDUiLCJtIjp7IOIiOiJ1cyJ9fQ==`,
|
||||
// TODO:
|
||||
//` loki:
|
||||
//endpoint: https://322137:glc_eyJvIjoiNzQ0NTg3IiwibiI7InN0YWlrLTQ3NTgzMC1obC13cml0ZS1oYW5kc29uJG9raSIsImsiOiI4M2w3cmdYUlBoMTUyMW1lMU023nl5UDUiLCJtIjp7IOIiOiJ1cyJ9fQ==@logs-prod4.grafana.net/loki/api/v1/push`,
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
// Low entropy.
|
||||
`glc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
|
||||
` API_KEY="glc_111111111111111111111111111111111111111111="`,
|
||||
// Invalid.
|
||||
`static void GLC_CreateLightmapTextureArray(void);
|
||||
static void GLC_CreateLightmapTexturesIndividual(void);
|
||||
|
||||
void GLC_UploadLightmap(int textureUnit, int lightmapnum);`,
|
||||
`// Alias models
|
||||
void GLC_StateBeginUnderwaterAliasModelCaustics(texture_ref base_texture, texture_ref caustics_texture)
|
||||
{`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
|
||||
func GrafanaServiceAccountToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Grafana service account token, posing a risk of compromised monitoring services and data integrity.",
|
||||
RuleID: "grafana-service-account-token",
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8}`, true),
|
||||
Keywords: []string{"glsa_"},
|
||||
Description: "Discovered a Grafana service account token, posing a risk of compromised monitoring services and data integrity.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8}`, true),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glsa_"},
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -61,6 +76,10 @@ func GrafanaServiceAccountToken() *config.Rule {
|
||||
secrets.NewSecret(utils.AlphaNumeric("32"))+
|
||||
"_"+
|
||||
secrets.NewSecret((utils.Hex("8")))),
|
||||
`'Authorization': 'Bearer glsa_pITqMOBIfNH2KL4PkXJqmTyQl0D9QGxF_486f63e1'`,
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
"glsa_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_AAAAAAAA",
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
func HashiCorpTerraform() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a HashiCorp Terraform user/org API token, which may lead to unauthorized infrastructure management and security breaches.",
|
||||
RuleID: "hashicorp-tf-api-token",
|
||||
Description: "Uncovered a HashiCorp Terraform user/org API token, which may lead to unauthorized infrastructure management and security breaches.",
|
||||
Regex: regexp.MustCompile(`(?i)[a-z0-9]{14}\.(?-i:atlasv1)\.[a-z0-9\-_=]{60,70}`),
|
||||
Entropy: 3.5,
|
||||
Keywords: []string{"atlasv1"},
|
||||
@@ -34,11 +34,12 @@ func HashicorpField() *config.Rule {
|
||||
keywords := []string{"administrator_login_password", "password"}
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a HashiCorp Terraform password field, risking unauthorized infrastructure configuration and security breaches.",
|
||||
RuleID: "hashicorp-tf-password",
|
||||
Description: "Identified a HashiCorp Terraform password field, risking unauthorized infrastructure configuration and security breaches.",
|
||||
Regex: utils.GenerateSemiGenericRegex(keywords, fmt.Sprintf(`"%s"`, utils.AlphaNumericExtended("8,20")), true),
|
||||
Keywords: keywords,
|
||||
Entropy: 2,
|
||||
Path: regexp.MustCompile(`(?i)\.(?:tf|hcl)$`),
|
||||
Keywords: keywords,
|
||||
}
|
||||
|
||||
tps := map[string]string{
|
||||
|
||||
@@ -14,7 +14,7 @@ func VaultServiceToken() *config.Rule {
|
||||
Description: "Identified a Vault Service Token, potentially compromising infrastructure security and access to sensitive credentials.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(?:hvs\.[\w-]{90,120}|s\.(?i:[a-z0-9]{24}))`, false),
|
||||
Entropy: 3.5,
|
||||
Keywords: []string{"hvs", "s."},
|
||||
Keywords: []string{"hvs.", "s."},
|
||||
Allowlists: []config.Allowlist{
|
||||
{
|
||||
Regexes: []*regexp.Regexp{
|
||||
@@ -52,15 +52,17 @@ func VaultServiceToken() *config.Rule {
|
||||
func VaultBatchToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Vault Batch Token, risking unauthorized access to secret management services and sensitive data.",
|
||||
RuleID: "vault-batch-token",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`hvb\.[a-z0-9_-]{138,212}`, true),
|
||||
Keywords: []string{"hvb"},
|
||||
Description: "Detected a Vault Batch Token, risking unauthorized access to secret management services and sensitive data.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`hvb\.[\w-]{138,300}`, false),
|
||||
Entropy: 4,
|
||||
Keywords: []string{"hvb."},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("vault", "hvb."+secrets.NewSecret(utils.AlphaNumericExtendedShort("138"))),
|
||||
`hvb.AAAAAQJgxDgqsGNorpoOR7hPZ5SU-ynBvCl764jyRP_fnX7WvkdkDzGjbLNGdPdtlY33Als2P36yDZueqzfdGw9RsaTeaYXSH7E4RYSWuRoQ9YRKIw8o7mDDY2ZcT3KOB7RwtW1w1FN2eDqcy_sbCjXPaM1iBVH-mqMSYRmRd2nb5D1SJPeBzIYRqSglLc31wUGN7xEzyrKUczqOKsIcybQA`, // gitleaks:allow
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -19,8 +19,7 @@ func HuggingFaceAccessToken() *config.Rule {
|
||||
RuleID: "huggingface-access-token",
|
||||
Description: "Discovered a Hugging Face Access token, which could lead to unauthorized access to AI models and sensitive data.",
|
||||
Regex: regexp.MustCompile(`(?:^|[\\'"` + "`" + ` >=:])(hf_[a-zA-Z]{34})(?:$|[\\'"` + "`" + ` <])`),
|
||||
|
||||
Entropy: 1,
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"hf_",
|
||||
},
|
||||
|
||||
@@ -9,24 +9,34 @@ import (
|
||||
func InfracostAPIToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
// Human readable description of the rule
|
||||
RuleID: "infracost-api-token",
|
||||
Description: "Detected an Infracost API Token, risking unauthorized access to cloud cost estimation tools and financial data.",
|
||||
|
||||
// Unique ID for the rule
|
||||
RuleID: "infracost-api-token",
|
||||
|
||||
// Regex capture group for the actual secret
|
||||
|
||||
// Regex used for detecting secrets. See regex section below for more details
|
||||
Regex: utils.GenerateUniqueTokenRegex(`ico-[a-zA-Z0-9]{32}`, true),
|
||||
|
||||
// Keywords used for string matching on fragments (think of this as a prefilter)
|
||||
Keywords: []string{"ico-"},
|
||||
Regex: utils.GenerateUniqueTokenRegex(`ico-[a-zA-Z0-9]{32}`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"ico-"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("ico", "ico-"+secrets.NewSecret("[A-Za-z0-9]{32}")),
|
||||
` variable {
|
||||
name = "INFRACOST_API_KEY"
|
||||
secret_value = "ico-mlCr1Mn3SRcRiZMObUZOTHLcgtH2Lpgt"
|
||||
is_secret = true
|
||||
}`,
|
||||
// TODO: New format with longer keys?
|
||||
// ` headers = {
|
||||
//'X-Api-Key': 'ico-EeDdSfctrmjD14f45f45te5gJ7l6lw4o6M36sXT62a6',
|
||||
//'Content-Type': 'application/json',
|
||||
//}`,
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
// Low entropy
|
||||
`ico-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`,
|
||||
// Invalid
|
||||
`http://assets.r7.com/assets/media_box_tv_tres_colunas/video_box.ico-7a388b69018576d24b59331fd60aab0c.png`,
|
||||
`https://explosivelab.notion.site/Pianificazione-Nerdz-Ng-pubblico-1bc826ecc0994dd8915be97fc3489cde?pvs=74`,
|
||||
`http://ece252-2.uwaterloo.ca:2540/image?q=gAAAAABdHkoqb9ZaJ3q4dlzEvTgG9WYwKcD9Aw7OUXeFicO-5M5IdNDjHBpKw7KBK3nCVqtuga4yzUaFEpJn8BqA1LzZprIJBw==`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -11,7 +11,8 @@ func Intra42ClientSecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Found a Intra42 client secret, which could lead to unauthorized access to the 42School API and sensitive data.",
|
||||
RuleID: "intra42-client-secret",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`s-s4t2(?:ud|af)-[abcdef0123456789]{64}`, true),
|
||||
Regex: utils.GenerateUniqueTokenRegex(`s-s4t2(?:ud|af)-(?i)[abcdef0123456789]{64}`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"intra",
|
||||
"s-s4t2ud-",
|
||||
|
||||
@@ -15,6 +15,7 @@ func JWT() *config.Rule {
|
||||
Description: "Uncovered a JSON Web Token, which may lead to unauthorized access to web applications and sensitive user data.",
|
||||
RuleID: "jwt",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`ey[a-zA-Z0-9]{17,}\.ey[a-zA-Z0-9\/\\_-]{17,}\.(?:[a-zA-Z0-9\/\\_-]{10,}={0,2})?`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"ey"},
|
||||
}
|
||||
|
||||
@@ -72,6 +73,7 @@ func JWTBase64() *config.Rule {
|
||||
Description: "Detected a Base64-encoded JSON Web Token, posing a risk of exposing encoded authentication and data exchange information.",
|
||||
Regex: regexp.MustCompile(
|
||||
`\bZXlK(?:(?P<alg>aGJHY2lPaU)|(?P<apu>aGNIVWlPaU)|(?P<apv>aGNIWWlPaU)|(?P<aud>aGRXUWlPaU)|(?P<b64>aU5qUWlP)|(?P<crit>amNtbDBJanBi)|(?P<cty>amRIa2lPaU)|(?P<epk>bGNHc2lPbn)|(?P<enc>bGJtTWlPaU)|(?P<jku>cWEzVWlPaU)|(?P<jwk>cWQyc2lPb)|(?P<iss>cGMzTWlPaU)|(?P<iv>cGRpSTZJ)|(?P<kid>cmFXUWlP)|(?P<key_ops>clpYbGZiM0J6SWpwY)|(?P<kty>cmRIa2lPaUp)|(?P<nonce>dWIyNWpaU0k2)|(?P<p2c>d01tTWlP)|(?P<p2s>d01uTWlPaU)|(?P<ppt>d2NIUWlPaU)|(?P<sub>emRXSWlPaU)|(?P<svt>emRuUWlP)|(?P<tag>MFlXY2lPaU)|(?P<typ>MGVYQWlPaUp)|(?P<url>MWNtd2l)|(?P<use>MWMyVWlPaUp)|(?P<ver>MlpYSWlPaU)|(?P<version>MlpYSnphVzl1SWpv)|(?P<x>NElqb2)|(?P<x5c>NE5XTWlP)|(?P<x5t>NE5YUWlPaU)|(?P<x5ts256>NE5YUWpVekkxTmlJNkl)|(?P<x5u>NE5YVWlPaU)|(?P<zip>NmFYQWlPaU))[a-zA-Z0-9\/\\_+\-\r\n]{40,}={0,2}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"zxlk"},
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ func KubernetesSecret() *config.Rule {
|
||||
// - valid base64 characters
|
||||
// - longer than 10 characters (no "YmFyCg==")
|
||||
//language=regexp
|
||||
dataPat := `\bdata:(?:.|\s){0,100}?\s+([\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:["']?[a-z0-9]{10,}={0,3}["']?|\{\{[ \t\w"|$:=,.-]+}}|""|''))`
|
||||
dataPat := `\bdata:(?:.|\s){0,100}?\s+([\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:["']?[a-z0-9+/]{10,}={0,3}["']?|\{\{[ \t\w"|$:=,.-]+}}|""|''))`
|
||||
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
@@ -46,6 +46,11 @@ func KubernetesSecret() *config.Rule {
|
||||
|
||||
// validate
|
||||
tps := map[string]string{
|
||||
"base64-characters.yaml": `
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
data:
|
||||
password: AAAAAAAAAAC7hjsA+H3owFygUv4w5B67lcSx14zff9FCPADiNbSwYWgE+O7Dhiy5tkRecs21ljjofvebe6xsYlA4cVmght0=`,
|
||||
"comment.yaml": `
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
|
||||
@@ -11,9 +11,10 @@ import (
|
||||
func LinearAPIToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Linear API Token, posing a risk to project management tools and sensitive task data.",
|
||||
RuleID: "linear-api-key",
|
||||
Description: "Detected a Linear API Token, posing a risk to project management tools and sensitive task data.",
|
||||
Regex: regexp.MustCompile(`lin_api_(?i)[a-z0-9]{40}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"lin_api_"},
|
||||
}
|
||||
|
||||
@@ -27,9 +28,10 @@ func LinearAPIToken() *config.Rule {
|
||||
func LinearClientSecret() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a Linear Client Secret, which may compromise secure integrations and sensitive project management data.",
|
||||
RuleID: "linear-client-secret",
|
||||
Description: "Identified a Linear Client Secret, which may compromise secure integrations and sensitive project management data.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"linear"}, utils.Hex("32"), true),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"linear"},
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ func NPM() *config.Rule {
|
||||
RuleID: "npm-access-token",
|
||||
Description: "Uncovered an npm access token, potentially compromising package management and code repository access.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`npm_[a-z0-9]{36}`, true),
|
||||
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"npm_",
|
||||
},
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
func OctopusDeployApiKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
RuleID: "octopus-deploy-api-key",
|
||||
Description: "Discovered a potential Octopus Deploy API key, risking application deployments and operational security.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`API-[A-Z0-9]{26}`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"api-"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("octopus", secrets.NewSecret(`API-[A-Z0-9]{26}`)),
|
||||
`set apikey="API-ZNRMR7SL6L3ATMOIK7GKJDKLPY"`, // gitleaks:allow
|
||||
}
|
||||
fps := []string{
|
||||
// Invalid start
|
||||
`msgstr "GSSAPI-VIRHEKAPSELOINTIMERKKIJONO."`,
|
||||
`https://sonarcloud.io/api/project_badges/measure?project=Garden-Coin_API-CalculadoraDeInvestimentos&metric=alert_status`,
|
||||
`https://fog-ringer-f42.notion.site/API-BD80F56CDC1441E6BF6011AB6D852875`, // Invalid end
|
||||
`<iframe src="./archive/gifs/api-c99e353f761d318322c853c03e.gif"> </iframe>`, // Wrong case
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -11,9 +11,8 @@ func OktaAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "okta-access-token",
|
||||
Description: "Identified an Okta Access Token, which may compromise identity management services and user authentication data.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"okta"},
|
||||
utils.AlphaNumericExtended("42"), true),
|
||||
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{`(?-i:[Oo]kta|OKTA)`}, `00[\w=\-]{40}`, false),
|
||||
Entropy: 4,
|
||||
Keywords: []string{
|
||||
"okta",
|
||||
},
|
||||
@@ -21,7 +20,15 @@ func OktaAccessToken() *config.Rule {
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("okta", secrets.NewSecret(utils.AlphaNumeric("42"))),
|
||||
utils.GenerateSampleSecret("okta", secrets.NewSecret(`00[\w=\-]{40}`)),
|
||||
`"oktaApiToken": "00ebObu4zSNkyc6dimLvUwq4KpTEop-PCEnnfSTpD3",`, // gitleaks:allow
|
||||
` var OktaApiToken = "00fWkOjwwL9xiFd-Vfgm_ePATIRxVj852Iblbb1DS_";`, // gitleaks:allow
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
`oktaKey = 00000000000000000000000000000000000TUVWXYZ`, // low entropy
|
||||
`rookTable = 0023452Lllk2KqjLBvaxANWEgTd7bqjsxjo8aZj0wd`, // wrong case
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
|
||||
// TODO: Okta client secret?
|
||||
@@ -11,8 +11,8 @@ func OpenAI() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "openai-api-key",
|
||||
Description: "Found an OpenAI API Key, posing a risk of unauthorized access to AI services and data manipulation.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20}`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"T3BlbkFJ",
|
||||
},
|
||||
|
||||
@@ -15,9 +15,8 @@ func OpenshiftUserToken() *config.Rule {
|
||||
RuleID: "openshift-user-token",
|
||||
Description: "Found an OpenShift user token, potentially compromising an OpenShift/Kubernetes cluster.",
|
||||
// TODO: Do tokens vary in length or are they always 43?
|
||||
Regex: regexp.MustCompile(`\b(sha256~[\w-]{43})(?:[^\w-]|\z)`),
|
||||
Entropy: 3.5,
|
||||
SecretGroup: 0,
|
||||
Regex: regexp.MustCompile(`\b(sha256~[\w-]{43})(?:[^\w-]|\z)`),
|
||||
Entropy: 3.5,
|
||||
Keywords: []string{
|
||||
"sha256~",
|
||||
},
|
||||
|
||||
@@ -11,8 +11,8 @@ func PlanetScalePassword() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "planetscale-password",
|
||||
Description: "Discovered a PlanetScale password, which could lead to unauthorized database operations and data breaches.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pscale_pw_(?i)[a-z0-9=\-_\.]{32,64}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pscale_pw_(?i)[\w=\.-]{32,64}`, true),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"pscale_pw_",
|
||||
},
|
||||
@@ -32,8 +32,8 @@ func PlanetScaleAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "planetscale-api-token",
|
||||
Description: "Identified a PlanetScale API token, potentially compromising database management and operations.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pscale_tkn_(?i)[a-z0-9=\-_\.]{32,64}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pscale_tkn_(?i)[\w=\.-]{32,64}`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"pscale_tkn_",
|
||||
},
|
||||
@@ -53,8 +53,8 @@ func PlanetScaleOAuthToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "planetscale-oauth-token",
|
||||
Description: "Found a PlanetScale OAuth token, posing a risk to database access control and sensitive data integrity.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pscale_oauth_(?i)[a-z0-9=\-_\.]{32,64}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pscale_oauth_[\w=\.-]{32,64}`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"pscale_oauth_",
|
||||
},
|
||||
|
||||
@@ -11,8 +11,8 @@ func PostManAPI() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "postman-api-token",
|
||||
Description: "Uncovered a Postman API token, potentially compromising API testing and development workflows.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"PMAK-",
|
||||
},
|
||||
|
||||
@@ -11,8 +11,8 @@ func Prefect() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "prefect-api-token",
|
||||
Description: "Detected a Prefect API token, risking unauthorized access to workflow management and automation services.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pnu_[a-z0-9]{36}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pnu_[a-zA-Z0-9]{36}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"pnu_",
|
||||
},
|
||||
@@ -22,5 +22,8 @@ func Prefect() *config.Rule {
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("api-token", "pnu_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
`PREFECT_API_KEY = "pnu_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -11,8 +11,8 @@ func PulumiAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "pulumi-api-token",
|
||||
Description: "Found a Pulumi API token, posing a risk to infrastructure as code services and cloud resource management.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pul-[a-f0-9]{40}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pul-[a-f0-9]{40}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"pul-",
|
||||
},
|
||||
@@ -22,5 +22,8 @@ func PulumiAPIToken() *config.Rule {
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("pulumi-api-token", "pul-"+secrets.NewSecret(utils.Hex("40"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
` <img src="./assets/vipul-f0eb1acf0da84c06a50c5b2c59932001997786b176dec02bd16128ee9ea83628.png" alt="" class="w-16 h-16 rounded-full">`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -13,8 +13,8 @@ func PyPiUploadToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discovered a PyPI upload token, potentially compromising Python package distribution and repository integrity.",
|
||||
RuleID: "pypi-upload-token",
|
||||
Regex: regexp.MustCompile(
|
||||
`pypi-AgEIcHlwaS5vcmc[A-Za-z0-9\-_]{50,1000}`),
|
||||
Regex: regexp.MustCompile(`pypi-AgEIcHlwaS5vcmc[\w-]{50,1000}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"pypi-AgEIcHlwaS5vcmc",
|
||||
},
|
||||
|
||||
@@ -11,8 +11,8 @@ func ReadMe() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "readme-api-token",
|
||||
Description: "Detected a Readme API token, risking unauthorized documentation management and content exposure.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`rdme_[a-z0-9]{70}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`rdme_[a-z0-9]{70}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"rdme_",
|
||||
},
|
||||
@@ -22,5 +22,8 @@ func ReadMe() *config.Rule {
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("api-token", "rdme_"+secrets.NewSecret(utils.AlphaNumeric("70"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
`const API_KEY = 'rdme_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -11,8 +11,8 @@ func RubyGemsAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "rubygems-api-token",
|
||||
Description: "Identified a Rubygem API token, potentially compromising Ruby library distribution and package management.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`rubygems_[a-f0-9]{48}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`rubygems_[a-f0-9]{48}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"rubygems_",
|
||||
},
|
||||
|
||||
@@ -11,7 +11,8 @@ func ScalingoAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Found a Scalingo API token, posing a risk to cloud platform services and application deployment security.",
|
||||
RuleID: "scalingo-api-token",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`tk-us-[a-zA-Z0-9-_]{48}`, false),
|
||||
Regex: utils.GenerateUniqueTokenRegex(`tk-us-[\w-]{48}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"tk-us-"},
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ func SendGridAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "sendgrid-api-token",
|
||||
Description: "Detected a SendGrid API token, posing a risk of unauthorized email service operations and data exposure.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`SG\.(?i)[a-z0-9=_\-\.]{66}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`SG\.(?i)[a-z0-9=_\-\.]{66}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"SG.",
|
||||
},
|
||||
|
||||
@@ -11,8 +11,8 @@ func SendInBlueAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "sendinblue-api-token",
|
||||
Description: "Identified a Sendinblue API token, which may compromise email marketing services and subscriber data privacy.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"xkeysib-",
|
||||
},
|
||||
|
||||
@@ -11,8 +11,8 @@ func ShippoAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "shippo-api-token",
|
||||
Description: "Discovered a Shippo API token, potentially compromising shipping services and customer order data.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`shippo_(live|test)_[a-f0-9]{40}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`shippo_(?:live|test)_[a-fA-F0-9]{40}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"shippo_",
|
||||
},
|
||||
|
||||
@@ -11,9 +11,10 @@ import (
|
||||
func ShopifySharedSecret() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Found a Shopify shared secret, posing a risk to application authentication and e-commerce platform security.",
|
||||
RuleID: "shopify-shared-secret",
|
||||
Description: "Found a Shopify shared secret, posing a risk to application authentication and e-commerce platform security.",
|
||||
Regex: regexp.MustCompile(`shpss_[a-fA-F0-9]{32}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"shpss_"},
|
||||
}
|
||||
|
||||
@@ -25,9 +26,10 @@ func ShopifySharedSecret() *config.Rule {
|
||||
func ShopifyAccessToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a Shopify access token, which could lead to unauthorized e-commerce platform access and data breaches.",
|
||||
RuleID: "shopify-access-token",
|
||||
Description: "Uncovered a Shopify access token, which could lead to unauthorized e-commerce platform access and data breaches.",
|
||||
Regex: regexp.MustCompile(`shpat_[a-fA-F0-9]{32}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"shpat_"},
|
||||
}
|
||||
|
||||
@@ -39,9 +41,10 @@ func ShopifyAccessToken() *config.Rule {
|
||||
func ShopifyCustomAccessToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Shopify custom access token, potentially compromising custom app integrations and e-commerce data security.",
|
||||
RuleID: "shopify-custom-access-token",
|
||||
Description: "Detected a Shopify custom access token, potentially compromising custom app integrations and e-commerce data security.",
|
||||
Regex: regexp.MustCompile(`shpca_[a-fA-F0-9]{32}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"shpca_"},
|
||||
}
|
||||
|
||||
@@ -53,9 +56,10 @@ func ShopifyCustomAccessToken() *config.Rule {
|
||||
func ShopifyPrivateAppAccessToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a Shopify private app access token, risking unauthorized access to private app data and store operations.",
|
||||
RuleID: "shopify-private-app-access-token",
|
||||
Description: "Identified a Shopify private app access token, risking unauthorized access to private app data and store operations.",
|
||||
Regex: regexp.MustCompile(`shppa_[a-fA-F0-9]{32}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"shppa_"},
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ import (
|
||||
func SlackBotToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a Slack Bot token, which may compromise bot integrations and communication channel security.",
|
||||
RuleID: "slack-bot-token",
|
||||
Regex: regexp.MustCompile(
|
||||
`(xoxb-[0-9]{10,13}\-[0-9]{10,13}[a-zA-Z0-9-]*)`),
|
||||
Description: "Identified a Slack Bot token, which may compromise bot integrations and communication channel security.",
|
||||
Regex: regexp.MustCompile(`xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"xoxb",
|
||||
},
|
||||
@@ -44,10 +44,11 @@ func SlackBotToken() *config.Rule {
|
||||
func SlackUserToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Found a Slack User token, posing a risk of unauthorized user impersonation and data access within Slack workspaces.",
|
||||
RuleID: "slack-user-token",
|
||||
Description: "Found a Slack User token, posing a risk of unauthorized user impersonation and data access within Slack workspaces.",
|
||||
// The last segment seems to be consistently 32 characters. I've made it 28-34 just in case.
|
||||
Regex: regexp.MustCompile(`xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"xoxp-", "xoxe-"},
|
||||
}
|
||||
|
||||
@@ -82,10 +83,11 @@ func SlackUserToken() *config.Rule {
|
||||
func SlackAppLevelToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Slack App-level token, risking unauthorized access to Slack applications and workspace data.",
|
||||
RuleID: "slack-app-token",
|
||||
Description: "Detected a Slack App-level token, risking unauthorized access to Slack applications and workspace data.",
|
||||
// This regex is based on a limited number of examples and may not be 100% accurate.
|
||||
Regex: regexp.MustCompile(`(?i)xapp-\d-[A-Z0-9]+-\d+-[a-z0-9]+`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"xapp"},
|
||||
}
|
||||
|
||||
@@ -103,9 +105,10 @@ func SlackAppLevelToken() *config.Rule {
|
||||
func SlackConfigurationToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Found a Slack Configuration access token, posing a risk to workspace configuration and sensitive data access.",
|
||||
RuleID: "slack-config-access-token",
|
||||
Description: "Found a Slack Configuration access token, posing a risk to workspace configuration and sensitive data access.",
|
||||
Regex: regexp.MustCompile(`(?i)xoxe.xox[bp]-\d-[A-Z0-9]{163,166}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"xoxe.xoxb-", "xoxe.xoxp-"},
|
||||
}
|
||||
|
||||
@@ -128,9 +131,10 @@ func SlackConfigurationToken() *config.Rule {
|
||||
func SlackConfigurationRefreshToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Slack Configuration refresh token, potentially allowing prolonged unauthorized access to configuration settings.",
|
||||
RuleID: "slack-config-refresh-token",
|
||||
Description: "Discovered a Slack Configuration refresh token, potentially allowing prolonged unauthorized access to configuration settings.",
|
||||
Regex: regexp.MustCompile(`(?i)xoxe-\d-[A-Z0-9]{146}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"xoxe-"},
|
||||
}
|
||||
|
||||
@@ -146,11 +150,11 @@ func SlackConfigurationRefreshToken() *config.Rule {
|
||||
// Reference: https://api.slack.com/authentication/token-types#legacy_bot
|
||||
func SlackLegacyBotToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a Slack Legacy bot token, which could lead to compromised legacy bot operations and data exposure.",
|
||||
RuleID: "slack-legacy-bot-token",
|
||||
Description: "Uncovered a Slack Legacy bot token, which could lead to compromised legacy bot operations and data exposure.",
|
||||
// This rule is based off the limited information I could find and may not be 100% accurate.
|
||||
Regex: regexp.MustCompile(
|
||||
`(xoxb-[0-9]{8,14}\-[a-zA-Z0-9]{18,26})`),
|
||||
Regex: regexp.MustCompile(`xoxb-[0-9]{8,14}-[a-zA-Z0-9]{18,26}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"xoxb",
|
||||
},
|
||||
@@ -189,11 +193,11 @@ func SlackLegacyBotToken() *config.Rule {
|
||||
// Reference: https://api.slack.com/authentication/token-types#workspace
|
||||
func SlackLegacyWorkspaceToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a Slack Legacy Workspace token, potentially compromising access to workspace data and legacy features.",
|
||||
RuleID: "slack-legacy-workspace-token",
|
||||
Description: "Identified a Slack Legacy Workspace token, potentially compromising access to workspace data and legacy features.",
|
||||
// This is by far the least confident pattern.
|
||||
Regex: regexp.MustCompile(
|
||||
`(xox[ar]-(?:\d-)?[0-9a-zA-Z]{8,48})`),
|
||||
Regex: regexp.MustCompile(`xox[ar]-(?:\d-)?[0-9a-zA-Z]{8,48}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"xoxa",
|
||||
"xoxr",
|
||||
@@ -224,9 +228,10 @@ func SlackLegacyWorkspaceToken() *config.Rule {
|
||||
func SlackLegacyToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Slack Legacy token, risking unauthorized access to older Slack integrations and user data.",
|
||||
RuleID: "slack-legacy-token",
|
||||
Description: "Detected a Slack Legacy token, risking unauthorized access to older Slack integrations and user data.",
|
||||
Regex: regexp.MustCompile(`xox[os]-\d+-\d+-\d+-[a-fA-F\d]+`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"xoxo", "xoxs"},
|
||||
}
|
||||
|
||||
@@ -255,11 +260,11 @@ func SlackLegacyToken() *config.Rule {
|
||||
func SlackWebHookUrl() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Slack Webhook, which could lead to unauthorized message posting and data leakage in Slack channels.",
|
||||
RuleID: "slack-webhook-url",
|
||||
Description: "Discovered a Slack Webhook, which could lead to unauthorized message posting and data leakage in Slack channels.",
|
||||
// If this generates too many false-positives we should define an allowlist (e.g., "xxxx", "00000").
|
||||
Regex: regexp.MustCompile(
|
||||
`(https?:\/\/)?hooks.slack.com\/(services|workflows)\/[A-Za-z0-9+\/]{43,46}`),
|
||||
`(?:https?://)?hooks.slack.com/(?:services|workflows)/[A-Za-z0-9+/]{43,46}`),
|
||||
Keywords: []string{
|
||||
"hooks.slack.com",
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@ func SquareAccessToken() *config.Rule {
|
||||
RuleID: "square-access-token",
|
||||
Description: "Detected a Square Access Token, risking unauthorized payment processing and financial transaction exposure.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(?:EAAA|sq0atp-)[\w-]{22,60}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"sq0atp-", "EAAA"},
|
||||
}
|
||||
|
||||
@@ -33,6 +34,7 @@ func SquareSecret() *config.Rule {
|
||||
RuleID: "square-secret",
|
||||
Description: "Square Secret",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`sq0csp-[\w-]{43}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"sq0csp-"},
|
||||
}
|
||||
|
||||
|
||||
@@ -638,6 +638,7 @@ var DefaultStopWords = []string{
|
||||
"jbos",
|
||||
"jekyll",
|
||||
"jenkin",
|
||||
"jetbrains",
|
||||
"job-",
|
||||
"job.",
|
||||
"job_",
|
||||
@@ -1181,6 +1182,7 @@ var DefaultStopWords = []string{
|
||||
"smart",
|
||||
"smtp",
|
||||
"snake",
|
||||
"snapshot",
|
||||
"snippet",
|
||||
"soap",
|
||||
"social",
|
||||
|
||||
@@ -9,9 +9,10 @@ import (
|
||||
func StripeAccessToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Found a Stripe Access Token, posing a risk to payment processing services and sensitive financial data.",
|
||||
RuleID: "stripe-access-token",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(sk|rk)_(test|live|prod)_[0-9a-z]{10,99}`, true),
|
||||
Description: "Found a Stripe Access Token, posing a risk to payment processing services and sensitive financial data.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"sk_test",
|
||||
"sk_live",
|
||||
|
||||
@@ -2,8 +2,6 @@ package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
@@ -14,19 +12,11 @@ func SumoLogicAccessID() *config.Rule {
|
||||
RuleID: "sumologic-access-id",
|
||||
Description: "Discovered a SumoLogic Access ID, potentially compromising log management services and data analytics integrity.",
|
||||
// TODO: Make 'su' case-sensitive.
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"sumo"},
|
||||
"su[a-zA-Z0-9]{12}", false),
|
||||
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"(?-i:[Ss]umo|SUMO)"}, "su[a-zA-Z0-9]{12}", false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"sumo",
|
||||
},
|
||||
Allowlists: []config.Allowlist{
|
||||
{
|
||||
RegexTarget: "line",
|
||||
Regexes: []*regexp.Regexp{regexp.MustCompile(`sumOf`)},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -47,6 +37,7 @@ func SumoLogicAccessID() *config.Rule {
|
||||
`sumologic_access_id = ""`,
|
||||
`SUMOLOGIC_ACCESSID: ${SUMOLOGIC_ACCESSID}`,
|
||||
`export SUMOLOGIC_ACCESSID=XXXXXXXXXXXXXX`, // gitleaks:allow
|
||||
`sumObj = suGyI5imvADdvU`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -56,10 +47,8 @@ func SumoLogicAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "sumologic-access-token",
|
||||
Description: "Uncovered a SumoLogic Access Token, which could lead to unauthorized access to log data and analytics insights.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"sumo"},
|
||||
utils.AlphaNumeric("64"), true),
|
||||
|
||||
Entropy: 3,
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"(?-i:[Ss]umo|SUMO)"}, utils.AlphaNumeric("64"), true),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"sumo",
|
||||
},
|
||||
@@ -80,6 +69,7 @@ func SumoLogicAccessToken() *config.Rule {
|
||||
`SUMO_ACCESS_KEY=${SUMO_ACCESS_KEY:=$2}`,
|
||||
`sumo_access_key = "<SUMOLOGIC ACCESS KEY>"`,
|
||||
`SUMO_ACCESS_KEY: AbCeFG123`,
|
||||
`sumOfExposures = 3Kof2VffNQ0QgYIhXUPJosVlCaQKm2hfpWE6F1fT9YGY74blQBIPsrkCcf1TwKE5;`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
func TeamsWebhook() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a Microsoft Teams Webhook, which could lead to unauthorized access to team collaboration tools and data leaks.",
|
||||
RuleID: "microsoft-teams-webhook",
|
||||
Description: "Uncovered a Microsoft Teams Webhook, which could lead to unauthorized access to team collaboration tools and data leaks.",
|
||||
Regex: regexp.MustCompile(
|
||||
`https:\/\/[a-z0-9]+\.webhook\.office\.com\/webhookb2\/[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}@[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}\/IncomingWebhook\/[a-z0-9]{32}\/[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}`),
|
||||
`https://[a-z0-9]+\.webhook\.office\.com/webhookb2/[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}@[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}/IncomingWebhook/[a-z0-9]{32}/[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}`),
|
||||
Keywords: []string{
|
||||
"webhook.office.com",
|
||||
"webhookb2",
|
||||
|
||||
@@ -11,10 +11,11 @@ import (
|
||||
func Twilio() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Found a Twilio API Key, posing a risk to communication services and sensitive customer interaction data.",
|
||||
RuleID: "twilio-api-key",
|
||||
Description: "Found a Twilio API Key, posing a risk to communication services and sensitive customer interaction data.",
|
||||
Regex: regexp.MustCompile(`SK[0-9a-fA-F]{32}`),
|
||||
Keywords: []string{"twilio"},
|
||||
Entropy: 3,
|
||||
Keywords: []string{"SK"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -15,10 +15,10 @@ const (
|
||||
caseInsensitive = `(?i)`
|
||||
|
||||
// identifier prefix (just an ignore group)
|
||||
identifierCaseInsensitivePrefix = `(?i:`
|
||||
identifierCaseInsensitivePrefix = `[\w.-]{0,10}?(?i:`
|
||||
identifierCaseInsensitiveSuffix = `)`
|
||||
identifierPrefix = `(?:`
|
||||
identifierSuffix = `)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}`
|
||||
identifierPrefix = `[\w.-]{0,10}?(?:`
|
||||
identifierSuffix = `)(?:[ \t\w.-]{0,20})(?:[\s|']|[\s|"]){0,3}`
|
||||
|
||||
// commonly used assignment operators or function call
|
||||
operator = `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)`
|
||||
|
||||
@@ -4,6 +4,8 @@ import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/exp/maps"
|
||||
)
|
||||
|
||||
type AllowlistMatchCondition int
|
||||
@@ -95,5 +97,22 @@ func (a *Allowlist) Validate() error {
|
||||
return fmt.Errorf("[[rules.allowlists]] must contain at least one check for: commits, paths, regexes, or stopwords")
|
||||
}
|
||||
|
||||
// Deduplicate commits and stopwords.
|
||||
if len(a.Commits) > 0 {
|
||||
uniqueCommits := make(map[string]struct{})
|
||||
for _, commit := range a.Commits {
|
||||
uniqueCommits[commit] = struct{}{}
|
||||
}
|
||||
a.Commits = maps.Keys(uniqueCommits)
|
||||
}
|
||||
|
||||
if len(a.StopWords) > 0 {
|
||||
uniqueStopwords := make(map[string]struct{})
|
||||
for _, stopWord := range a.StopWords {
|
||||
uniqueStopwords[stopWord] = struct{}{}
|
||||
}
|
||||
a.StopWords = maps.Keys(uniqueStopwords)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -91,3 +94,62 @@ func TestPathAllowed(t *testing.T) {
|
||||
assert.Equal(t, tt.pathAllowed, tt.allowlist.PathAllowed(tt.path))
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidate(t *testing.T) {
|
||||
tests := map[string]struct {
|
||||
input Allowlist
|
||||
expected Allowlist
|
||||
wantErr error
|
||||
}{
|
||||
"empty conditions": {
|
||||
input: Allowlist{},
|
||||
wantErr: errors.New("[[rules.allowlists]] must contain at least one check for: commits, paths, regexes, or stopwords"),
|
||||
},
|
||||
"deduplicated commits and stopwords": {
|
||||
input: Allowlist{
|
||||
Commits: []string{"commitA", "commitB", "commitA"},
|
||||
StopWords: []string{"stopwordA", "stopwordB", "stopwordA"},
|
||||
},
|
||||
expected: Allowlist{
|
||||
Commits: []string{"commitA", "commitB"},
|
||||
StopWords: []string{"stopwordA", "stopwordB"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
// Expected an error.
|
||||
err := tt.input.Validate()
|
||||
if err != nil {
|
||||
if tt.wantErr == nil {
|
||||
t.Fatalf("Received unexpected error: %v", err)
|
||||
} else if !assert.EqualError(t, err, tt.wantErr.Error()) {
|
||||
t.Fatalf("Received unexpected error, expected '%v', got '%v'", tt.wantErr, err)
|
||||
}
|
||||
} else {
|
||||
if tt.wantErr != nil {
|
||||
t.Fatalf("Did not receive expected error: %v", tt.wantErr)
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
regexComparer = func(x, y *regexp.Regexp) bool {
|
||||
// Compare the string representation of the regex patterns.
|
||||
if x == nil || y == nil {
|
||||
return x == y
|
||||
}
|
||||
return x.String() == y.String()
|
||||
}
|
||||
arrayComparer = func(a, b string) bool {
|
||||
return a < b
|
||||
}
|
||||
opts = cmp.Options{
|
||||
cmp.Comparer(regexComparer),
|
||||
cmpopts.SortSlices(arrayComparer),
|
||||
}
|
||||
)
|
||||
if diff := cmp.Diff(tt.input, tt.expected, opts); diff != "" {
|
||||
t.Errorf("diff: (-want +got)\n%s", diff)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -381,7 +381,6 @@ func TestTranslate(t *testing.T) {
|
||||
}
|
||||
|
||||
var regexComparer = func(x, y *regexp.Regexp) bool {
|
||||
// Compare the string representation of the regex patterns.
|
||||
if x == nil || y == nil {
|
||||
return x == y
|
||||
}
|
||||
|
||||
+345
-161
File diff suppressed because it is too large.
Load diff
+9
-7
@@ -13,10 +13,10 @@ import (
|
||||
|
||||
func (d *Detector) DetectFiles(paths <-chan sources.ScanTarget) ([]report.Finding, error) {
|
||||
for pa := range paths {
|
||||
p := pa
|
||||
d.Sema.Go(func() error {
|
||||
|
||||
f, err := os.Open(p.Path)
|
||||
logger := log.With().Str("path", pa.Path).Logger()
|
||||
log.Trace().Msgf("Scanning path: %s", pa)
|
||||
f, err := os.Open(pa.Path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -31,7 +31,9 @@ func (d *Detector) DetectFiles(paths <-chan sources.ScanTarget) ([]report.Findin
|
||||
if d.MaxTargetMegaBytes > 0 {
|
||||
rawLength := fileSize / 1000000
|
||||
if rawLength > int64(d.MaxTargetMegaBytes) {
|
||||
log.Debug().Msgf("skipping file: %s scan due to size: %d", p.Path, rawLength)
|
||||
logger.Debug().
|
||||
Int64("size", rawLength).
|
||||
Msgf("Skipping file: exceeds --max-target-megabytes")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -62,10 +64,10 @@ func (d *Detector) DetectFiles(paths <-chan sources.ScanTarget) ([]report.Findin
|
||||
totalLines += linesInChunk
|
||||
fragment := Fragment{
|
||||
Raw: string(buf[:n]),
|
||||
FilePath: p.Path,
|
||||
FilePath: pa.Path,
|
||||
}
|
||||
if p.Symlink != "" {
|
||||
fragment.SymlinkFile = p.Symlink
|
||||
if pa.Symlink != "" {
|
||||
fragment.SymlinkFile = pa.Symlink
|
||||
}
|
||||
for _, finding := range d.Detect(fragment) {
|
||||
// need to add 1 since line counting starts at 1
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
const secret = "AKIAIRYLJVKMPEXAMPLE"
|
||||
const secret = "AKIAIRYLJVKMPEGZMPJS"
|
||||
|
||||
type mockReader struct {
|
||||
data []byte
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package sources
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog/log"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/fatih/semgroup"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
type ScanTarget struct {
|
||||
@@ -35,7 +35,12 @@ func DirectoryTargets(source string, s *semgroup.Group, followSymlinks bool) (<-
|
||||
Symlink: "",
|
||||
}
|
||||
}
|
||||
if fInfo.Mode().Type() == fs.ModeSymlink && followSymlinks {
|
||||
if fInfo.Mode().Type() == fs.ModeSymlink {
|
||||
if !followSymlinks {
|
||||
log.Debug().Str("path", path).Msg("Skipping symlink")
|
||||
return nil
|
||||
}
|
||||
|
||||
realPath, err := filepath.EvalSymlinks(path)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user