Compare commits

...
524 Commits
Author SHA1 Message Date
Richard Gomez 128cd22f7c fix(rule): comment out errant validation case (#1509)
This should be re-enabled once a more suitable fix is implemented.
2024-09-16 06:17:26 -05:00
Zachary Rice 1a6d2b0a7a remove validate config test temporarily 2024-09-14 05:49:13 -05:00
Zachary Rice 0874ebcc3f Update README.md 2024-09-14 05:46:28 -05:00
Zachary Rice 9463ffaa5e fix flag access (#1506) 2024-09-14 04:01:27 -05:00
Zachary Rice 44ad62e0b1 Deprecate detect and protect. Add git, dir, stdin (#1504)
* init backwards compatible cmd

* update readme, todos

* ...

* moar comments, sprucing up root

* readme change
2024-09-13 19:44:22 -05:00
Dewan Ishtiaque Ahmed e93a7c0d26 Update Harness rules to add _ and - in the account ID part. (#1503) 2024-09-11 19:48:12 -05:00
Richard Gomez 4e43d11093 chore: fix gl workflow error (#1487) 2024-08-26 17:47:02 -05:00
Richard Gomez bd81872eee Make config generation utils public (#1480)
* chore(generate): make utils public

* chore(generate): change validate log messages

* chore(generate): split functions into files

* chore(config): add warning for public funcs
2024-08-26 13:11:18 -05:00
Richard Gomez 3be7faa1ff Update Hashicorp Vault token pattern (#1483)
* feat(vault): add old pat, tweak new pat

* feat(hashicorp): add entropy to tf rule
2024-08-25 15:19:37 -05:00
Richard Gomez 1aae66d564 feat(config): update rule validation (#1466) 2024-08-22 09:55:44 -05:00
Zachary Rice 6dfcf5e949 Update .gitleaksignore 2024-08-20 06:57:30 -05:00
Richard Gomez f361c5ef71 fix(detect): handle EOF with bytes (#1472) 2024-08-19 14:00:47 -05:00
malmor 8a1ca9ecc9 Added poetry.lock to default allowlist paths (#1474) 2024-08-19 11:47:42 -05:00
Richard Gomez 525c4b4451 refactor(sarif): remove |name| and change |shortDescription| (#1473) 2024-08-19 09:11:31 -05:00
Richard Gomez c0fda4358e Use rule id for config validation error (#1463)
* chore(config): use rule id for error

* feat(config): ensure rule.id is not empty
2024-08-08 15:47:34 -05:00
Richard Gomez d3c4b9078e Use first non-empty group if secretGroup isn't set (#1459)
* feat(detect): secret is first non-empty group

* test: fix errors

- update capture groups
- update expected data
2024-08-07 12:10:05 -05:00
Richard Gomez b4009bfba4 chore: remove unnecessary capture groups (#1460) 2024-08-07 12:09:16 -05:00
Richard Gomez 80bd1779e3 Return non-0 exit code from DetectGit (#1461)
* fix(detect): exit code for git errors

* chore(detect): add consistent error msgs
2024-08-07 10:14:00 -05:00
niklas-w7andniklas.w 0334ec1076 add gradle verification-metadata.xml to global allowlist (#1446)
Co-authored-by: niklas.w <niklas.wissmueller@ext.ibmix.de>
2024-08-05 20:35:54 -05:00
Richard Gomez c1345e1b2b feat(openshift): add user token (#1449) 2024-08-05 20:22:31 -05:00
LeonandZach 7697b3e989 (feat): Adding secret detection rule for Kubernetes secrets (#1454)
* (feat): Adding secret detection rule for Kubernetes secrets

Signed-off-by: localleon <me@lrau.xyz>

* (fix): Limiting kubernetes secret detection only to .yaml/.yml files

Signed-off-by: localleon <me@lrau.xyz>

* (fix): Fixing path validation testing for kubernetes-secret

Signed-off-by: localleon <me@lrau.xyz>

* (fix): refactoring path validation regex for kubernetes secret

* (fix): fixing keyword for kubernetes secret

Signed-off-by: localleon <me@lrau.xyz>

* (fix): fixing config.toml for kubernetes-secret and reording rules/main.go

Signed-off-by: localleon <me@lrau.xyz>

* (feat): Implementing proxmitiy matching for data-key in kubernetes secrets

Signed-off-by: localleon <me@lrau.xyz>

* (fix): Adding regex sugestions for quoted strings and qouted test-cases

* (fix): Updating kubernetes-secret regex to allow '-character before secret e.g if theres quoting

* limit whitespace

---------

Signed-off-by: localleon <me@lrau.xyz>
Co-authored-by: Zach <zricer@protonmail.com>
2024-08-05 20:20:52 -05:00
Zachary Rice 26f34692fa add version to default 2024-06-14 16:48:12 -04:00
AislingHPE bc979deb0f Add go.work and go.work.sum to global allowlist (#1353) 2024-06-14 15:31:04 -04:00
Dewan Ishtiaque AhmedandZachary Rice b899915813 Add harness PAT and SAT rules (#1406)
* Add Harness PAT rule.

* Add support for Harness PAT and SAT.

* Update comment for Harness SAT.

* Consolidate PAT and SAT into Harness API Key

* add ignore and capture group to match

---------

Co-authored-by: Zachary Rice <zachary.rice@trufflesec.com>
2024-06-14 15:30:07 -04:00
Zachary Rice 4c5195b700 Update README.md 2024-06-14 15:22:23 -04:00
becojoandBecojo 02808f45d0 Limit hashicorp-tf-password to .tf/.hcl files (#1420)
* Limit hashicorp-tf-password to .tf/.hcl files

* fix tests

---------

Co-authored-by: Becojo <Becojo@users.noreply.github.com>
2024-06-13 11:23:26 -04:00
Zachary Rice 07e1c30592 rm print 2024-06-13 11:14:44 -04:00
Zachary Rice db63fc1bf4 reduce telegram... todo url and xml for later 2024-06-13 11:14:02 -04:00
Zachary Rice 9a4538c4d6 coderabbit.ai <3 2024-06-13 09:16:17 -04:00
danielap-ma fe94ef9ca3 Add NewRelic insert key detection (#1417) 2024-06-02 18:18:52 -05:00
Toxandtoxyl bb4424d454 Improved Telegram bot token rule regex and added more test cases (#1404)
Co-authored-by: toxyl <tox@novasonica.com>
2024-06-01 18:56:14 -05:00
Alexandre GUIOT--VALENTIN 575e923cf8 Add intra42 client secret (#1408)
intra42 is the intranet and API of "42 School", a CS school.
The API is open to all students in 57 campus around the world.
It is thus often subject to credentials leaks on GitHub
See https://42.fr and https://api.intra.42.fr/
2024-06-01 18:55:04 -05:00
shahar4200 39947b0b0d extend FB access token discovery (#1407)
* extend FB access token discovery

* validate config

* set upper 40

* set upper 40
2024-05-31 15:51:43 -05:00
Baruch Odem (Rothkoff)andBaruch Odem 79cac73f72 tests: scalingo validation consistent test (#1359)
* Refactor Scalingo API token regex and add sample token

* improve docs for allowlist

I didn't know it when I made #1358

---------

Co-authored-by: Baruch Odem <baruch.odem@checkmarx.com>
2024-04-29 13:46:16 -05:00
Baruch Odem (Rothkoff)andBaruch Odem 247f423a39 add real (test) standard and restricted keys (#1375)
Co-authored-by: Baruch Odem <baruch.odem@checkmarx.com>
2024-04-29 13:45:32 -05:00
Baruch Odem (Rothkoff)andBaruch Odem 821b232394 Add Cloudflare API and Origin CA keys (#1374)
* add real heroku example

* Add Cloudflare API and Origin CA keys

---------

Co-authored-by: Baruch Odem <baruch.odem@checkmarx.com>
2024-04-29 13:44:19 -05:00
Katrin Leinweber 57ac4b3dc7 Update "contributing guidelines" link (#1390) 2024-04-15 09:13:43 -05:00
Baruch Odem (Rothkoff) db69e8266e add update token from square (#1370) 2024-03-22 13:31:09 -05:00
Baruch Odem (Rothkoff) 4b543280a1 feat: facebook secret, access token, and page access token rules (#1372)
* Add Facebook secret, access token, and page access token rules

* comment
2024-03-22 13:30:42 -05:00
Baruch Odem (Rothkoff) 979f213b93 update mailchimp with new tokens (#1376) 2024-03-22 13:29:59 -05:00
Jarek Porzucek 59c0cc7183 Append ordered rules when extending (#1304) 2024-03-22 11:21:26 -05:00
Baruch Odem (Rothkoff) 6c52f878cc fix: age rule id with dashes (#1349) 2024-02-19 09:26:41 -06:00
dutchhaag 247a5e7214 patching golang.org/x/text for CVE-2021-38561 and CVE-2022-32149 (#1342) 2024-02-15 11:54:47 -06:00
anotherbridge 8d23afd45d Use latest base images. (#1334)
* Use latest images.

* Fix version
2024-02-02 11:29:44 -06:00
João Filipe Silva ac4b5146b0 removed gitleaks user from Dockerfile (#1313) 2024-02-01 08:23:13 -06:00
Kieran Smith 76c9e3175b Remove IAM identifiers for non-credential resources in the aws-access-token rule (#1307)
* Remove IAM identifiers for non-credential resources

Only detects: 
AWS STS service bearer token
Context-specific credential
Access key
Temporary (AWS STS) access key IDs use this prefix, but are unique only in combination with the secret access key and the session token.

* Update gitleaks.toml

* Update testdata

* Update tests
2024-01-31 13:21:53 -06:00
afe046b3b4 Update stripe rule to not alert on publishable keys (#1320)
* Update stripe rule to not alert on publishable keys

* run go gen

---------

Co-authored-by: Erin Browning <ebrowning@makenotion.com>
Co-authored-by: Zachary Rice <zachary.rice@trufflesec.com>
2024-01-31 13:13:04 -06:00
eyalatox 8b8920d4c3 --max-target-megabytes flag now supported for --no-git flag as well (#1330) 2024-01-24 16:08:05 -06:00
Christian Groschupp a59289ca9b add pre-commit hook gitleaks-system (#1225) 2024-01-10 13:09:00 -06:00
Zachary Rice 870194be13 fix errors when using protect and an external git diff tool (#1318) 2023-12-23 15:52:41 -06:00
Zachary Rice 179c607541 rename filesystem to directory (#1317) 2023-12-22 11:08:00 -06:00
Liron Biam 8de8938ad4 Enhance Secret Descriptions (#1300)
* Enhance secret descriptions in gitleaks.toml

* adjust the rule configuration descriptions

* missing spaces in gitleaks.toml
2023-11-29 17:03:11 -06:00
Zachary Rice ca7aa14542 Small refactor detect and sources (#1297) 2023-11-22 10:37:29 -06:00
Oleksandr Redko 01e60c81e6 chore(config): refactor to go generate; simplify configRules init (#1295) 2023-11-21 19:52:50 -06:00
Zach 54f5f04a1f forgot symlinks 2023-11-19 11:32:10 -06:00
Zachary Rice 221d5c40e7 pretty apparent 'protect' and 'detect' should be merged into one command (#1294) 2023-11-19 11:21:40 -06:00
128b50f67b style: sort the stopwords (#1289)
* style: sort the stopwords

* run cmd

---------

Co-authored-by: Nick Nungester <nick.nungester@acaglobal.com>
Co-authored-by: Zach <zricer@protonmail.com>
2023-11-18 12:28:17 -06:00
Zachary Rice dab7d0292a dont crash on 100gb files pls (#1292) 2023-11-17 14:56:02 -06:00
Zachary Rice e63b657bcf remove secretgroup from default config (#1288)
* remove secretgroup from default config

* update test data and AWS

* leave secretgroup
2023-11-10 12:53:07 -06:00
Baruch Odem (Rothkoff) 20fcf5009f feat: Hashicorp Terraform fields for password (#1237)
* Hashicorp Terraform fields for password
Fixes #1236

* fix duplicate description

* set caseInsensitive
2023-11-09 14:31:16 -06:00
Eng Zer Jun b49667786e perf: avoid allocations with (*regexp.Regexp).MatchString (#1283)
We should use `(*regexp.Regexp).MatchString` instead of
`(*regexp.Regexp).Match([]byte(...))` when matching string to avoid
unnecessary `[]byte` conversions and reduce allocations.

Example benchmark:

var pathRegex = regexp.MustCompile(".*.yaml")

func BenchmarkMatch(b *testing.B) {
	for i := 0; i < b.N; i++ {
		if match := pathRegex.Match([]byte("./config/deploy.yaml")); !match {
			b.Fail()
		}
	}
}

func BenchmarkMatchString(b *testing.B) {
	for i := 0; i < b.N; i++ {
		if match := pathRegex.MatchString("./config/deploy.yaml"); !match {
			b.Fail()
		}
	}
}

goos: linux
goarch: amd64
pkg: github.com/zricethezav/gitleaks/v8/detect
cpu: AMD Ryzen 7 PRO 4750U with Radeon Graphics
BenchmarkMatch-16          	 2167712	       657.9 ns/op	      24 B/op	       1 allocs/op
BenchmarkMatchString-16    	 3275372	       324.8 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	github.com/zricethezav/gitleaks/v8/detect	3.436s

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-10-28 16:31:43 -05:00
wayne-snyk a3ab4e8ac5 refactor: more explicit rules (#1280) 2023-10-23 14:11:37 -05:00
Norman Soetbeer bd9a25a379 bugfix: reduce false positives for stripe tokens by using word boundaries in regex (#1278) 2023-10-15 21:41:38 -05:00
Yeonghae Choi 6d0d8b5068 add Infracost API rule (#1273) 2023-10-08 20:44:02 -05:00
Oleksandr Redko 2959fc072c refactor: simplify test asserts (#1271) 2023-10-03 10:38:08 -05:00
Zachary Rice d37b38f2ee Update Makefile 2023-09-22 09:29:19 -05:00
Oleksandr Redko 14b1ca9fd9 refactor: change detect tests to t.Fatal instead of log.Fatal (#1270) 2023-09-20 13:46:35 -05:00
Brandon Welsch d9f86d6123 feat(rules): Add detection for Scalingo API Token (#1262)
* feat(rules): Add detection for Scalingo API Token

* fix(rules): Add boundary on both ends of Scalingo API Token regex to avoid falve positives
2023-09-04 10:20:56 -05:00
Richard Gomez ed34259e9c feat(jwt): detect base64-encoded tokens (#1256) 2023-08-30 10:39:10 -05:00
Savely Krasovsky 0d5e46fecb feat: add --ignore-gitleaks-allow cmd flag (#1260)
* feat: add --ignore-gitleaks-allow cmd flag

* typo: fix
2023-08-30 09:34:59 -05:00
Zachary Rice a82ac29976 switch out libs (#1259) 2023-08-29 12:01:36 -05:00
Savely Krasovsky 0b84afa0fa fix: no-color option should also affect zerolog output (#1242) 2023-08-29 11:17:29 -05:00
Gian Miguel Del Mundo 8976539177 Fixed lineEnd indexing if the match is the whole line (#1223) 2023-08-29 11:09:47 -05:00
FrankandZachary Rice 30c6117aaa feat: Add optional redaction value, default 100 (#1229)
This commit introduces an optional value for the --redact flag, allowing
users to specify the extent of redaction for secrets. The valid range of
values is from 0 (no redaction) to 100 (full redaction).

If no value is provided, the default redaction value is set to 100,
resulting in complete redaction by replacing the secret with the term
'REDACTED'. This preserves the original behavior of the --redact flag.

Co-authored-by: Zachary Rice <zachary.rice@trufflesec.com>
2023-08-29 11:03:23 -05:00
Richard Gomez e9135cf0b5 fix(jwt): longer segment lengths (#1214) 2023-08-29 10:54:09 -05:00
Jasper Boeijenga f65f9157ff Added yarn.lock file to default allowlist paths (#1258) 2023-08-29 10:41:03 -05:00
Zachary Rice abfd0f3fdc Update README.md 2023-08-28 13:10:03 -05:00
Richard Gomez 18283bb48e feat(rules): make case insensitivity optional (#1215) 2023-08-24 10:41:52 -05:00
Richard Gomez 9fb36b242d feat(rules): detect Hugging Face access tokens (#1204) 2023-08-24 10:38:19 -05:00
Matjaž Domen Pečan db4bc0fe76 Resolve #1170 - Enable selection of a single rule (#1183)
* Gitleaks issue #1170 - Feature request to add a flag to enable a subset of rules on the command line.

* Added documentation.
2023-08-24 09:56:17 -05:00
Warren Parad 3cbcda20d2 Update authress.go to include alternate form account dash (-) (#1224) 2023-08-24 09:28:39 -05:00
Oleksandr Redko 46c627212c refactor: remove unnecessary removing temp files in tests (#1255) 2023-08-24 09:16:00 -05:00
Oleksandr Redko 963a6976d1 refactor: use os.ReadFile instead of os.Open + io.ReadAll (#1254) 2023-08-23 16:08:38 -05:00
Richard Gomez 163ec21120 fix(sumologic): improve patterns (#1218)
This fixes #1149.
2023-08-23 10:15:20 -05:00
Savely Krasovsky 45266551ba refactor: fix #722 properly (#1250)
* refactor: fix #722 properly

* fix(deps): update go-gitdiff to v0.9.0

* refactor: second attempt

* refactor: better git package api

* fix: add comments
2023-08-22 14:00:33 -05:00
Richard Gomez b1a2ce7296 fix(plaid): include entropy in go definition (#1252) 2023-08-21 09:06:26 -05:00
Richard Gomez 34e67229e6 feat(config): update template logic (#1201) 2023-08-17 12:42:07 -05:00
Samuel Mortenson 61513d6772 Add entropy check to plaid client/secret ID rules (#1213) 2023-08-17 12:41:14 -05:00
Baruch Odem (Rothkoff) f0dcd4d9cf feat: add JFrog API and Identity keys (#1233)
* first commit

* feat: add JFrog API and Identity key
2023-07-17 07:27:15 -05:00
Richard Gomez 06db3b91d7 chore(config): fix inconsistent generated values (#1200) 2023-06-16 11:27:53 -05:00
Zachary Rice 7804d652c0 Revert "Initial set of Azure secrets for #539 (#1079)" (#1197)
This reverts commit 7911ac60d7.
2023-06-15 07:44:13 -05:00
Dimitri VasdekisandJesse Houwing 7911ac60d7 Initial set of Azure secrets for #539 (#1079)
* Initial secret set

* Covered off all rule types in comments

* Finished Azure and Ansible rules

* About to run go run main.go

* Fixed some rules, but tests need work

* Initial secret set for Azure

Needs work - many tests fail

* Fix remaining Azure secrets - but couldn't get XML to work

* Update .gitignore

Co-authored-by: Jesse Houwing <jesse.houwing@gmail.com>

---------

Co-authored-by: Jesse Houwing <jesse.houwing@gmail.com>
2023-06-15 07:23:08 -05:00
Richard Gomez 463d24618f feat(slack): update token regex (#1161) 2023-06-15 07:17:01 -05:00
eyalatox 86197b0848 add tags support for csv and sarif formats (#1176)
* add tags support for csv and sarif formats

* add tests
2023-06-15 07:16:23 -05:00
Ian Moroney 3f894cbafc Fixed docker run command in README.md (#1194)
The docker run command was missing `ghcr.io/` in the image name, which resulted in an error:

Unable to find image 'gitleaks/gitleaks:latest' locally
docker: Error response from daemon: pull access denied for gitleaks/gitleaks, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
2023-06-15 07:15:57 -05:00
Richard GomezandRichard Gomez 7f53b033fe feat: add warning for quoted --log-opts values (#1160)
Co-authored-by: Richard Gomez <richard@rbcrt.com>
2023-06-14 09:26:24 -05:00
Becojo 7dc9ba40a7 Add detection for OpenAI API keys (#1148)
* Add detection for OpenAI API keys

* Remove `sk-` keyword
2023-06-14 09:02:37 -05:00
sergiomarotco c101fa88d2 Add some useless files (#1193)
These files do not contain secrets
2023-06-13 20:12:19 -05:00
Zach 257c703add add tests for commits 2023-06-13 16:07:19 -05:00
Zach b1d59bf890 fix broken vet, format some stuff 2023-06-13 16:05:04 -05:00
Zachary Rice fab4f4e97d Merge branch 'master' of github.com:gitleaks/gitleaks 2023-06-13 13:51:52 -05:00
Zachary Rice 289062acd8 add some gl ignores 2023-06-13 13:51:12 -05:00
Richard Gomez 91ff8f9b70 Ignore all comits when .gitleaksignore fingerprint lacks SHA (#1156)
* fix: .gitleaksignore without sha in fingerprint

* chore: add prior commit to .gitleaksignore
2023-06-13 13:42:51 -05:00
Malte Morgenstern 0dbdde837f Add junit report format (#920)
* add junit report format

* add fingerprint to expected test result to fix tests

* fix expected junit test report
2023-06-13 13:37:32 -05:00
Gaige B Paulsen bc599446dc chore: update deps to fix solaris link (#1159) 2023-06-13 13:27:30 -05:00
wayne-snyk a685551299 Add makefile variable detections (#1191)
* add makefile variable definitions

* update snyk tests

* regenerate config
2023-06-12 08:14:15 -05:00
wayne-snyk ab5fc21e82 Add detection for Snyk tokens (#1190)
* add snyk token

* add snyk token to rules

* s/snyk_token/snyk
2023-06-09 10:08:48 -05:00
Rebecca Turner d6fccc87d3 Add REDACTED to stopwords for generic-api-key rule (#1188) 2023-06-07 13:46:41 -05:00
Paulo Correia 6f75511665 Added option to specify .gitleaksignore path (#1179) 2023-06-05 17:03:26 -05:00
Oleksandr Redko 190ac977be Fix closing file in writeJson and writeSarif (#1187) 2023-06-05 10:43:04 -05:00
Oleksandr Redko 6dbb0c5af5 Simplify tests by using T.TempDir (#1186) 2023-05-30 07:24:59 -05:00
Oleksandr Redko 6705461b33 Fix typos in *.md, comments and logs (#1185) 2023-05-30 07:08:42 -05:00
Zachary Rice 9869eab4c2 Update README.md 2023-05-01 19:01:05 -05:00
Zachary Rice 16f1ec0f1e Update bug_report.md 2023-05-01 17:10:00 -05:00
Zachary Rice 8d80a5a5a2 Adding discord channel to readme 2023-05-01 16:43:06 -05:00
Dariusz Porowski 146f69e51b 🐛 fix(sarif): update report to pass validator (#1167)
* 🐛 fix(sarif): update report to pass validator

* ✅ test(sarif): update sarif report testdata
2023-04-28 14:15:18 -05:00
Richard Gomez 51ca0f89b9 fix(detect): extra secret from group before checking allowlist (#1152) 2023-04-19 11:57:24 -05:00
Richard Gomez 81cf30855c Fix G307 warning: Deferring unsafe method "Close" on type "*os.File" (#1154)
* fix: check potential error from file.Close

* fix(detect): use existing logger
2023-04-19 11:56:08 -05:00
Richard Gomez bd8b145bea fix(detect): avoid panic with verbose flag (#1143)
* fix(detect): avoid panic with verbose flag

* chore: fix minor syntax error

* fix: properly print secret with colour

* fix(detect): use lineEndIdx
2023-04-19 11:55:33 -05:00
Edward Wang 839f114f2b Fix typo (#1142) 2023-04-08 17:56:58 -05:00
Zachary Rice 63c3076ea2 No color (#1136)
* safer out of bounds

* no color option

* readme
2023-03-29 16:56:01 -05:00
Zachary Rice b5a726e96a Update README.md 2023-03-29 14:33:34 -05:00
Zachary Rice 56079dc9ea safer out of bounds (#1135) 2023-03-29 08:37:46 -05:00
Warren Parad 9c6650d14a Add Authress access key format: https://authress.io/knowledge-base/docs/authorization/service-clients/secrets-scanning/ (#1131) 2023-03-28 11:23:34 -05:00
SADIK KUZU 6fa63f41d8 Update pre-commit address and rev tag in README (#1125)
* Update pre-commit address and rev tag in README

* Upgrade actions/checkout@v2 to v3
2023-03-22 10:18:07 -05:00
Zachary Rice fe9fb37c36 Update gitleaks.yml 2023-03-22 10:12:52 -05:00
Zachary Rice c3b7a98911 Update README.md 2023-03-22 09:59:48 -05:00
Zachary Rice 6c4a88c5a4 Update README.md 2023-03-21 08:53:29 -05:00
Zachary Rice 27481a9071 Update .gitleaksignore 2023-03-21 08:52:34 -05:00
Rafael FigueiredoandRafael Figueiredo 9701bf1724 Bufix/1100 protect stagged files (#1121)
* create repo with stagged secrets

* add .gitleaksignore to testdata repo

* fix typo

* add gitleaksignore to detector on protect command

---------

Co-authored-by: Rafael Figueiredo <rfigueiredo@garoa.cloud>
2023-03-21 08:50:34 -05:00
Zach a5b9c24779 remove extra default on source option 2023-03-21 08:08:04 -05:00
sergiomarotco db79d8194f fix README.md !? (#1123) 2023-03-21 08:07:22 -05:00
Florian Greinacher 8a31f4a4be Improve rule descriptions for Stripe and Facebook access tokens (#1119) 2023-03-17 09:50:09 -05:00
Caleb Jasik 6b0c303b26 Add Defined Networking API Tokens (#1096)
Adds detection support for Defined Networking tokens (https://docs.defined.net/guides/automating-host-creation/)

I added a fixture in addition to the generator, I think I may be able to use the `generateUniqueToken` instead of the semi-generic option? Let me know if I should update accordingly.

Remove testing fixture
2023-03-14 14:46:45 -05:00
wolframhaussig 1fb3a77eb8 Update gitleaks.toml (#1116)
Use Word Boundaries for EasyPost Tokens
2023-03-14 11:06:17 -05:00
Zachary Rice 765bcd5854 Update gitleaks.yml (#1117) 2023-03-13 08:35:03 -05:00
Juan C. Mancebo 11c2ad01a4 Add gradle.lockfile to allowlist (#1112) 2023-03-03 10:24:21 -06:00
SADIK KUZU e55d3975ec Update pre-commit rev tag in README (#1108) 2023-03-01 10:55:35 -06:00
Joost Voskuil 2dd9946052 Add pnpm-lock.yaml and Database.refactorlo (#1109) 2023-02-28 15:07:38 -06:00
Zachary Rice 4b5e8e1829 Feat/allowlist regex target (#1107)
* adding regexTarget entry in allowlist

* update readme

* add globalregextarget to check

* update readme
2023-02-26 08:51:59 -06:00
C.J. May 343e69399b ignore package-lock.json (#1076)
* ignore package-lock.json

`package-lock.json` is automatically generated by npm

* add package-lock.json to global allowlist
2023-02-25 08:39:18 -06:00
Sandeep Bhat 0060ab636a Fix typos in README.md and CONTRIBUTING.md (#1090) 2023-02-25 08:38:41 -06:00
raffis 025908808f fix: ignore baseline if path was not relative in source (#1101)
* fix: ignore baseline if path was not relative in source

Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>

* test: ignore test secret

---------

Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>
2023-02-25 08:36:23 -06:00
SADIK KUZU 088f8b8074 Fix H in GitHub and update pre-commit rev tag in README (#1087) 2023-02-02 08:45:54 -06:00
Nejc Habjan afdccad46f Add missing GitLab token patterns (#1077) 2023-01-21 20:03:05 -06:00
very-doge-wowandFabian F Groß e002920355 Fix rule for private keys (#1072)
* refactor: fix rule for private keys

Wouldn't match old keys which have been created with the BLOCK statement at the beginning and end of the key.

* fix: rule for private keys

* fix: missing comma

Co-authored-by: Fabian F Groß <fabian.f.gross@deutschebahn.com>
2023-01-12 08:38:48 -06:00
Zachary Rice d805fb9144 remove color formatting when #1042 is encountered (#1050) 2022-12-01 19:11:44 -06:00
Zachary Rice 391d4d75f6 Update README.md 2022-11-28 09:16:32 -06:00
icecream-monsterandEsther f77493274a adding jwt tokens with padding format "=" (#1031)
* adding jwt tokens with padding format =

* forgot to run go run main.go

* manually putting database.refractorlog back

Co-authored-by: Esther <esther.ay@snaptravel.com>
2022-11-22 15:55:03 -06:00
Zachary Rice 7f229faf12 include default newline pairs when calculating location (#1038)
* include default newline pairs when calculating location
2022-11-20 12:34:38 -06:00
Becojo d0733f96f3 Add rule for fine-grained GitHub PAT (#1026) 2022-11-09 17:02:35 -06:00
Zachary Rice 6ef704f28f Add scanning from a pipe with --pipe (#1012) 2022-10-13 09:08:43 -05:00
Zachary 7cfebca510 add a few fingerprints for test data 2022-10-12 19:34:14 -05:00
Ricky GrassmuckandZachary Rice 6d801ed61c Add support for following symlinks (#1010)
* Add support for following symlinks

* Update detect/detect.go

Co-authored-by: Zachary Rice <zricezrice@gmail.com>

* Update cmd/detect.go

Co-authored-by: Zachary Rice <zricezrice@gmail.com>
2022-10-12 19:28:53 -05:00
sergiomarotco e15ab0dc2a fix bug in readme (#1011)
--max-target-megabytes INT
2022-10-12 09:22:37 -05:00
Zachary Rice c39e7640e2 define log-opts, odd that this wasn't failing before... (#1009) 2022-10-11 07:11:02 -05:00
roma8389 c0caab0355 add --max-target-megabytes : maximum size for a file/blob to be scanned (#1003)
* add --max-target-megabytes : maximum size for a file/blob to be scanned

* add --max-target-megabytes : maximum size for a file/blob to be scanned

* add --max-target-megabytes : maximum size for a file/blob to be scanned

* adjust readme comment

* fix on prem
2022-10-10 16:07:06 -05:00
Zachary Rice 81c92c78ca Update USERS.md 2022-10-10 13:37:56 -05:00
Zachary Rice bf031592b8 Update .gitleaksignore 2022-10-10 08:23:17 -05:00
Zachary Rice acce01f233 Update README.md 2022-10-10 08:22:27 -05:00
Michael Henriksen 2678a54290 Add detection rules for DigitalOcean tokens (#1002)
* Add detection rules for DigitalOcean tokens

* go fmt correction
2022-10-06 08:03:46 -05:00
Furkan Türkal 289b757158 docs: add Trendyol to users (#998) 2022-10-04 07:40:44 -05:00
Carlos Alexandro Becker c02d830494 docs: added goreleaser to user list (#997)
Thanks for gitleaks, its amazing to have it in the pipeline so I can have some extra peace of mind!
2022-10-03 14:10:33 -05:00
Zachary Rice 67b0a29ab6 Update USERS.md (#996) 2022-10-03 08:29:30 -05:00
Zachary Rice f710d680dd Create USERS.md 2022-10-02 16:45:51 -05:00
Joost Voskuil eb2bfe5e16 Exclude dacpac refactorlogs (#990)
Dacpac refactorlogs contains Key's that are false positives. This commit excludes those files.
2022-09-30 07:32:50 -05:00
alexgit2k 55d1da131a Output number of commits at info-level. (#991) 2022-09-28 07:32:24 -05:00
Becojo 177e9f4fc2 Detect Slack Workflow Webhook URLs (#989) 2022-09-27 13:56:48 -05:00
naoki kuroda e93d8cb696 Upgrade go version to 1.19 (#987)
* upgrade go version to 1.19

* upgrade go version to 1.19 in dockerfile and test.yml
2022-09-25 09:06:50 -05:00
Michael Jarvis db43f9a342 Minor cleanup to error handling and logging (#985)
* silence warning about unchecked errors

* go-fmt change to add newline

* Zerolog requires you to always call .Msg()

When logging with zerolog, you need to always end with .Msg(), even if
you just pass an empty string.

If you read the README on https://github.com/rs/zerolog, they write:

> It is very important to note that when using the zerolog
> chaining API, as shown above (log.Info().Msg("hello world"), the
> chain must have either the Msg or Msgf method call. If you
> forget to add either of these, the log will not occur and there
> is no compile time error to alert you of this.

* Create empty slice without literal

* Fix variable / package name collision with literal

instead of having a variable named "config", which collides with the
package name "config", just pass a literal config.Config{} struct to the
function

* Replace call to deprecated ioutil.ReadAll()

Use io.ReadAll() instead

* Check error when closing jsonFile

Make it a warning and log error
2022-09-23 08:06:41 -05:00
Zachary Rice 9b15f0d33e Update README.md 2022-09-21 20:00:02 -05:00
Zachary Rice 817aa7b8d0 Update .gitleaksignore 2022-09-21 10:12:48 -05:00
Zachary Rice 33082a9967 Update README.md 2022-09-21 10:04:51 -05:00
Zane Durkin 7dbfe8db2f Adding quiet mode to silence banner (#852)
* Adding quiet mode to silence banner

* Changing flag description. Adding flag to README

* Updating argument name

* updating variable name to aline with argument

* fixing readme spacing

* Fixing variable name
2022-09-17 12:32:52 -04:00
Alex GoncharovandAlex Goncharov fc98cbf159 Issue #980: Add support for Telegram Bot API Token (#981)
* Issue #980: Add support for Telegram Bot API Token

* Replace test with random bot_id length by tests with fixed one.
Add tests for the corner cases.

Co-authored-by: Alex Goncharov <b4bay@users.noreply.github.com>
2022-09-17 11:26:29 -04:00
Malte Morgenstern 3f0293dab0 add rule for microsoft teams webhooks (#970) 2022-09-16 09:19:59 -05:00
Gawan SchroederandZachary Rice 4f6ee2bcf1 Add baseline (#975)
* Add baseline

* Update doc, add error, move baseline to detect namespace, ignore findings instead of reactively filter them out

* Update detect/detect.go

Co-authored-by: Zachary Rice <zricezrice@gmail.com>

* Update IsNew function (no check on tags - omit finger print check)

* Update README.md

Co-authored-by: Zachary Rice <zricezrice@gmail.com>

* Update examples in readme to make it ensure it's clear that a baseline is indeed a gitleaks report

* Fix test - updated tags doesn't make a finding new

* Add missing err assignment

* Allow scanner to continue without baseline if file is malformed

* Fix typo in comment

* Fix control flow err. (Real life testing)

* Fix wording

* Auto-ignore baseline path
2022-09-16 08:18:31 -05:00
Akash Chandwani 62020539f4 Add pre-commit autoupdate command to README.md (#978) 2022-09-07 08:06:31 -05:00
very-doge-wowandFabian F Groß c8681e4858 refactor: more precise rule for private keys (#930)
* refactor: more precise rule for private keys

The current regex didn't match PGP private keys anymore, since they start with `BEGIN PGP PRIVATE KEY BLOCK` and the `BLOCK` never matched for the existing regex. I've made that part optional so that all strings matching for the current regex will still match for the new regex.

* refactor: more precise rule for private keys

Co-authored-by: Fabian F Groß <fabian.f.gross@deutschebahn.com>
2022-09-05 10:18:44 -05:00
Zachary b93459160a update gitleaksignore 2022-09-04 09:07:32 -05:00
Zachary 8622c39e88 add fingerprint to output 2022-09-04 09:04:53 -05:00
Zachary Rice 96eed6aa0f Pretty output (#973)
pretty output
2022-09-04 08:58:57 -05:00
Akash Chandwani 7d9dd260f4 Update version in readme file (#972) 2022-09-03 07:25:45 -05:00
Zachary Rice e47867d802 ignore empty files (#965) 2022-08-26 09:48:33 -05:00
jmatosgrafana adf512e2ac Add grafana tokens rules (#959)
* Add grafana tokens rules

* Adding upper bound limits to Grafana tokens
2022-08-19 10:43:01 -05:00
Zachary Rice e35cb6707a add prefect and readme rules (#961) 2022-08-19 08:24:15 -05:00
Zachary Rice b6b7cfb6d3 draft: bump gitdiff, add git.Err state, better log messages (#954)
* bump gitdiff, add git.Err state, better log messages

* remove cmd.Start

* forgot to start...
2022-08-16 19:36:25 -05:00
Zachary Rice 1b3f10cb79 Feat/add fingerprint no git (#952)
* no-git support fingerprint support

* updating gitleaksignore w/ no-git false positives

* fix test
2022-08-12 08:08:13 -05:00
Zachary Rice 6748a89bf4 safe file checking (#946) 2022-08-08 14:16:50 -05:00
Zachary Rice 6f6e057042 Update README.md 2022-08-08 11:23:52 -05:00
Zachary Rice b8f236c9b3 Explicit fingerprint (#944) 2022-08-08 07:55:57 -05:00
Zachary c5fc080aa0 add two test findings to gitleaksignore 2022-08-07 13:11:04 -05:00
Zachary Rice 3bace4c735 Feat/ignore finding (#938) 2022-08-07 12:53:58 -05:00
Zachary Rice e890a8e809 add jwt rule (#943)
* add jwt support

* ignore sample secrets
2022-08-06 11:23:23 -05:00
Zachary Rice 49b0b097e4 bump golang test version (#942) 2022-08-06 09:16:16 -05:00
Zachary Rice 31a8e9db7a gitleaks allow docs (#941)
* gitleaks allow docs

* reorder
2022-08-06 08:59:51 -05:00
Malte Morgenstern b1853bd032 Add new rules for vault tokens (#919)
* add new rules for vault tokens

* Configure max length for vault rules
2022-08-03 15:46:46 -05:00
AndrewandAndrew Weiner cd52267113 Feature/add sidekiq rules (#933)
* Add sidekiq rules

* Added two new rules for sidekiq
* Other: Add keywords to square rules per Zach's instructions

* Validate now works, but test suite is failing

* Tests are now passing

* Add Sidekiq Rules: Ran go fmt

* * After resolving conflicts, had to rerun the rule generator to add back the semicolon char
* After running tests, had to fix one line in testdata/expected/report/sarif_simple.sarif

* * Added keywords to simple.toml for sidekiq-sensitive-url so that the rule matches what is in gitleaks.toml

Co-authored-by: Andrew Weiner <aweiner@frontrush.com>
2022-08-03 07:31:40 -05:00
Zachary afc89f91c0 update readme 2022-07-27 18:27:04 -05:00
Zachary 5ae1023aa3 add url for config 2022-07-24 11:57:01 -05:00
Zachary Rice 31650f01e7 Feature: Adding the ability to extend configuration files (#926)
* init

* working on default and path config extensions

* adding trace log level, consolidating some code

* cleaning things up, updating generate package

* fix tests

* formatting

* adding tests for extend

* extend not extends

* formatting

* only allow usedefault or path to be set

* update readme

* add note about allowlists

* more readme, expand env var for path

* actually dont support env var. ez attack
2022-07-24 11:51:50 -05:00
anotherbridgeandAndré Breuer 0d471653b5 Add fix for issue #915 (#916)
Co-authored-by: André Breuer <andre.breuer@ndaal.eu>
2022-07-14 07:20:55 -05:00
Zachary Rice f615d0397d Update README.md 2022-07-12 09:23:53 -05:00
Zachary Rice 40e9172ab3 Update README.md 2022-07-08 17:19:12 -05:00
Zachary Rice 9033132143 Update README.md 2022-07-08 17:07:58 -05:00
Zachary 1fc27eebda adding access to generic rule keywords and identifiers 2022-07-05 15:33:06 -05:00
Craig SmithandCraig Smith f4ddeda433 Fix proper names capitalization (#907)
Co-authored-by: Craig Smith <5344211-craigmsmith@users.noreply.gitlab.com>
2022-07-05 08:26:41 -05:00
Romain Barissat 6210a7e832 Add multi platform build (#897)
Signed-off-by: Romain Barissat <romain-noreply@barissat.com>
2022-07-02 15:28:01 -05:00
Zachary e300b31be5 update twitter rule generation description and id 2022-06-28 06:13:07 -05:00
Zachary 3073e45b0a capitilze twitter description 2022-06-28 06:11:10 -05:00
Zachary d401bd337a Merge branch 'master' of github.com:zricethezav/gitleaks 2022-06-28 06:10:14 -05:00
Zachary 1297b41b10 adding travis ci 2022-06-28 06:10:02 -05:00
Craig SmithandCraig Smith d44cb91306 Fix id and description for twitter tokens (#905)
Co-authored-by: Craig Smith <5344211-craigmsmith@users.noreply.gitlab.com>
2022-06-28 06:09:04 -05:00
Zachary Rice efdc7749df Adding okta, codecov, zendesk, and updating Atlassian's rule to include jira keyword (#904)
* okta

* adding codecov

* add jira to atlassians keywords

* adding zendesk
2022-06-27 20:49:08 -05:00
Zachary Rice e78a22e19c Fix Plaid, add Plaid access token (#903)
* adding airtable and adafruit

* Fix plaid, add plaid-access-token
2022-06-27 18:49:32 -05:00
Zachary Rice 9cc19ec0f8 adding airtable and adafruit (#902) 2022-06-27 18:31:06 -05:00
Zachary 05c165deb2 Fixes accidental type typos while translating rules from validation spreadsheet, adds bittrex rule 2022-06-27 17:03:32 -05:00
Zachary Rice f6a87ca58c Remove ssn allowlist (#898)
* Adding a bunch of new rules, update allowlist to include node_modules and vendor folders, extend helper config functions

* remove ssns from allowlist since default config does not detect ssn
2022-06-27 08:58:00 -05:00
Zachary Rice 73a3cf8afb Adding a bunch of new rules, update allowlist to include node_modules… (#896)
* Adding a bunch of new rules, update allowlist to include node_modules and vendor folders, extend helper config functions

* use func instead of function in stopwords
2022-06-25 11:43:51 -05:00
Zachary Rice d196b83ca6 contributing guidelines first draft (#895)
* contributing guidelines first draft

* update links, add readme note
2022-06-23 17:17:39 -05:00
Alex 35f2ea5da2 Lint python commit script to satisfy PEP8 (#893) 2022-06-21 06:55:43 -05:00
Zachary Rice 70028079b4 Update generate (#892)
* maintain parity with recent changes... need to create rule contributing guidelines

* missed on, ensure uniqueness in rule-id
2022-06-20 14:57:48 -05:00
Zachary Rice c14af5ffdf maintain parity with recent changes... need to create rule contributing guidelines (#891) 2022-06-20 14:14:14 -05:00
Craig SmithandCraig Smith 06b1396a2a Fix duplicate TOML Rules and IDs (#889)
* Remove duplicate rule

* Fix duplicate rule IDs

Co-authored-by: Craig Smith <5344211-craigmsmith@users.noreply.gitlab.com>
2022-06-20 08:49:47 -05:00
Zachary Rice 5d3f247d7d Update README.md 2022-06-16 08:11:20 -05:00
Zachary Rice 404dd8e0c0 Update gitleaks.yml 2022-06-15 17:20:08 -05:00
Zachary Rice 3a1ab48818 Update README.md 2022-06-12 13:25:03 -05:00
Zachary Rice f5c2b636f3 user accounts don't need gitleaks license 2022-06-07 11:48:43 -05:00
Zachary Rice b5ed7ff1b2 Update README.md 2022-06-02 17:47:36 -05:00
Zachary Rice 09007da395 Add gitleaks badge 2022-06-02 17:46:47 -05:00
Zachary Rice d51ce47d86 Create gitleaks.yml (#884) 2022-06-02 17:40:57 -05:00
Zachary Rice 6919447094 add link to gitleaks.io 2022-06-02 17:21:08 -05:00
fooliooandx c3b7932544 fix git unsafe directory (#883)
* fix git unsafe directory

fixes https://github.com/zricethezav/gitleaks/issues/846

* Update Dockerfile

Co-authored-by: x <>
2022-06-02 14:22:03 -05:00
Zachary Rice 82e409a434 Limit newlines regex (#881)
* improve regex to reduce fps with newlines

* remove version from regex and rely on stopwords instead

* add false positive for validation
2022-05-30 12:07:06 -05:00
Zachary 0eb57cbe4d add combo to stopwords, update cmd/generate 2022-05-28 11:47:17 -05:00
Don C. Bigler 3531887941 Fix generic-api-key detected erroneously (zricethezav#877) (#878) 2022-05-28 11:44:49 -05:00
Zachary Rice e9ebde73bc ignore end line when comparing generic rules (#879) 2022-05-28 09:49:27 -05:00
Zachary Rice 469cd22f61 updating generic regex and algoia regex (#875) 2022-05-25 08:00:10 -05:00
SimonGurney 93e72c215d feat: add algolia key support (#866)
* feat: add algolia key support

* feat: add algolia key to generator

* chore: update algolia regex to match gen
2022-05-25 07:39:20 -05:00
Dirkjan Bussink 865478bcdc Improve PlanetScale token detection (#874)
This improves the PlanetScale token detection. It add some flexibility
in length. There is no guarantee that the length is always 43 characters
(in fact, it's very likely to change a bit soon).

Additionally, it adds support for detecting oauth tokens as well.
2022-05-24 22:15:36 -05:00
Zachary Rice d6c0de7c85 Update README.md 2022-05-16 19:08:06 -05:00
Zachary Rice 0266ab8958 Adding JIT Security messages 2022-05-10 11:21:04 -05:00
Zachary Rice 6b7ab73a52 Update README.md 2022-05-02 10:21:40 -05:00
Zachary Rice 61ee7c58cc fix no-git bug (#859) 2022-04-27 21:48:56 -05:00
Zachary Rice ad7509e3b4 Removing private keyword from private key rule (#858) 2022-04-27 07:29:09 -05:00
Zachary Rice a62cc52aba nasty little bug (#853) 2022-04-23 11:18:56 -05:00
Zachary Rice f93e5dc844 adding a ton of stopwords to the generic rule only as that is the loudest rule (#851) 2022-04-21 17:01:21 -05:00
Zachary Rice 8481f0e9cd adding stopwords (#849)
* adding stopwords

* format readme, update default config
2022-04-21 08:31:58 -05:00
Zachary Rice 82f7d61593 Update dockerfile (#848)
* bump alpine and add default safe dir for git

* comment out safe dir fix

* update deps
2022-04-20 18:19:33 -05:00
Zachary Rice a42b32bdf1 fix EOL in secret suffix (#847)
* fix EOL in secret suffix

* allow quoted key value syntax
2022-04-20 17:55:07 -05:00
foolioo 79638b080c unpin docker version in pre-commit hook (#832)
eliminating inconsistency. e.g. for version 8.6.1, pre-commit hooks points to outdated version https://github.com/zricethezav/gitleaks/blob/c33ee3f25215635c0afbb210672779e7efb6f1d2/.pre-commit-hooks.yaml#L10
2022-04-19 21:33:23 -05:00
Zachary Rice 3474c58c9e Generate tps (#845)
* WIP

* simplify tp generation
2022-04-18 21:59:38 -05:00
Zachary Rice d8cd93cabe maybe fix out of bounds (#843) 2022-04-18 14:57:40 -05:00
Zachary Rice 48b79facfa optimize keywords (#841)
* optimize keywords

* use defaults for concurrency again
2022-04-16 17:41:40 -05:00
0xn3va e23f7f58f3 Update detect.go (#839) 2022-04-12 21:44:00 -05:00
Zachary Rice 606bb1a13b Standardize/alphabetize rules, add cmd/generate/config package (#840) 2022-04-12 21:40:48 -05:00
aeongdesu e784980515 fix ghcr.io typo in README.md (#835) 2022-04-08 08:05:06 -05:00
Zachary Rice c33ee3f252 normalize keyword check (#830) 2022-04-06 09:55:36 -05:00
Zachary Rice b0a958f55e Keyword (#825)
* wip keywords optimization

* update readme

* limit concurrency to 4

* update readme
2022-04-05 11:50:50 -05:00
foolioo 237b03af18 doc gitleaks-docker pre-commit hook (#819)
relates to #818
2022-03-29 20:05:28 -05:00
Zach Rice f348991d21 Merge branch 'master' of github.com:zricethezav/gitleaks 2022-03-29 11:54:05 -05:00
Zach Rice e0745adbd2 skip content checks for path only rules 2022-03-29 11:53:48 -05:00
foolioo 1ddc924a67 use official docker image as pre-commit hook (#818)
* use official docker image as pre-commit hook

* Update .pre-commit-hooks.yaml

* Update .pre-commit-hooks.yaml

* Update .pre-commit-hooks.yaml

* Update .pre-commit-hooks.yaml

* Update .pre-commit-hooks.yaml
2022-03-28 17:18:12 -05:00
Zach Rice 0b07625567 remove stopwords from global allowlist 2022-03-28 08:03:16 -05:00
Adam Shannon 0cabbf8ca8 detect: skip binary files with --no-git (#810) 2022-03-22 14:32:47 -05:00
Zachary Rice ba9e089e35 fixing a location off by one edge case for --no-git (#812) 2022-03-22 14:22:46 -05:00
Zachary Rice 31ff8677dd Update README.md 2022-03-21 13:36:29 -05:00
Zachary Rice 3e5e63956e Allow tag (#809)
* gitleaks:allow signature

* readd all tests

* fixing tests
2022-03-19 10:32:04 -05:00
Zachary Rice 57f9bc83d1 Stop words (#808)
* use regex for stopwords

* fix up regex

* rm stopwords
2022-03-19 09:31:38 -05:00
Zachary Rice 6e72472b60 Refactor detect, add entropy to all findings (#804)
Refactor `detect`, add `entropy` to all findings
2022-03-12 11:50:01 -06:00
Isaac Dawson 9326f35380 Escape - character in regex character groups (#802)
* fix char escape

* add test

* fix verbosity in make test
2022-03-07 08:33:06 -06:00
jetexe 19555579c8 adding go mod/sum to ignore (#797) 2022-03-01 10:16:17 -06:00
Greg JohnsonandGreg Johnson 60dd607312 GitLab pats may contain underscores as well as dashes (#794)
* gitlab pats may contain underscores as well as dashes

* include testdata index binary

Co-authored-by: Greg Johnson (codeEmitter) <gjohnson@gitlab.com>
2022-02-28 08:03:09 -06:00
Andrzej Amghar c3b799ec63 ignore k8s apiVersion in generic-api-key pattern (#760) 2022-02-22 17:00:20 -06:00
rui 4b6f4d0de5 build: updates for go1.17 (#769)
* build: remove `GO111MODULE` as it turned on by default

Signed-off-by: Rui Chen <rui@chenrui.dev>

* build: update for go1.17

* run test

Signed-off-by: Rui Chen <rui@chenrui.dev>

* lint: remove unused code
2022-02-22 16:49:45 -06:00
Zachary Rice fbfb3f591e allow non-last-element secret groups (#792) 2022-02-22 16:34:56 -06:00
Zachary Rice b91799aa18 fixing segfault when using a rule with only a path (#791)
* fixing segfault when using a rule with only a path

* DRYing
2022-02-22 15:58:03 -06:00
Luca Regne db1b54bf9f Fix: Typo in LinkedIn id (#789) 2022-02-22 09:49:55 -06:00
Ian Mckay e9529744f8 Fix vendor name casing, Flutterwave typo (#785) 2022-02-19 10:24:47 -06:00
Chris Wolf d1f642a9df Sarif results with empty rules now represents as [] instead of null/nil (#786) 2022-02-19 10:20:35 -06:00
Greg Myers 9261f1c47f Fix typos in README.md (#780)
comand ==> command
awsome ==> awesome
precendence ==> precedence
2022-01-29 12:08:55 -06:00
Zachary Rice 991223abab remove godoc text filtering (#763) 2022-01-07 10:59:51 -06:00
Zachary Rice 801d44a6e4 limit number of goroutines for historic scanning as well (#761) 2022-01-07 08:58:47 -06:00
Zach Rice 44d7d89e19 always write sarif results 2021-12-28 19:13:26 -06:00
Zachary Rice aae23acff3 limit goroutines on file scanning to avoid pegging them cores (#759) 2021-12-21 18:10:29 -06:00
Zachary Rice 705595aaf6 Adding Typeform to sponsorships 2021-12-21 08:26:47 -06:00
Zachary Rice 43ec22429f write a report regardless if leaks are present (#758) 2021-12-17 17:26:14 -06:00
Zachary Rice 36779df3bb stricter ionic regex for less fps (#757) 2021-12-17 10:13:44 -06:00
Zachary Rice 3d3d801729 fixing eof location bug (#756) 2021-12-17 09:49:12 -06:00
Zachary Rice 0f2ffee6f9 Adding Tines sponsorship to readme 2021-12-16 10:39:45 -06:00
Andrzej Amghar f4d37a2c0d fix regexp for aws_key and slack_webhook (#754) 2021-12-16 07:48:18 -06:00
Zachary Rice be5596df1d Update README.md 2021-12-12 13:38:43 -06:00
Zachary Rice e97f26bb5f better asciinema 2021-12-12 13:36:57 -06:00
Zachary Rice ae13c96df8 Update README.md 2021-12-12 13:19:58 -06:00
Zachary Rice d15dfdc387 Update README.md 2021-12-12 13:19:06 -06:00
Zach Rice 631d8dcf03 bump go-gitdiff 2021-12-12 12:23:59 -06:00
Zachary Rice 192b96289f do not fail on git rename warning (#750) 2021-12-12 11:43:03 -06:00
Zachary Rice b8141713e8 add pre-commit instructions (#749) 2021-12-10 18:08:31 -06:00
Zachary Rice 3fedf6f8e7 remove writing default config, introduce GITLEAKS_CONFIG (#746)
* remove writing default config, introduce GITLEAKS_CONFIG

* setting report format default to json, update readme
2021-12-09 09:21:17 -06:00
Zach Rice 6f6ebd454f fix off by one line number for --no-git 2021-12-08 15:04:32 -06:00
Zachary Rice ce42947cae fix deduplication issue caused by clobbered findings (#742)
* fix deduplication issue caused by clobbered findings

* fix index

* remove indexing, slow is better than wrong
2021-12-07 19:11:37 -06:00
Zach Rice 84e285e4ce ignore gitleaks.toml by default 2021-12-06 10:43:21 -06:00
Ben Randall 928c6a6043 Update pre-commit step to run gitleaks checks (#729)
* Fix pre-commit config.

* Debug output

* No debug and use redacted.

* Typo

* Add back staged.

* Update .pre-commit-hooks.yaml

* Update .pre-commit-hooks.yaml
2021-12-03 16:09:05 -06:00
Florian Greinacher 106897fdf0 fix: format dates in log in a portable way (#735)
The output of time.String() depends on the runtime environment and should only be used for debugging.

This commit ensures that a well-defined UTC time is written to the report.
2021-12-03 09:34:57 -06:00
Zachary Rice 98d5648f6e introducing secretGroup, the best group (#734)
* working on deduping

* my eyes... oh god my poor eyes

* more readme

* more readme

* more readme

* more readme and formatting
2021-12-02 20:04:36 -06:00
zricethezav 9358e84588 fix typo in readme 2021-12-02 13:55:43 -06:00
zricethezav 958c18f0b7 fix typo in config help 2021-12-02 13:44:39 -06:00
Zachary Rice 089639e9fb bump go-gitdiff (#731) 2021-12-02 08:29:38 -06:00
Zachary Rice 85afd767f7 Update README.md 2021-12-01 18:38:22 -06:00
Zachary Rice 38006fb93b Update README.md 2021-11-30 14:31:08 -06:00
Zachary Rice 9ae1def963 lil hack to avoid scans 'finishing' when git errors are present (#726) 2021-11-30 12:31:25 -06:00
Zachary Rice 6517900e5a Update README.md 2021-11-30 12:24:10 -06:00
Zachary Rice 5e51da600b use exit code 126 on 'unknown-flag' errors (#723) 2021-11-30 09:47:00 -06:00
Zachary Rice f0b8d26c99 Update README.md 2021-11-27 10:40:00 -06:00
Zachary Rice 1724591029 remove generic api key from default gitleaks config (#719) 2021-11-27 10:01:52 -06:00
Zachary Rice 80d29764a0 add global regex check (#717) 2021-11-25 11:17:03 -06:00
Zachary Rice f498b1d308 Commit debug log (#716)
* adding debug log for number of commits scanned

* change debug text

* readd commitsha
2021-11-25 10:46:47 -06:00
Joost Voskuil 8eabfd614e Update sarif.go (#713)
* Update sarif.go

Provide correct version information for Sarif Reports

* Update test

Set version to correct Sarif version
2021-11-25 10:46:31 -06:00
Zachary Rice 4acd7a3c8d adding logic to ignore gitleaks config during scans (#710) 2021-11-24 20:27:19 -06:00
zricethezav a37822dffd remove --show-pulls from git log 2021-11-24 08:06:13 -06:00
Zachary Rice 1c6b28aa61 removing --simplify-merges and --show-pulls (#707) 2021-11-24 07:30:59 -06:00
Zachary Rice f15b4e408b Update README.md 2021-11-22 14:25:42 -06:00
Zachary Rice d5f9d2b5d2 Update README.md 2021-11-22 14:25:06 -06:00
zricethezav 67a7069bb8 trying again 2021-11-22 12:15:31 -06:00
zricethezav fd5d786538 override version in goreleaser 2021-11-22 12:11:02 -06:00
zricethezav c017b763f3 actually we gonna use git describe for docker build 2021-11-22 11:46:24 -06:00
zricethezav e796458763 remove sorting tags 2021-11-22 11:29:31 -06:00
zricethezav 2a9fbbc64d remove git fetch tag from docker build process, already available 2021-11-22 11:21:55 -06:00
zricethezav d6081d0cc4 actually use github.actor 2021-11-22 11:09:08 -06:00
zricethezav e6c3a495ce hardcode username to avoid redaction in action 2021-11-22 11:07:40 -06:00
Zachary Rice 93f292c3df Introducing v8.0.0 changes (#701)
* Introducing v8.0.0 changes
2021-11-22 10:43:51 -06:00
Ramon 780fb4a8f1 Merge pull request #653 from w0rmr1d3r/document_issue_638
Updating documentation on how to build the docker image (issue #638)
2021-10-28 08:50:04 +02:00
Ramon 0d9ab37ba4 Merge pull request #678 from ihassanyousaf/patch-1
fix possible typo in README.md `leaves` had been written instead of `leaks`
2021-10-28 08:48:52 +02:00
Ramon acffe44440 Merge pull request #658 from w0rmr1d3r/update_pre-commit_example
Update readme
2021-10-28 08:48:37 +02:00
M.Hassan Yousaf 178f78fa14 fix possible typo in README.md 2021-10-27 19:07:21 +02:00
Ramon 1ab1ae0e70 Merge pull request #673 from dirkaholic/fix/issue-672
Update regex for AWS secret key (issue #672)
2021-10-26 15:43:47 +02:00
Dirk Pahl 9f8ca91b8b Adjust AWS secret key rule 2021-10-26 15:09:42 +02:00
Dirk Pahl eec6c5a391 Fix tests with existing AWS secret keys 2021-10-26 13:29:36 +02:00
Dirk Pahl 714c0bef1e Update regex for AWS secret key 2021-10-26 12:35:35 +02:00
Ramon e9b699dda1 Merge branch 'master' of https://github.com/w0rmr1d3r/gitleaks into update_pre-commit_example
 Conflicts:
	README.md
2021-10-19 14:57:53 +02:00
Ramon 5afe59d2fa Merge pull request #662 from lucas-apd/patch-1
ADD_installation_from_bin
2021-10-19 14:54:11 +02:00
Lucas Alcântara 8adf27b1ea Update README.md 2021-10-19 09:50:39 -03:00
Ramon aecd32075e Merge pull request #665 from krsche/feature/fix-typo-in-readme
fix: typo in readme
2021-10-19 09:44:36 +02:00
Fabian Kirschner 290118cbbe fix: typo in readme 2021-10-14 22:12:24 +02:00
Lucas Alcântara d2e1e43a25 ADD_installation_from_bin
ADD_installation_from_bin
2021-10-13 16:41:36 -03:00
Ramon 2161ff358b Merge pull request #654 from nickrussler/master
Bump alpine to v3.14.2
2021-10-11 08:19:22 +02:00
Ramon f338bc584f Merge pull request #558 from AmitHofree/fix_default_config
Removed unnecessary backslashes in default config
2021-10-11 08:17:17 +02:00
Ramon e6a132bf4f Merge pull request #660 from GrahlmanMatthew/master
Fixed bug in extractLine function which was returning incorrect line # …
2021-10-11 08:16:57 +02:00
Ramon 8625cc30db Merge pull request #661 from danielorihuela/fix/loading-csv-reports-in-excel-with-commits-with-new-lines-characters
fix: csv report in excel
2021-10-11 08:16:33 +02:00
Matthew E. Grahlman 7cc3d7e467 Fix for Windows OS 2021-10-10 17:27:45 -04:00
Matthew E. Grahlman b8ff5eec73 Had to re-add testdata/ folder to project in order to get scan tests passing on Windows 2021-10-10 16:40:13 -04:00
Matthew E. Grahlman 36a4871585 Made changes to add support for cross-platform (os) testing as tests would pass on MacOS but no Windows 2021-10-10 16:38:24 -04:00
amith-legit c85ebbb2ba Try to revert index file 2021-10-10 22:51:54 +03:00
amith-legit 3a3e13c3b5 Added EOL to sample file 2021-10-10 22:51:44 +03:00
dani 14a00e1ffd chore: lint code 2021-10-10 12:47:46 +02:00
Ramon bd707fa9c4 fix: csv report in excel 2021-10-10 12:45:35 +02:00
Ramon 5e6b1840df Merge pull request #659 from chenrui333/add-apple-m1-support
build: add apple m1 support
2021-10-10 11:41:37 +02:00
Matthew E. Grahlman d8e3a694f2 Fixed bug in extractLine function which was returning incorrect line # when the line contains multiple vuln types 2021-10-09 10:55:39 -04:00
Rui Chen 05e3462025 build: add apple m1 support
Signed-off-by: Rui Chen <rui@chenrui.dev>
2021-10-08 16:53:52 -04:00
AmitHofree b83fe80968 Merge branch 'master' into fix_default_config 2021-10-08 22:26:35 +03:00
Ramon 5db0159c52 update readme 2021-10-08 15:05:34 +02:00
Nick Russler 5f87c4137c Bump alpine to v3.14.2
This alpine release includes fixes for openssl CVE-2021-3711 and CVE-2021-3712
2021-10-04 21:51:59 +02:00
Ramon ea94318ba3 updating documentation on how to build the docker image 2021-10-04 12:48:15 +02:00
Dustin Shimonoanddustin 3128789777 Add clarification in README.md that Go 1.16+ required. (#651)
* fix: fix the multiple scan executions from pre-commit hook

* docs: add clarification note about Go version required\

Ref 646

Co-authored-by: dustin <dustinshimono@gmail.com>
2021-09-30 11:00:21 -05:00
Dustin Shimonoanddustin 270207e5eb fix: fix the multiple scan executions from pre-commit hook (#649)
Co-authored-by: dustin <dustinshimono@gmail.com>
2021-09-30 09:49:09 -05:00
Ramon efe96640fc Merge pull request #645 from b-abderrahmane/patch-1
Fixed minor typo in Readme.md
2021-09-26 18:59:43 +02:00
b-abderrahmane 0137637c2c Fixed typo in Readme.md
Fixed description of main example rule
2021-09-25 11:14:52 +02:00
Zachary Rice 6adc045580 Simplify tests and continue on object not found errors (#633)
* adding files

* init better tests

* add basic .git

* more tests and test data

* nogit, unstaged tests

* removing unused testdata

* adding empty testdata

* rm gitmodules

* fixing tests

* remove with config

* adding with_config

* removing old test_data, updating config tests

* removing hooks in testdata repos
2021-09-09 11:46:31 -05:00
amith-legit 45c898c5ea Added a test for fixed Google and Square config 2021-09-09 11:29:34 +03:00
Ramon 95f8bd0daa Merge pull request #631 from EliSchleifer/elischleifer/fix-readme
Fix README link
2021-09-09 09:54:48 +02:00
Eli Schleifer 2cc2519302 Fix README link
Fix up readme link
2021-09-09 00:06:48 -07:00
amith-legit be13bba64c Merge branch 'master' into fix_default_config 2021-09-09 10:02:53 +03:00
Ramon 7111a698c0 Merge pull request #621 from Ido-DY/master
fix(git-symlink-new-repo): fix handling symbolic links in new git repo
2021-09-08 11:00:58 +02:00
Zachary Rice 8b9092a248 Create README.md 2021-09-07 15:29:56 -05:00
Ramon 0aa05133a9 Merge pull request #627 from w0rmr1d3r/update_documentation
Update documentation
2021-09-07 15:32:37 +02:00
Ramon 2952df5432 update documentation 2021-09-07 08:44:46 +02:00
Zachary Rice 541e26b067 Update FUNDING.yml 2021-09-06 16:51:38 -05:00
Eddie Austinandeddie-northcutt-wfp0 6018a6bb70 No longer generate empty reports (#577)
* return nil when no leaks found and lowercase report format option (#3)

* lowercase format options for consistency

* lowercase report format description

Co-authored-by: eddie-northcutt-wfp0 <eddie.northcutt.wfp0@statefarm.com>
2021-09-06 16:39:50 -05:00
Zachary Rice ca987b3842 Update README.md 2021-09-04 19:27:44 -05:00
Ido Markovitz 67f8d28d7f fix(git-symlink-files): fix handling symbolic links in unstaged changes 2021-09-04 11:10:53 +03:00
Ido-DY f88abe99d7 Merge branch 'zricethezav:master' into master 2021-09-04 10:36:26 +03:00
Zachary Rice 6ddf27c5c3 Fix premature exit for nogit scans, limit goroutines (#619)
* fix premature exit on nogit scan, actually limit concurreny for nogit

* removing files scanned log
2021-09-03 19:32:33 -05:00
Zachary Rice aadd9387b2 Create maintenance.md 2021-09-03 11:01:05 -05:00
Zachary Rice 0fd68c901d GitHub test (#617)
* drop travis

* remove travis

* rename, use example

* typo

* different syntax

* rename to test

* split test and build into two jobs

* add gosec job

* drop gosec for now
2021-09-03 08:41:17 -05:00
zricethezav 17a3943afe bump golang docker version 2021-09-02 14:44:58 -05:00
Zachary Rice abc73e2443 use embed pkg for default config, update deps (#616) 2021-09-02 14:42:14 -05:00
Zachary Rice 3c1751e5c4 Update alpine, use gitleaks user instead of root (#615)
* Updating alpine, use gitleaks user instead of root

* remove comments
2021-09-02 10:21:22 -05:00
Ido-DY a32ef6afc4 fix(git-symlink-commits): fix handling symbolic links in a git repository (#612) 2021-09-02 09:35:38 -05:00
rotem-cider 127df8a6f0 Updated RuleId in Sarif (#613) 2021-09-02 09:34:45 -05:00
Ivan Kalita aa91fd3e5e Fix default twitter rules (#614)
Regexps for default Twitter rules ("Twitter Secret Key" and "Twitter Client
ID") have a small flaw that make the default configuration vulnerable to
some false-positives.

I believe these rules should detect the cases like (SOME_CLIENT_ID should
be longer):
```
"twitter_client_id": "SOME_CLIENT_ID"
```

However, currently the twitter rules also detect the false positives for the
cases like:
```
someObj := twitter.NewObjectWithALongName()
config.Twitter.DomainAccessToken
```

I'm trying to address this issue the similar way it's done for facebook client
ids and AWS secret keys, where the secret is expected to be quoted.
2021-09-02 09:26:01 -05:00
Ido Markovitz c8e97d97f9 fix(git-symlink-commits): fix handling symbolic links in a git repository 2021-08-29 15:02:37 +03:00
Emma Sax 67e3603ba4 Remove --commit-from and --commit-to from docs (#605) 2021-08-20 12:18:27 -05:00
Tomasz Wierzchowski f62617d7a6 Update type in config example (#597) 2021-08-13 08:42:31 -05:00
Zachary Rice 9324184c24 Update README.md 2021-08-13 08:29:42 -05:00
Zachary Rice a80ce0d251 Update README.md 2021-07-29 17:40:34 -05:00
Ramon c1c4a93f98 Fix issue #523 (#561)
* updating documentation regarding issue #523

* improving README.md file
2021-05-10 11:39:09 -05:00
Norman Ziegner e74e6292ee Fix example in leaky-repo.toml (#559)
Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>
2021-05-07 09:08:03 -04:00
Tomy Guichard 25c3e92c2a SSH auth: Add custom username support (#536)
* Add support for custom username when using SSH auth
Previously, the user "git" was hard-coded
This commit also adds support for ssh:// URLs

* Add comment to explain username parsing
2021-05-05 12:30:12 -04:00
Zachary Rice 9ab424172d Update README.md 2021-05-05 09:22:56 -04:00
zricethezav 28fd47e170 Bump version for pre-commit 2021-05-05 09:10:47 -04:00
bplaxco 8250e40a75 Include offenderEntropy in the JSON output (#549)
* Pass the entropy data back to the Leak struct

Do this to make it easier to tune entropy checks and make decisions in
systems consuming the output.

~ B'ezrat Hashem ~

* Return negative number when entropy not checked

That way you can tell the difference between not checking or an
actual entropy level of 0

~ B'ezrat Hashem ~

* Make sure to handle range checks properly

Make sure to show when something had an entropy returned but was outside
range, or didn't have a hit at all, etc...

~ B'zrat Hashem ~

* Add a few doc strings

Follow the project's conventiona add a comment above the methods

~ B'ezrat Hashem ~

* Update tests and get them to pass

~ B'ezrat Hashem ~

* Remove checked in `.got` files

~ B'ezrat Hashem ~

* Add `*.got` to the `.gitignore`

Make sure the test output files aren't checked-in

~ B'ezrat Hashem ~
2021-05-03 20:22:20 -04:00
AmitHofree f735c9a5c9 Removed unnecessary backslashes 2021-05-02 15:47:05 +03:00
Pavel Shklovsky e7553b0168 Add pre-commit support (#552)
* Add pre-commit support

* Update README.md
2021-04-22 18:37:28 -04:00
Zachary Rice 12d276acd7 Bug 553 global allowlist (#554)
* add global file check

* rm whitespace
2021-04-22 18:07:07 -04:00
Pavel Shklovsky e6934bf0a5 Docker-based pre-commit configuration example (#551)
* Docker-based pre-commit configuration example

* Docker-based pre-commit configuration example
2021-04-21 12:58:03 -04:00
Zachary Rice 6f5ad9dc0b Update README.md 2021-04-12 11:07:28 -04:00
Zachary Rice a2019a4782 Update README.md 2021-04-09 14:21:15 -04:00
zricethezav 5d7b7718ec splitting out github rules and retabbing 2021-04-09 14:07:23 -04:00
Zachary Rice 190877a24b Pypi GitHub rules (#546)
* adding pypi and basic azure rules

* Adding new github format
2021-04-08 16:34:08 -04:00
mercurieteandmercuriete 144362b972 docs(Dockerfile): Fix example of usage on Dockerfile (#545)
* Closes #544

Co-authored-by: mercuriete <mercuriete@gmail.com>
2021-04-08 10:23:03 -04:00
Zachary Rice d353ac5108 Update README.md 2021-04-06 14:42:44 -04:00
Zachary Rice a27a08904a Update README.md 2021-03-05 16:40:07 -05:00
Zachary Rice 5ef4e336ce Update README.md 2021-03-05 16:39:23 -05:00
zricethezav 78f2c46517 Consistency in options 2021-03-05 16:19:24 -05:00
Kai bdcb9e33a8 Update SARIF output to return empty array if no results were found (#530) 2021-03-05 16:10:53 -05:00
Zachary Rice 6e4e9df55f stricter regex for github token (#535) 2021-03-05 16:10:04 -05:00
Zachary Rice b3bed5658d adding recover for patch generation (#534) 2021-03-05 16:00:41 -05:00
eddie-northcutt-wfp0 a10ae91ba7 v7.x Update - Add ability to append repo configurations, and user supplied configurations to the specified or default configuration (#487)
* Update merge configuration changes for  Gitleaks 7.x

* Change merge to append, and did some clean up
2021-03-05 15:09:10 -05:00
Zachary Rice a8dbc7f107 Update README.md 2021-02-25 16:33:24 -05:00
erikaweir 4544156b44 Copy edits to Readme.md (#529)
* Update README.md

* Update README.md

* Update README.md
2021-02-19 18:01:31 -05:00
Rahul sharma b52e8c9c7c Slack Webhook Match (#527) 2021-02-19 13:05:25 -05:00
rui 0ce1249b95 chore(deps): bump go to v1.16 (#525)
Signed-off-by: Rui Chen <rui@chenrui.dev>
2021-02-18 09:14:10 -05:00
Zachary Rice 3932ed6baf --no-git should report relative path to --path (#519) 2021-02-03 13:48:59 -05:00
Zachary Rice 981b636920 gitter chat 2021-02-02 17:27:24 -05:00
Kai c8e15c731a Always generate a report if --report is enabled (#508) 2021-01-26 07:59:51 -05:00
Zachary Rice 901f932a89 Add file type checking for unstaged commits (#512) 2021-01-22 11:49:21 -05:00
seb-elttamandSeb Elttam c0a9580a65 Fix dotgit regex again (#507)
* fix dotgit regex again

* Revert accidentally modified files

Co-authored-by: Seb Elttam <seb@elttam.com>
2021-01-21 15:31:21 -05:00
Paweł Kowalczyk 8be91eea5d Add exit code 1 on invalid usage, fixes #500 (#501) 2021-01-10 09:34:31 -05:00
Zachary Rice 1c6f2252b8 Update README.md 2020-12-11 20:55:32 -05:00
Zachary RiceandZach Rice 58d130c5f3 Quiet flag (#491)
* Adding a quiet option

* better description

Co-authored-by: Zach Rice <zrice@gitlab.com>
2020-12-11 09:56:09 -05:00
Zachary Rice 091ea81e68 nosec gosec (#490) 2020-12-10 22:32:32 -05:00
Zachary Rice f036dce6ab Dotgit bug (#488)
* fix allowlist bug

* Adding new repo for testing allowlisting

* adding additional constraints on the dotgit regex
2020-12-10 17:41:26 -05:00
Zachary Rice 2d58f1f94e Files at commit allow list bug (#485)
* fix allowlist bug

* Adding new repo for testing allowlisting

* Adding missing allowlist checks for commits and files/paths
2020-12-09 15:55:01 -05:00
Zachary Rice 86cfe0848b Allow list bugs (#484)
* fix allowlist bug
2020-12-09 13:21:15 -05:00
Zachary Rice 973d74e592 Update README.md 2020-12-08 20:55:53 -05:00
Zachary Rice 3909ebe03b Exit code update, introduce leaks-exit-code flag (#481) 2020-12-08 17:41:02 -05:00
Zachary Rice 65f42020af Go repo scan (#480)
* Real fast

* Addressing some golint stuff
2020-12-08 17:22:28 -05:00
Zachary Rice 65a91ae976 Removing base scanner (#477) 2020-12-08 09:24:38 -05:00
Zachary Rice 7db08bfd90 Bugs v7 (#475)
* fixing some v7 bugs
2020-12-05 11:57:43 -05:00
Matt Bartel af26553292 Performance improvement for uncommitted files (#463)
* attempt to use 'git status' when scanning uncommitted files

* fix comment

* correct copy/rename handling

* use 'git status' for unstaged changes
2020-12-04 18:08:27 -05:00
Zachary Rice d5e431e7d4 Update README.md 2020-12-03 17:20:46 -05:00
Zachary Rice 54ba3ec377 Update README.md 2020-12-03 17:09:59 -05:00
Zachary Rice 656ef1c9a7 Update README.md 2020-12-03 16:56:16 -05:00
zricethezav b8accd7273 rm unimplemented cleanpath option 2020-12-03 15:43:06 -05:00
zricethezav 238c31beaa Merge branch 'master' of github.com:zricethezav/gitleaks into master 2020-12-03 10:08:41 -05:00
Zachary Rice eb31190f31 Removing limiting line/offender length (#470) 2020-12-03 09:32:57 -05:00
zricethezav 389d45e380 Removing limiting line/offender length 2020-12-03 09:28:30 -05:00
zricethezav 81b3a6e279 Update readme 2020-12-02 17:11:47 -05:00
Zachary Rice c50906373c update to V7 (#469) 2020-12-02 17:07:31 -05:00
Zachary Rice 40545fb680 Need to include offender in line extraction memoization (#466) 2020-11-21 15:49:59 -05:00
Daniel Paul SearlesandDaniel Paul Searles 2acc34dfdf Add support for reportGroup (#456)
Why:

* There are times where it would be nice to have a group from the regex
  reported rather than the complete match.

This change addresses the need by:

* Add the reportGroup configuration option for a rule.
* Update scan.CheckRules to return the reportGroup if set.

Co-authored-by: Daniel Paul Searles <dsearles@gitlab.com>
2020-11-03 15:15:48 -05:00
zricethezav ede68fd95d fix off by one 2020-09-02 08:36:19 -04:00
Zachary Rice 6c60c3dde3 Adding some logic to fix line number extractor when there are multipl… (#436)
* Adding some logic to fix line number extractor when there are multiple secrets of the same offender within the same patch

* formatting some consts
2020-09-01 20:48:43 -04:00
Zachary Rice ad505754fc Add commits and commits-file option (#433) 2020-08-31 10:29:04 -04:00
Zachary Rice 21d81879e2 Update README.md 2020-08-27 14:11:11 -04:00
Lars Lehtonen b5ca2ba614 scan: fix dropped errors (#424) 2020-08-20 15:42:42 -04:00
Zachary Rice ef4655fcf1 Sarif (#421)
* init

* more work

* more sarif work

* mergin
2020-08-12 18:07:24 -04:00
Zachary Rice 01b553a75d Update Makefile 2020-08-12 17:51:56 -04:00
Zachary Rice fae366a404 Global allowlist regex (#422)
* work in progress

* Update test configs

* adding test

* golint and change to allowlist

* fix race condition, this mistakenly got committed

* Updating tests and examples

* bump to v6 as this is a breaking change to the config

* More consistent variables
2020-08-12 17:18:25 -04:00
Lars Lehtonen 6129b1a15d hosts: dropped error (#417) 2020-07-31 08:45:47 -04:00
Manuel Jeckelmann 31d03a1146 Clean up 'uncommitted' diff. (#416) 2020-07-28 08:55:33 -04:00
Zachary Rice eabc7b5c12 Fixing merge commit scans and large patch rule checking (#414)
* Fixing merge commit scans and large patch rule checking

* Adding tests for merge request scans
2020-07-25 14:55:59 -04:00
zricethezav 1dc7569f95 removing extra log import... 2020-07-24 14:42:54 -04:00
zricethezav 1797e9c966 Merge branch 'master' of github.com:zricethezav/gitleaks 2020-07-24 14:07:25 -04:00
zricethezav e2eaceb4cd rm bad example config 2020-07-24 14:07:00 -04:00
Zachary Rice c637b129ec Validate config (#412)
* validate config

* fix import fmt

* cleaning
2020-07-24 14:02:48 -04:00
zricethezav 8470e43d7f validate config 2020-07-24 13:54:01 -04:00
Zachary Rice 94f5950d68 Use allowlist (#411) 2020-07-24 11:58:43 -04:00
Zachary Rice fe69a17c9c Change remaining audits to scan (#410) 2020-07-24 11:30:33 -04:00
Zachary Rice 6ca7a11d88 Add line number to report plus some other things (#409)
* Init refactor

* think i got it working

* we got em

* Updating tests

* fixing tests

* Better comments, more test fixing

* Bumping to v5

* Fixing golint messages

* Replacing usage of audit with scan in comments

* bumping go-git

* Updating to v5 in some other spots
2020-07-24 10:49:03 -04:00
Zachary Rice cfbb600fcb Fixing patch direction and making additions the default (#408)
* Fixing patch direction and making additions the default

* adding test
2020-07-22 13:32:46 -04:00
Zachary Rice e36b550851 adding go mod/sum to ignore, adding quotes to aws secret rule (#397)
* adding go mod/sum to ignore, adding quotes to aws secret rule

* lil nicer formatting
2020-06-14 15:41:04 -04:00
zricethezav 2232dc191c removing bad options guard 2020-06-03 08:51:11 -04:00
Zachary Rice bdc688dd53 fix whitelist commits, added test (#390) 2020-05-31 10:25:58 -04:00
Steeve Barbeau e0f6399d5c Audit commits based on date/time parameters (#385)
* time based audit

* fixing SIGSEGV

* adding options for date and time format + tests

* Update repo.go

* Update github.go

* rebase + tests update
2020-05-24 18:03:47 -04:00
Zachary Rice 3e88ac6726 Update README.md 2020-05-20 15:48:53 -04:00
Zeyshi d0088f6c7c Update default.go (#382) 2020-05-14 17:27:35 -04:00
zricethezav 0d7c18cb39 fixing whitelist repo tests 2020-05-09 11:37:08 -04:00
zricethezav d0e98416b9 Merge branch 'master' of github.com:zricethezav/gitleaks 2020-05-09 11:24:06 -04:00
Zachary Rice b7438011b4 Rm generic from default (#379)
* fixing commit latest bug

* remove generic rule from default to reduce false positives
2020-05-09 11:21:17 -04:00
zricethezav 4e59d3bf19 Merge branch 'master' of github.com:zricethezav/gitleaks 2020-05-09 10:54:35 -04:00
Steeve Barbeau e4b26aea4a fixing issue #367 (#368) 2020-05-09 10:49:00 -04:00
Zachary Rice 473d0d55a7 Whitelist repo (#378)
* fixing commit latest bug

* bumping go-git and adding repo whitelist

* adding tests
2020-05-09 10:38:02 -04:00
Zachary Rice 8bd4649b01 Update leaky-repo.toml 2020-05-09 08:53:43 -04:00
zricethezav a69df84325 Merge branch 'master' of github.com:zricethezav/gitleaks 2020-05-09 08:51:58 -04:00
Marlon Pina Tojal 0faebdefea Whitelist files not being parsed (#375)
It seems that there is a typo on the default rules.
2020-05-04 10:56:27 -04:00
Zachary Rice a728e3abf3 Documentation upgrade (#374)
* fixing commit latest bug

* updating readme

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md
2020-04-28 17:43:01 -04:00
zricethezav e87c62fe72 Merge branch 'master' of github.com:zricethezav/gitleaks 2020-04-23 11:23:46 -04:00
Zachary Rice 4801818e3d fixing commit latest bug (#365) 2020-04-05 11:36:37 -04:00
zricethezav b4a0577786 fixing commit latest bug 2020-04-05 11:31:22 -04:00
Zachary Rice 212232f80a Empty repo audit (#364)
* bump to go 1.14 and alpine to 3.11

* audit before commit

* adding test

* rm hooks in test repo
2020-04-05 11:18:33 -04:00
Zachary Rice 11dcb44e41 bump to go 1.14 and alpine to 3.11 (#363) 2020-04-05 09:38:27 -04:00
Prabhu Subramanian af0df6ea2c Added gosec scan (#311) 2020-04-05 09:38:10 -04:00
Zachary Rice 9db91442b3 ignoring config when using custom config (#362) 2020-04-04 14:49:54 -04:00
Zachary Rice 9d76070806 Update README.md 2020-03-25 11:22:32 -04:00
Zachary Rice 2fa580f1bb fix the empty repo org scan error (#358) 2020-03-20 22:44:17 -04:00
Zach Stone c6f15b768e Improve default pattern configuration (#356)
* Add GCP, fix Mailgun format, and loosen format for other keys (don't require quotes)

* Add more match cases to generic credential pattern

* Fix quotation for valid toml

* Update tests
2020-03-20 21:14:30 -04:00
Zachary Rice 779937ca87 Update README.md 2020-03-06 18:59:03 -05:00
Zachary Rice 731856e974 Update README.md 2020-03-06 18:55:24 -05:00
Zachary Rice baf54631c7 Update README.md 2020-03-06 18:43:40 -05:00
zricethezav 3e760d7fed updating help message 2020-03-02 20:24:22 -05:00
Noel Algora 679f00dc9c Scan files at latest commit (#348)
* Inspect files at latest commit

Added option to scan files at latest commit

* Files at latest commit test
2020-03-02 20:22:14 -05:00
Zachary Rice dae5c142d7 Fix host clone auth (#350)
* trying auth fix

* fixing github private user auth and donate msg

* formatting

* go fmt...
2020-02-29 13:30:08 -05:00
Zachary Rice 8e8873286e Update leaky-repo.toml 2020-02-29 13:19:55 -05:00
Zachary Rice 6693cbdde3 Update README.md 2020-02-27 09:29:52 -05:00
Zachary Rice 8b3ce2cb1e forgot to bump in code... (#347) 2020-02-26 20:41:54 -05:00
Zachary Rice 94cae90d1e duplicate leak logic includes the line in hash (#345) 2020-02-26 17:38:16 -05:00
Noel Algora c4b07f5113 Add file regex support (#340)
* Modified Entropy to be able to apply it on regex match or specific capture group

* Config tests

* Small fixes on entropy ranges

* Fix toml configs
Fix tests

* Start adding support for rules with filename regex

Changed how config is parsed
Created new functions to inspect files and content

* File regex working

* Fixing tests and configs

* Implemented different regex for filename and filepath

* Fix comments

* Audit tests

* Config rename vars

* Fix audit tests

* Filename offender

* Indents and code styles

* Indents and code styles

* Removing bad test repo

* Adding test repo 6 for filename and filepath tests

* global whitelist path and fixes

* Fixes on tests and new test for global whitelisting paths

* Removing unused test

* Fix comment
2020-02-26 15:33:14 -05:00
Alexander Curtiss 01d73028f8 Fixed bug where the repo name was removed on a user or org audit. (#344) 2020-02-26 14:42:44 -05:00
Dmitry Ivanov 862f1203ed Minor formatting fix (#330) 2020-02-25 18:24:27 -05:00
Zachary Rice 581e81c16e Update README.md 2020-02-25 17:39:41 -05:00
Zachary Rice 6c166c9530 Update README.md 2020-02-25 17:32:40 -05:00
Zachary Rice 4181ede6cd Update FUNDING.yml 2020-02-25 11:55:18 -05:00
Zachary Rice 10745be661 fixing commit counts (#342)
* fixing commit counts

* fixing commit to test
2020-02-25 10:28:03 -05:00
Noel Algora ee2d73c740 Enhance entropy (#333)
* Modified Entropy to be able to apply it on regex match or specific capture group

* Config tests

* Small fixes on entropy ranges

* Fix toml configs
Fix tests

* Indents and code styles
2020-02-24 13:44:38 -05:00
zricethezav e7fbcf5333 updating readme and comments 2020-02-01 16:48:05 -05:00
Zachary Rice 2810eccc82 Merge pull request #329 from zricethezav/bug/commit-scan
Bug/commit scan
2020-02-01 11:38:02 -05:00
zricethezav baff419091 removing hooks 2020-02-01 11:23:11 -05:00
zricethezav d13e0fdfde adding more tests 2020-02-01 11:18:27 -05:00
zricethezav 5a300c3c64 fixing --commit bug, adding --files-at-commit option 2020-01-30 20:08:01 -05:00
Zachary Rice d8ddb9630a Merge pull request #327 from zricethezav/bug/timeoutcancel
Adding timeout check in context select so we dont log erroneously
2020-01-24 18:16:59 -05:00
zricethezav 1537eeb5fa Adding timeout check in context select so we dont log erroneously 2020-01-24 18:07:16 -05:00
Zachary Rice 1a492537dd Merge pull request #325 from zricethezav/bug/timeoutcancel
defer cancel in audit
2020-01-23 18:52:56 -05:00
zricethezav bd4107b002 ensuring cancel is called after audit is complete so context can be dropped 2020-01-23 18:47:37 -05:00
554 changed files with 17548 additions and 4778 deletions

No files matched your search

+8
View File
@@ -27,3 +27,11 @@ If applicable, add screenshots to help explain your problem.
Add any other context about the problem here.
cc @zricethezav
<!--
Check out the Secret Scanning Discord Server for live discussions:
https://discord.gg/sydS6AHTUP
--->
+16
View File
@@ -0,0 +1,16 @@
---
name: Maintenance request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Additional context**
Add any other context or screenshots about the feature request here.
cc @zricethezav
+14
View File
@@ -0,0 +1,14 @@
name: gitleaks
on: [push, workflow_dispatch]
jobs:
scan:
name: gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}}
+57
View File
@@ -0,0 +1,57 @@
name: Create and publish a Docker image
on:
release:
types: [published]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6
- name: Log in to Docker Hub
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
with:
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to the Container registry
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: |
zricethezav/gitleaks
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8
with:
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+26
View File
@@ -0,0 +1,26 @@
name: Test
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Build
run: go build -v ./...
- name: Test
run: make test
+10
View File
@@ -6,8 +6,18 @@
*.dylib
*.DS_STORE
*.idea
*.got
gitleaks
build
# configs
.gitleaks.toml
cmd/generate/config/gitleaks.toml
# test results
testdata/expected/report/*.got.*
# Test binary
*.out
dist/
+769
View File
@@ -0,0 +1,769 @@
418edf165dbb63d6f46993ae8f8818ffd87ea582:cmd/generate/config/rules/jwt.go:jwt:17
418edf165dbb63d6f46993ae8f8818ffd87ea582:cmd/generate/config/rules/jwt.go:jwt:19
525d9792b1e3670b4630b8fcc385ca22e8544f9b:cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:46
525d9792b1e3670b4630b8fcc385ca22e8544f9b:cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:48
525d9792b1e3670b4630b8fcc385ca22e8544f9b:cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:50
525d9792b1e3670b4630b8fcc385ca22e8544f9b:cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:52
525d9792b1e3670b4630b8fcc385ca22e8544f9b:cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:54
525d9792b1e3670b4630b8fcc385ca22e8544f9b:cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:55
525d9792b1e3670b4630b8fcc385ca22e8544f9b:cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:56
525d9792b1e3670b4630b8fcc385ca22e8544f9b:cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:57
525d9792b1e3670b4630b8fcc385ca22e8544f9b:cmd/generate/config/rules/sidekiq.go:sidekiq-secret:22
525d9792b1e3670b4630b8fcc385ca22e8544f9b:cmd/generate/config/rules/sidekiq.go:sidekiq-secret:23
525d9792b1e3670b4630b8fcc385ca22e8544f9b:cmd/generate/config/rules/sidekiq.go:sidekiq-secret:24
525d9792b1e3670b4630b8fcc385ca22e8544f9b:cmd/generate/config/rules/sidekiq.go:sidekiq-secret:28
525d9792b1e3670b4630b8fcc385ca22e8544f9b:cmd/generate/config/rules/sidekiq.go:sidekiq-secret:29
525d9792b1e3670b4630b8fcc385ca22e8544f9b:detect/detect_test.go:sidekiq-sensitive-url:164
525d9792b1e3670b4630b8fcc385ca22e8544f9b:detect/detect_test.go:sidekiq-sensitive-url:170
525d9792b1e3670b4630b8fcc385ca22e8544f9b:detect/detect_test.go:sidekiq-secret:120
525d9792b1e3670b4630b8fcc385ca22e8544f9b:detect/detect_test.go:sidekiq-secret:126
525d9792b1e3670b4630b8fcc385ca22e8544f9b:detect/detect_test.go:sidekiq-secret:142
31650f01e76858ce7a0490943426e84a0824bbc8:config/config_test.go:aws-access-token:31
5ed010c944ccc715cb9245abafd4e97d98d75e9f:config/config_test.go:aws-access-token:31
ad7509e3b47331ce9586743ace635422843b695b:cmd/generate/config/rules/privatekey.go:private-key:22
717cf1b10be1625875199eca8cdf48883348985f:README.md:aws-access-token:23
3474c58c9e25fe2b1cee855a35bd1bf8a8c0fae8:cmd/generate/config/rules/generic.go:clojars-api-token:38
a42b32bdf11b6f4ea5c32ec76a1731b4b0c5e52a:cmd/generate/config/rules/generic.go:generic-api-key:40
a42b32bdf11b6f4ea5c32ec76a1731b4b0c5e52a:cmd/generate/config/rules/generic.go:generic-api-key:41
3e5e63956ea770be734dcb7642cf515910154fb5:detect/detect_test.go:aws-access-token:50
3e5e63956ea770be734dcb7642cf515910154fb5:detect/detect_test.go:aws-access-token:60
3e5e63956ea770be734dcb7642cf515910154fb5:detect/detect_test.go:aws-access-token:61
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:pypi-upload-token:29
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:51
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:73
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:81
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:89
33082a996774ba4c8ad4ba26fd219d77497eb960:README.md:sidekiq-secret:43
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:discord-api-token:98
57d2d345b6b6ea220be9d99792b21a75359555c0:detect/detect_test.go:aws-access-token:235
57d2d345b6b6ea220be9d99792b21a75359555c0:detect/detect_test.go:aws-access-token:236
57d2d345b6b6ea220be9d99792b21a75359555c0:detect/detect_test.go:aws-access-token:253
57d2d345b6b6ea220be9d99792b21a75359555c0:detect/detect_test.go:aws-access-token:254
57d2d345b6b6ea220be9d99792b21a75359555c0:detect/detect_test.go:aws-access-token:278
57d2d345b6b6ea220be9d99792b21a75359555c0:detect/detect_test.go:aws-access-token:279
57d2d345b6b6ea220be9d99792b21a75359555c0:detect/detect_test.go:aws-access-token:343
57d2d345b6b6ea220be9d99792b21a75359555c0:detect/detect_test.go:aws-access-token:344
57d2d345b6b6ea220be9d99792b21a75359555c0:detect/detect_test.go:aws-access-token:362
57d2d345b6b6ea220be9d99792b21a75359555c0:detect/detect_test.go:aws-access-token:363
c9bc6b46087e700a42eb3492cf2053b7da4a6d9e:detect/detect_test.go:pypi-upload-token:27
c9bc6b46087e700a42eb3492cf2053b7da4a6d9e:detect/detect_test.go:aws-access-token:49
c9bc6b46087e700a42eb3492cf2053b7da4a6d9e:detect/detect_test.go:aws-access-token:71
c9bc6b46087e700a42eb3492cf2053b7da4a6d9e:detect/detect_test.go:aws-access-token:79
c9bc6b46087e700a42eb3492cf2053b7da4a6d9e:detect/detect_test.go:aws-access-token:87
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:discord-api-token:120
c9bc6b46087e700a42eb3492cf2053b7da4a6d9e:detect/detect_test.go:discord-api-token:96
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:discord-api-token:128
c9bc6b46087e700a42eb3492cf2053b7da4a6d9e:detect/detect_test.go:discord-api-token:118
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:discord-api-token:150
c9bc6b46087e700a42eb3492cf2053b7da4a6d9e:detect/detect_test.go:discord-api-token:126
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:discord-api-token:166
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:175
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:183
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:238
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:239
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:256
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:257
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:281
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:282
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:356
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:357
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:375
6e72472b6019d29eaa4b76b39700cd2418741f0c:detect/detect_test.go:aws-access-token:376
c9bc6b46087e700a42eb3492cf2053b7da4a6d9e:detect/detect_test.go:discord-api-token:148
17b5540fb16bd9816d2a3a83f65cedf5918eaf70:detect/detect_test.go:pypi-upload-token:27
17b5540fb16bd9816d2a3a83f65cedf5918eaf70:detect/detect_test.go:pypi-upload-token:32
17b5540fb16bd9816d2a3a83f65cedf5918eaf70:detect/detect_test.go:pypi-upload-token:33
c9bc6b46087e700a42eb3492cf2053b7da4a6d9e:detect/detect_test.go:discord-api-token:164
c9bc6b46087e700a42eb3492cf2053b7da4a6d9e:detect/detect_test.go:aws-access-token:173
c9bc6b46087e700a42eb3492cf2053b7da4a6d9e:detect/detect_test.go:aws-access-token:181
ce42947cae32cda8d5d8813c1a8ce82eb06f018e:detect/git_test.go:aws-access-token:43
ce42947cae32cda8d5d8813c1a8ce82eb06f018e:detect/git_test.go:aws-access-token:60
ce42947cae32cda8d5d8813c1a8ce82eb06f018e:detect/git_test.go:aws-access-token:85
b8141713e89f5acec500c7a62415f0f1cb7234dc:README.md:discord-client-secret:273
98d5648f6e54ea84ca915c73fff88ad3bc5809e0:README.md:aws-access-token:130
b8141713e89f5acec500c7a62415f0f1cb7234dc:README.md:discord-client-secret:289
98d5648f6e54ea84ca915c73fff88ad3bc5809e0:README.md:discord-client-secret:251
98d5648f6e54ea84ca915c73fff88ad3bc5809e0:README.md:discord-client-secret:267
98d5648f6e54ea84ca915c73fff88ad3bc5809e0:detect/detect_test.go:aws-access-token:33
98d5648f6e54ea84ca915c73fff88ad3bc5809e0:detect/files_test.go:aws-access-token:32
98d5648f6e54ea84ca915c73fff88ad3bc5809e0:detect/files_test.go:aws-access-token:50
98d5648f6e54ea84ca915c73fff88ad3bc5809e0:config/config_test.go:generic-api-key:133
80d29764a0bc0f269607d3eb7b2774a0f31e5da3:detect/detect_test.go:aws-access-token:123
80d29764a0bc0f269607d3eb7b2774a0f31e5da3:testdata/config/allow_global_aws_re.toml:aws-access-token:8
4acd7a3c8d20b7116a32f9bbade6a3cf15f741e4:detect/detect_test.go:aws-access-token:117
f0b8d26c9988af725132c100dda5051586a3026e:README.md:discord-client-secret:225
98d5648f6e54ea84ca915c73fff88ad3bc5809e0:config/config_test.go:generic-api-key:144
93f292c3dfa2649ef91f8925b623e79546fa992e:README.md:aws-access-token:121
93f292c3dfa2649ef91f8925b623e79546fa992e:README.md:aws-access-token:122
93f292c3dfa2649ef91f8925b623e79546fa992e:README.md:aws-access-token:157
93f292c3dfa2649ef91f8925b623e79546fa992e:config/config_test.go:aws-access-token:31
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/files_test.go:aws-access-token:32
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/files_test.go:aws-access-token:33
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/files_test.go:aws-access-token:50
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/files_test.go:aws-access-token:51
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/git_test.go:aws-access-token:42
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/git_test.go:aws-access-token:44
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/git_test.go:aws-access-token:58
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/git_test.go:aws-access-token:60
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/git_test.go:aws-access-token:82
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/git_test.go:aws-access-token:83
93f292c3dfa2649ef91f8925b623e79546fa992e:config/config_test.go:generic-api-key:133
93f292c3dfa2649ef91f8925b623e79546fa992e:testdata/config/allow_aws_re.toml:aws-access-token:9
93f292c3dfa2649ef91f8925b623e79546fa992e:config/config_test.go:generic-api-key:144
93f292c3dfa2649ef91f8925b623e79546fa992e:testdata/expected/git/small-branch-foo.txt:aws-access-token:15
93f292c3dfa2649ef91f8925b623e79546fa992e:testdata/repos/nogit/main.go:aws-access-token:20
93f292c3dfa2649ef91f8925b623e79546fa992e:testdata/expected/git/small.txt:aws-access-token:15
93f292c3dfa2649ef91f8925b623e79546fa992e:testdata/expected/git/small.txt:aws-access-token:44
3a3e13c3b5f85b0116cf2a0cd92529baf22d0ac9:testdata/repos/with_square_and_google/env:generic-api-key:3
6adc045580c3911a7a936be7b977979a5519aa29:scan/unstaged_test.go:aws-access-token:38
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_208ae46.json:aws-access-token:3
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_208ae46.json:aws-access-token:5
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_ae8db4a2_208ae46.json:aws-access-token:3
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_ae8db4a2_208ae46.json:aws-access-token:5
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results.json:aws-access-token:3
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results.json:aws-access-token:5
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results.json:aws-access-token:20
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results.json:aws-access-token:22
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_depth_1.json:aws-access-token:3
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_depth_1.json:aws-access-token:5
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_files_at_208ae46.json:aws-access-token:3
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_files_at_208ae46.json:aws-access-token:5
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_files_at_208ae46.json:aws-access-token:20
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_files_at_208ae46.json:aws-access-token:22
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_no_git.json:aws-access-token:3
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_no_git.json:aws-access-token:5
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/detect_test.go:aws-access-token:26
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/detect_test.go:aws-access-token:31
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/detect_test.go:aws-access-token:40
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/detect_test.go:aws-access-token:46
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/detect_test.go:aws-access-token:52
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/detect_test.go:discord-api-token:59
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/detect_test.go:discord-api-token:74
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/detect_test.go:discord-api-token:80
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/detect_test.go:discord-api-token:95
93f292c3dfa2649ef91f8925b623e79546fa992e:detect/detect_test.go:discord-api-token:109
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_no_git.json:aws-access-token:20
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_no_git.json:aws-access-token:22
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/basic/results_unstaged.json:aws-access-token:3
6adc045580c3911a7a936be7b977979a5519aa29:testdata/repos/basic/secrets.py:generic-api-key:5
6adc045580c3911a7a936be7b977979a5519aa29:testdata/repos/basic/secrets.py:generic-api-key:6
6adc045580c3911a7a936be7b977979a5519aa29:testdata/repos/basic/secrets.py:aws-access-token:9
6adc045580c3911a7a936be7b977979a5519aa29:testdata/repos/basic/secrets.py:aws-access-token:13
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results.json:aws-access-token:3
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results.json:aws-access-token:5
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results.json:aws-access-token:54
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results.json:aws-access-token:56
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results.json:generic-api-key:20
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results.json:generic-api-key:22
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results.json:generic-api-key:37
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results.json:generic-api-key:39
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results_e7c0aff3.json:generic-api-key:3
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results_e7c0aff3.json:generic-api-key:5
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results_e7c0aff3.json:generic-api-key:20
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results_e7c0aff3.json:generic-api-key:22
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results_e7c0aff3.json:aws-access-token:37
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results_e7c0aff3.json:aws-access-token:39
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results_ae8db4a_e7c0aff.json:aws-access-token:37
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results_ae8db4a_e7c0aff.json:aws-access-token:39
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results_ae8db4a_e7c0aff.json:generic-api-key:3
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results_ae8db4a_e7c0aff.json:generic-api-key:5
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results_ae8db4a_e7c0aff.json:generic-api-key:20
6adc045580c3911a7a936be7b977979a5519aa29:testdata/expect/with_config/results_ae8db4a_e7c0aff.json:generic-api-key:22
6adc045580c3911a7a936be7b977979a5519aa29:testdata/repos/with_config/secrets.py:generic-api-key:5
6adc045580c3911a7a936be7b977979a5519aa29:testdata/repos/with_config/secrets.py:generic-api-key:6
6adc045580c3911a7a936be7b977979a5519aa29:testdata/repos/with_config/secrets.py:aws-access-token:9
6adc045580c3911a7a936be7b977979a5519aa29:testdata/repos/with_config/secrets.py:aws-access-token:13
45c898c5ea56ee503a048c1bac1404cf63855edc:test_data/test_repos/test_dir_2/env:generic-api-key:1
45c898c5ea56ee503a048c1bac1404cf63855edc:test_data/test_repos/test_dir_2/env:generic-api-key:3
45c898c5ea56ee503a048c1bac1404cf63855edc:test_data/test_dir_one_google_leak_and_square_leak.json:generic-api-key:3
45c898c5ea56ee503a048c1bac1404cf63855edc:test_data/test_dir_one_google_leak_and_square_leak.json:generic-api-key:20
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:35
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:37
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:259
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:261
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:339
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:51
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:83
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:85
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:131
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:133
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:147
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:149
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:179
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:227
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:229
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:323
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:355
65f42020afcc65de3b7dfe5a797b9f6396345250:test_data/test_local_owner_aws_leak.json:aws-access-token:357
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_file1_aws_leak.json:aws-access-token:3
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_file1_aws_leak.json:aws-access-token:5
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_dir1_aws_leak.json:aws-access-token:3
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_dir1_aws_leak.json:aws-access-token:5
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_dir1_aws_leak.json:aws-access-token:17
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_dir1_aws_leak.json:aws-access-token:19
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_repos/test_dir_1/server.test.py:aws-access-token:5
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_repos/test_dir_1/server.test2.py:aws-access-token:5
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:99
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:101
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:115
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:117
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:131
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:133
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:147
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:149
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:163
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:165
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:179
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:181
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:195
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:197
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:211
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:213
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:83
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:85
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:99
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:101
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:115
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:117
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:131
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:133
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:147
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:149
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:163
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:165
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:179
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:259
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:261
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:181
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:195
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:197
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:339
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak.json:aws-access-token:341
2acc34dfdfb0e7f1141eadd940ea933c645e0f86:test_data/test_local_repo_three_leaks_with_report_groups.json:aws-access-token:3
2acc34dfdfb0e7f1141eadd940ea933c645e0f86:test_data/test_local_repo_three_leaks_with_report_groups.json:aws-access-token:5
2acc34dfdfb0e7f1141eadd940ea933c645e0f86:test_data/test_local_repo_three_leaks_with_report_groups.json:aws-access-token:18
2acc34dfdfb0e7f1141eadd940ea933c645e0f86:test_data/test_local_repo_three_leaks_with_report_groups.json:aws-access-token:20
2acc34dfdfb0e7f1141eadd940ea933c645e0f86:test_data/test_local_repo_three_leaks_with_report_groups.json:aws-access-token:33
2acc34dfdfb0e7f1141eadd940ea933c645e0f86:test_data/test_local_repo_three_leaks_with_report_groups.json:aws-access-token:35
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:259
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:261
ad505754fc6283523ef8dfa88ecb6559e0268ec3:test_data/test_local_repo_two_leaks_commit_to_from.json:aws-access-token:3
ad505754fc6283523ef8dfa88ecb6559e0268ec3:test_data/test_local_repo_two_leaks_commit_to_from.json:aws-access-token:5
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:323
c50906373cc38206f3d41c57e2c413ce400e61e7:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:325
ad505754fc6283523ef8dfa88ecb6559e0268ec3:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:18
ad505754fc6283523ef8dfa88ecb6559e0268ec3:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:20
fae366a404357fa6c6611756a11e61546ebec4e0:examples/simple_regex_and_allowlist_config.toml:aws-access-token:12
ad505754fc6283523ef8dfa88ecb6559e0268ec3:test_data/test_local_repo_two_leaks_file_commit_range.json:aws-access-token:3
ad505754fc6283523ef8dfa88ecb6559e0268ec3:test_data/test_local_repo_two_leaks_file_commit_range.json:aws-access-token:5
ad505754fc6283523ef8dfa88ecb6559e0268ec3:test_data/test_local_repo_two_leaks_file_commit_range.json:aws-access-token:18
ad505754fc6283523ef8dfa88ecb6559e0268ec3:test_data/test_local_repo_two_leaks_file_commit_range.json:aws-access-token:20
fae366a404357fa6c6611756a11e61546ebec4e0:test_data/test_configs/aws_key_aws_allowlisted.toml:aws-access-token:7
fae366a404357fa6c6611756a11e61546ebec4e0:test_data/test_local_owner_aws_leak.json:aws-access-token:185
fae366a404357fa6c6611756a11e61546ebec4e0:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:95
fae366a404357fa6c6611756a11e61546ebec4e0:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:185
fae366a404357fa6c6611756a11e61546ebec4e0:test_data/test_local_repo_nine_aws_leak.json:aws-access-token:3
fae366a404357fa6c6611756a11e61546ebec4e0:test_data/test_local_repo_nine_aws_leak.json:aws-access-token:5
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:78
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:80
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_owner_aws_leak.json:aws-access-token:138
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_owner_aws_leak.json:aws-access-token:140
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_owner_aws_leak.json:aws-access-token:153
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_owner_aws_leak.json:aws-access-token:155
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_owner_aws_leak.json:aws-access-token:168
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_owner_aws_leak.json:aws-access-token:170
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:138
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:140
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:153
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:155
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:168
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_owner_aws_leak_allowlist_repo.json:aws-access-token:170
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_repo_eight.json:aws-access-token:3
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_repo_eight.json:aws-access-token:5
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_repo_eight.json:aws-access-token:18
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_repo_eight.json:aws-access-token:20
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_repo_eight.json:aws-access-token:33
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_local_repo_eight.json:aws-access-token:35
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_repos/test_repo_8/dummy.txt:aws-access-token:2
eabc7b5c12cb89b4a828b7aaef00fdfa694a7e0a:test_data/test_repos/test_repo_8/dummy.txt:aws-access-token:6
6ca7a11d8846af2a3d26f71c4a9083eb0b3deeee:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:48
6ca7a11d8846af2a3d26f71c4a9083eb0b3deeee:test_data/test_local_owner_aws_leak.json:aws-access-token:48
6ca7a11d8846af2a3d26f71c4a9083eb0b3deeee:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:33
6ca7a11d8846af2a3d26f71c4a9083eb0b3deeee:test_data/test_local_owner_aws_leak.json:aws-access-token:93
6ca7a11d8846af2a3d26f71c4a9083eb0b3deeee:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:78
6ca7a11d8846af2a3d26f71c4a9083eb0b3deeee:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:18
6ca7a11d8846af2a3d26f71c4a9083eb0b3deeee:test_data/test_local_repo_three_leaks.json:aws-access-token:48
6ca7a11d8846af2a3d26f71c4a9083eb0b3deeee:test_data/test_local_repo_two_leaks_deletion.json:aws-access-token:78
6ca7a11d8846af2a3d26f71c4a9083eb0b3deeee:test_data/test_local_repo_two_leaks.json:aws-access-token:33
bdc688dd5351adf1cf5cbf734dfd104ea6bab92b:test_data/test_local_repo_two_whitelist_commits.json:aws-access-token:3
bdc688dd5351adf1cf5cbf734dfd104ea6bab92b:test_data/test_local_repo_two_whitelist_commits.json:aws-access-token:4
bdc688dd5351adf1cf5cbf734dfd104ea6bab92b:test_data/test_local_repo_two_whitelist_commits.json:aws-access-token:16
bdc688dd5351adf1cf5cbf734dfd104ea6bab92b:test_data/test_local_repo_two_whitelist_commits.json:aws-access-token:17
e0f6399d5ccadd44544cdfe5f630de57fced1473:test_data/test_local_repo_six_leaks_since_date.json:aws-access-token:3
e0f6399d5ccadd44544cdfe5f630de57fced1473:test_data/test_local_repo_six_leaks_since_date.json:aws-access-token:4
e0f6399d5ccadd44544cdfe5f630de57fced1473:test_data/test_local_repo_six_leaks_until_date.json:aws-access-token:3
e0f6399d5ccadd44544cdfe5f630de57fced1473:test_data/test_local_repo_six_leaks_until_date.json:aws-access-token:4
0d7c18cb39c60efb62a6c7b351f95d46ebe1f63e:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:172
0d7c18cb39c60efb62a6c7b351f95d46ebe1f63e:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:173
e0f6399d5ccadd44544cdfe5f630de57fced1473:test_data/test_local_repo_four_leaks_commit_timerange.json:aws-access-token:3
e0f6399d5ccadd44544cdfe5f630de57fced1473:test_data/test_local_repo_four_leaks_commit_timerange.json:aws-access-token:4
e0f6399d5ccadd44544cdfe5f630de57fced1473:test_data/test_local_repo_four_leaks_commit_timerange.json:aws-access-token:16
e0f6399d5ccadd44544cdfe5f630de57fced1473:test_data/test_local_repo_four_leaks_commit_timerange.json:aws-access-token:17
e0f6399d5ccadd44544cdfe5f630de57fced1473:test_data/test_local_repo_four_leaks_commit_timerange.json:aws-access-token:29
e0f6399d5ccadd44544cdfe5f630de57fced1473:test_data/test_local_repo_four_leaks_commit_timerange.json:aws-access-token:30
e0f6399d5ccadd44544cdfe5f630de57fced1473:test_data/test_local_repo_four_leaks_commit_timerange.json:aws-access-token:42
e0f6399d5ccadd44544cdfe5f630de57fced1473:test_data/test_local_repo_four_leaks_commit_timerange.json:aws-access-token:43
e0f6399d5ccadd44544cdfe5f630de57fced1473:test_data/test_local_repo_four_leaks_commit_timerange.json:aws-access-token:55
e0f6399d5ccadd44544cdfe5f630de57fced1473:test_data/test_local_repo_four_leaks_commit_timerange.json:aws-access-token:56
cfbb600fcb286e1323e2e4d24144eeca163ad396:test_data/test_local_repo_two_leaks_deletion.json:aws-access-token:3
cfbb600fcb286e1323e2e4d24144eeca163ad396:test_data/test_local_repo_two_leaks_deletion.json:aws-access-token:4
cfbb600fcb286e1323e2e4d24144eeca163ad396:test_data/test_local_repo_two_leaks_deletion.json:aws-access-token:16
cfbb600fcb286e1323e2e4d24144eeca163ad396:test_data/test_local_repo_two_leaks_deletion.json:aws-access-token:17
cfbb600fcb286e1323e2e4d24144eeca163ad396:test_data/test_local_repo_two_leaks_deletion.json:aws-access-token:29
cfbb600fcb286e1323e2e4d24144eeca163ad396:test_data/test_local_repo_two_leaks_deletion.json:aws-access-token:30
cfbb600fcb286e1323e2e4d24144eeca163ad396:test_data/test_local_repo_two_leaks_deletion.json:aws-access-token:42
cfbb600fcb286e1323e2e4d24144eeca163ad396:test_data/test_local_repo_two_leaks_deletion.json:aws-access-token:43
cfbb600fcb286e1323e2e4d24144eeca163ad396:test_data/test_local_repo_two_leaks_deletion.json:aws-access-token:55
cfbb600fcb286e1323e2e4d24144eeca163ad396:test_data/test_local_repo_two_leaks_deletion.json:aws-access-token:56
cfbb600fcb286e1323e2e4d24144eeca163ad396:test_data/test_local_repo_two_leaks_deletion.json:aws-access-token:68
cfbb600fcb286e1323e2e4d24144eeca163ad396:test_data/test_local_repo_two_leaks_deletion.json:aws-access-token:69
212232f80a22c4c698dd2864006f398ea1f15107:test_data/test_local_repo_seven_aws_leak_uncommitted.json:aws-access-token:3
212232f80a22c4c698dd2864006f398ea1f15107:test_data/test_local_repo_seven_aws_leak_uncommitted.json:aws-access-token:4
212232f80a22c4c698dd2864006f398ea1f15107:test_data/test_repos/test_repo_7/file:aws-access-token:5
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:16
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:17
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:55
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:56
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:16
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:17
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:94
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:95
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:55
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:56
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:134
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:160
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:94
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:95
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:133
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:134
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:172
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:173
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:3
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:4
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:16
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:17
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:29
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:30
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:42
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:43
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:55
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:56
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:68
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:69
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:81
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:82
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:94
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:95
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:107
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:108
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:120
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:121
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:133
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:134
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:146
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:147
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:159
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:160
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:172
473d0d55a71097894c5c6b9a2968ad478d2e6edf:test_data/test_local_owner_aws_leak_whitelist_repo.json:aws-access-token:173
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:185
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:186
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_five_files_at_commit.json:aws-access-token:29
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_five_files_at_commit.json:aws-access-token:30
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_five_files_at_commit.json:aws-access-token:42
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_five_files_at_commit.json:aws-access-token:43
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:224
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:225
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:211
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:212
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:263
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:264
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:237
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:238
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_one_aws_leak.json:aws-access-token:16
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_one_aws_leak.json:aws-access-token:17
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_one_aws_leak_commit.json:aws-access-token:16
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:276
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:277
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_one_aws_leak_commit.json:aws-access-token:17
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:316
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:342
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks.json:aws-access-token:16
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks.json:aws-access-token:17
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks.json:aws-access-token:55
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks.json:aws-access-token:56
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks.json:aws-access-token:95
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks.json:aws-access-token:121
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_five_files_at_latest_commit.json:aws-access-token:3
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_five_files_at_latest_commit.json:aws-access-token:4
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_five_files_at_latest_commit.json:aws-access-token:16
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_five_files_at_latest_commit.json:aws-access-token:17
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_five_files_at_latest_commit.json:aws-access-token:29
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_five_files_at_latest_commit.json:aws-access-token:30
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_five_files_at_latest_commit.json:aws-access-token:42
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_five_files_at_latest_commit.json:aws-access-token:43
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_one_aws_leak_uncommitted.json:aws-access-token:16
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_one_aws_leak_uncommitted.json:aws-access-token:17
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:17
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:43
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:17
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:43
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks.json:aws-access-token:146
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks.json:aws-access-token:147
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:380
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:381
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:406
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:407
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:445
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_owner_aws_leak.json:aws-access-token:446
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_to.json:aws-access-token:16
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_to.json:aws-access-token:17
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:68
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:69
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_to.json:aws-access-token:55
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_to.json:aws-access-token:56
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks.json:aws-access-token:172
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks.json:aws-access-token:173
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:68
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:69
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_to.json:aws-access-token:95
94cae90d1eb208410073669de54a21fb65f23742:test_data/test_local_owner_aws_leak.json:aws-access-token:120
94cae90d1eb208410073669de54a21fb65f23742:test_data/test_local_owner_aws_leak.json:aws-access-token:121
94cae90d1eb208410073669de54a21fb65f23742:test_data/test_local_repo_two_leaks.json:aws-access-token:107
94cae90d1eb208410073669de54a21fb65f23742:test_data/test_local_repo_two_leaks.json:aws-access-token:108
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:94
c6f15b768e19613228b232a712f53a39cc5120a3:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:95
94cae90d1eb208410073669de54a21fb65f23742:test_data/test_local_repo_three_leaks.json:aws-access-token:81
94cae90d1eb208410073669de54a21fb65f23742:test_data/test_local_repo_three_leaks.json:aws-access-token:82
c4b07f5113bf39019374579a64d83959236295e4:audit/util.go:aws-access-token:66
94cae90d1eb208410073669de54a21fb65f23742:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:55
94cae90d1eb208410073669de54a21fb65f23742:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:56
94cae90d1eb208410073669de54a21fb65f23742:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:55
94cae90d1eb208410073669de54a21fb65f23742:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:56
c4b07f5113bf39019374579a64d83959236295e4:test_data/test_local_owner_aws_leak.json:aws-access-token:276
c4b07f5113bf39019374579a64d83959236295e4:test_data/test_local_owner_aws_leak.json:aws-access-token:277
c4b07f5113bf39019374579a64d83959236295e4:test_data/test_local_repo_one_aws_leak_and_file_leak.json:aws-access-token:16
c4b07f5113bf39019374579a64d83959236295e4:test_data/test_local_repo_one_aws_leak_and_file_leak.json:aws-access-token:17
c4b07f5113bf39019374579a64d83959236295e4:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:146
c4b07f5113bf39019374579a64d83959236295e4:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:147
c4b07f5113bf39019374579a64d83959236295e4:test_data/test_local_repo_six.json:aws-access-token:31
c4b07f5113bf39019374579a64d83959236295e4:test_data/test_local_repo_six.json:aws-access-token:33
c4b07f5113bf39019374579a64d83959236295e4:test_data/test_local_repo_six_filepath.json:aws-access-token:3
c4b07f5113bf39019374579a64d83959236295e4:test_data/test_local_repo_six_filepath.json:aws-access-token:4
c4b07f5113bf39019374579a64d83959236295e4:test_data/test_local_repo_six_path_globally_whitelisted.json:aws-access-token:3
c4b07f5113bf39019374579a64d83959236295e4:test_data/test_local_repo_six_path_globally_whitelisted.json:aws-access-token:4
c4b07f5113bf39019374579a64d83959236295e4:test_data/test_repos/test_repo_6/server.test.py:aws-access-token:5
10745be661121f2e6577170419cf8ce3308ae311:test_data/test_local_repo_two_leaks_commit_to.json:aws-access-token:55
10745be661121f2e6577170419cf8ce3308ae311:test_data/test_local_repo_two_leaks_commit_to.json:aws-access-token:56
10745be661121f2e6577170419cf8ce3308ae311:test_data/test_local_repo_two_leaks_commit_to.json:aws-access-token:68
10745be661121f2e6577170419cf8ce3308ae311:test_data/test_local_repo_two_leaks_commit_to.json:aws-access-token:69
c4b07f5113bf39019374579a64d83959236295e4:test_data/test_repos/test_repo_6/config/application.properties:aws-access-token:3
d13e0fdfde8f5c6261c9e893461f32861e21e8f5:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:133
d13e0fdfde8f5c6261c9e893461f32861e21e8f5:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:134
d13e0fdfde8f5c6261c9e893461f32861e21e8f5:test_data/test_local_owner_aws_leak.json:aws-access-token:250
d13e0fdfde8f5c6261c9e893461f32861e21e8f5:test_data/test_local_owner_aws_leak.json:aws-access-token:251
d13e0fdfde8f5c6261c9e893461f32861e21e8f5:test_data/test_local_owner_aws_leak.json:aws-access-token:263
d13e0fdfde8f5c6261c9e893461f32861e21e8f5:test_data/test_local_owner_aws_leak.json:aws-access-token:264
d13e0fdfde8f5c6261c9e893461f32861e21e8f5:test_data/test_local_repo_five_files_at_commit.json:aws-access-token:3
d13e0fdfde8f5c6261c9e893461f32861e21e8f5:test_data/test_local_repo_five_files_at_commit.json:aws-access-token:4
d13e0fdfde8f5c6261c9e893461f32861e21e8f5:test_data/test_local_repo_five_files_at_commit.json:aws-access-token:16
d13e0fdfde8f5c6261c9e893461f32861e21e8f5:test_data/test_local_repo_five_files_at_commit.json:aws-access-token:17
2474c39311296b4d48c284b1ce82e0c270854bde:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:3
2474c39311296b4d48c284b1ce82e0c270854bde:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:4
2474c39311296b4d48c284b1ce82e0c270854bde:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:16
2474c39311296b4d48c284b1ce82e0c270854bde:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:17
2474c39311296b4d48c284b1ce82e0c270854bde:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:42
2474c39311296b4d48c284b1ce82e0c270854bde:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:43
2474c39311296b4d48c284b1ce82e0c270854bde:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:68
2474c39311296b4d48c284b1ce82e0c270854bde:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:69
2474c39311296b4d48c284b1ce82e0c270854bde:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:94
2474c39311296b4d48c284b1ce82e0c270854bde:test_data/test_local_owner_aws_leak_depth_2.json:aws-access-token:95
d13e0fdfde8f5c6261c9e893461f32861e21e8f5:test_data/test_repos/test_repo_5/secrets.py:aws-access-token:1
d13e0fdfde8f5c6261c9e893461f32861e21e8f5:test_data/test_repos/test_repo_5/secrets.py:aws-access-token:4
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:3
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:4
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:16
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:17
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:29
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:30
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:42
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_range.json:aws-access-token:43
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_to.json:aws-access-token:3
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_to.json:aws-access-token:4
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_to.json:aws-access-token:29
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_to.json:aws-access-token:30
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:3
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:4
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:16
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:17
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:29
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:30
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:42
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:43
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:55
a0f72a4e3595ddb382a77804d2674d54b2b0e880:test_data/test_local_repo_two_leaks_commit_from.json:aws-access-token:56
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_repo_two_leaks.json:aws-access-token:68
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_repo_two_leaks.json:aws-access-token:69
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:81
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:82
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:107
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:108
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_repo_two_leaks.json:aws-access-token:94
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_repo_two_leaks.json:aws-access-token:95
6e1c41b536a514e1d17768eb42ebf5d87e61247d:examples/simple_regex_and_whitelist_config.toml:aws-access-token:4
6e1c41b536a514e1d17768eb42ebf5d87e61247d:examples/simple_regex_and_whitelist_config.toml:aws-access-token:12
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:211
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:212
275232f8c8f3ae4936667602a06a46caa156580b:audit/util.go:aws-access-token:90
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:237
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:238
275232f8c8f3ae4936667602a06a46caa156580b:test_data/test_configs/aws_key_aws_whitelisted.toml:aws-access-token:6
275232f8c8f3ae4936667602a06a46caa156580b:test_data/test_regex_whitelist.json.got:aws-access-token:3
275232f8c8f3ae4936667602a06a46caa156580b:test_data/test_regex_whitelist.json.got:aws-access-token:4
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:315
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:316
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:341
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:342
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:445
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:446
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:471
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:472
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:549
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:550
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:575
4d04ea079fc4e7f46c9f751fccde8f18c33b9e13:test_data/test_local_owner_aws_leak.json:aws-access-token:576
e446ba073804cf714316c5dc00d0ac41917b31f7:test_data/test_regex_entropy.json:aws-access-token:3
e446ba073804cf714316c5dc00d0ac41917b31f7:test_data/test_regex_entropy.json:aws-access-token:4
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:241
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:242
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:255
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:256
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:269
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:270
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:283
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:284
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:297
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:298
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:311
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:312
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:325
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:326
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:339
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:340
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:353
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:354
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:367
2ccd40677db07877be4a5919a16f6a180fc2a7e4:test_data/test_local_owner_aws_leak.json:aws-access-token:368
b55d88dc151f7022901cda41a03d43e0e508f2b7:audit/audit_test.go:aws-access-token:207
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_entropy.json:aws-access-token:3
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_one_aws_leak.json:aws-access-token:3
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_one_aws_leak.json:aws-access-token:4
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_one_aws_leak_and_file_leak.json:aws-access-token:17
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_one_aws_leak_and_file_leak.json:aws-access-token:18
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_one_aws_leak_commit.json:aws-access-token:3
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_one_aws_leak_commit.json:aws-access-token:4
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_one_aws_leak_uncommitted.json:aws-access-token:3
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_one_aws_leak_uncommitted.json:aws-access-token:4
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:3
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:4
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:17
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:18
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:31
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:32
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:45
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:46
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:59
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:60
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:73
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:74
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:87
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:88
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:101
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_three_leaks.json:aws-access-token:102
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_repos/test_repo_1/server.test.py:aws-access-token:5
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_two_leaks.json:aws-access-token:3
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_two_leaks.json:aws-access-token:4
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_two_leaks.json:aws-access-token:17
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_two_leaks.json:aws-access-token:18
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_two_leaks.json:aws-access-token:31
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_two_leaks.json:aws-access-token:32
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_two_leaks.json:aws-access-token:45
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_two_leaks.json:aws-access-token:46
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_two_leaks.json:aws-access-token:59
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_two_leaks.json:aws-access-token:60
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_two_leaks.json:aws-access-token:73
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_repo_two_leaks.json:aws-access-token:74
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:3
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:4
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:17
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:18
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:31
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:32
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:45
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:46
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:59
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:60
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:73
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:74
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:87
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:88
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:101
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:102
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:115
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:116
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:129
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:130
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:143
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:144
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:157
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:158
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:171
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:172
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:185
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:186
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:199
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:200
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:213
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:214
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:227
b55d88dc151f7022901cda41a03d43e0e508f2b7:test_data/test_local_owner_aws_leak.json:aws-access-token:228
7bd55e33b504f76fc2aec27f4f479a5fb2606480:src/constants.go:private-key:32
e79ffc6ae8f66931d687407e07bc0632fb262091:src/constants.go:private-key:23
2b995fda446e03b7660c327fec41265f03199c71:config.go:private-key:28
1f80d14f3f069118a2e578d83bbc8440495fc906:main.go:private-key:118
fe977ea8577b739c34a0071ba34e98cf6b6fad38:checks_test.go:aws-access-token:52
4b4fa00b69a9a2e5f7619b1ff1dd6d160f588aec:README.md:aws-access-token:25
4b4fa00b69a9a2e5f7619b1ff1dd6d160f588aec:README.md:aws-access-token:27
2186f2299990290e4e19cf3b28906e2ec369d01e:main.go:private-key:44
9f694531b203663588c68c82dbbfb34d4f71863f:main.go:private-key:44
1e250f1a14eab6f457d61f5d7650b47c6ff43334:checks_test.go:aws-access-token:19
1e250f1a14eab6f457d61f5d7650b47c6ff43334:config.yml:private-key:2
bc26e979c5911cf647c1bede0b3700ebaaa454c8:checks_test.go:aws-access-token:36
8f352bd840f028b481dc725b77d2f4904b77913b:checks_test.go:aws-access-token:34
ec2fc9d6cb0954fb3b57201cf6133c48d8ca0d29:checks_test.go:aws-access-token:37
06c9e824d5985c8e8789321ae70de7ace3b093dc:main.go:aws-access-token:15
6d801ed61cf4d75d176cbf9062ec6ad706c9d1eb:detect/detect_test.go:private-key:567
6d801ed61cf4d75d176cbf9062ec6ad706c9d1eb:testdata/repos/symlinks/source_file/id_ed25519:private-key:1
acce01f2338434a78f6a4a06a097b0fd23280484:README.md:aws-access-token:218
README.md:aws-access-token:204
README.md:aws-access-token:205
README.md:aws-access-token:244
cmd/generate/config/rules/privatekey.go:private-key:19
cmd/generate/config/rules/generic.go:clojars-api-token:43
cmd/generate/config/rules/generic.go:generic-api-key:45
cmd/generate/config/rules/generic.go:generic-api-key:46
cmd/generate/config/rules/sidekiq.go:sidekiq-secret:22
cmd/generate/config/rules/sidekiq.go:sidekiq-secret:23
cmd/generate/config/rules/sidekiq.go:sidekiq-secret:24
cmd/generate/config/rules/sidekiq.go:sidekiq-secret:28
cmd/generate/config/rules/sidekiq.go:sidekiq-secret:29
cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:46
cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:48
cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:50
cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:52
cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:54
cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:55
cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:56
cmd/generate/config/rules/sidekiq.go:sidekiq-sensitive-url:57
config/config_test.go:aws-access-token:31
detect/detect_test.go:sidekiq-secret:120
detect/detect_test.go:sidekiq-secret:126
detect/detect_test.go:sidekiq-secret:142
detect/detect_test.go:aws-access-token:50
detect/detect_test.go:aws-access-token:60
detect/detect_test.go:aws-access-token:61
detect/detect_test.go:aws-access-token:98
detect/detect_test.go:aws-access-token:104
detect/detect_test.go:aws-access-token:105
detect/detect_test.go:aws-access-token:186
detect/detect_test.go:aws-access-token:194
detect/detect_test.go:aws-access-token:202
detect/detect_test.go:aws-access-token:288
detect/detect_test.go:aws-access-token:296
detect/detect_test.go:aws-access-token:359
detect/detect_test.go:aws-access-token:360
detect/detect_test.go:aws-access-token:378
detect/detect_test.go:aws-access-token:379
detect/detect_test.go:aws-access-token:404
detect/detect_test.go:aws-access-token:405
detect/detect_test.go:aws-access-token:480
detect/detect_test.go:aws-access-token:481
detect/detect_test.go:aws-access-token:499
detect/detect_test.go:aws-access-token:500
detect/detect_test.go:sidekiq-sensitive-url:164
detect/detect_test.go:sidekiq-sensitive-url:170
detect/detect_test.go:pypi-upload-token:76
detect/detect_test.go:pypi-upload-token:82
detect/detect_test.go:pypi-upload-token:83
detect/detect_test.go:discord-api-token:211
detect/detect_test.go:discord-api-token:233
detect/detect_test.go:discord-api-token:241
detect/detect_test.go:discord-api-token:263
detect/detect_test.go:discord-api-token:279
testdata/config/allow_aws_re.toml:aws-access-token:9
testdata/config/allow_global_aws_re.toml:aws-access-token:8
testdata/expected/git/small-branch-foo.txt:aws-access-token:15
testdata/expected/git/small.txt:aws-access-token:15
testdata/expected/git/small.txt:aws-access-token:44
testdata/repos/nogit/main.go:aws-access-token:20
testdata/repos/nogit/api.go:aws-access-token:20
testdata/repos/small/api/ignoreCommit.go:aws-access-token:20
testdata/repos/small/api/ignoreGlobal.go:aws-access-token:20
3df8c3deb7bc1e34210bdbce114f1c6165bc6ac8:detect/detect_test.go:aws-access-token:513
3df8c3deb7bc1e34210bdbce114f1c6165bc6ac8:detect/detect_test.go:aws-access-token:492
3df8c3deb7bc1e34210bdbce114f1c6165bc6ac8:detect/detect_test.go:aws-access-token:414
3df8c3deb7bc1e34210bdbce114f1c6165bc6ac8:detect/detect_test.go:aws-access-token:388
3df8c3deb7bc1e34210bdbce114f1c6165bc6ac8:detect/detect_test.go:aws-access-token:366
3df8c3deb7bc1e34210bdbce114f1c6165bc6ac8:detect/detect_test.go:discord-api-token:255
3df8c3deb7bc1e34210bdbce114f1c6165bc6ac8:detect/detect_test.go:discord-api-token:224
3df8c3deb7bc1e34210bdbce114f1c6165bc6ac8:detect/detect_test.go:sidekiq-sensitive-url:177
3df8c3deb7bc1e34210bdbce114f1c6165bc6ac8:detect/detect_test.go:sidekiq-secret:154
3df8c3deb7bc1e34210bdbce114f1c6165bc6ac8:detect/detect_test.go:sidekiq-secret:130
3df8c3deb7bc1e34210bdbce114f1c6165bc6ac8:detect/detect_test.go:aws-access-token:107
3df8c3deb7bc1e34210bdbce114f1c6165bc6ac8:detect/detect_test.go:pypi-upload-token:84
3df8c3deb7bc1e34210bdbce114f1c6165bc6ac8:detect/detect_test.go:aws-access-token:62
96eed6aa0f507fe0c21bb46bec32637dc4cb1a9f:detect/detect_test.go:aws-access-token:62
96eed6aa0f507fe0c21bb46bec32637dc4cb1a9f:detect/detect_test.go:pypi-upload-token:84
96eed6aa0f507fe0c21bb46bec32637dc4cb1a9f:detect/detect_test.go:aws-access-token:107
96eed6aa0f507fe0c21bb46bec32637dc4cb1a9f:detect/detect_test.go:sidekiq-secret:130
96eed6aa0f507fe0c21bb46bec32637dc4cb1a9f:detect/detect_test.go:sidekiq-secret:154
96eed6aa0f507fe0c21bb46bec32637dc4cb1a9f:detect/detect_test.go:sidekiq-sensitive-url:177
96eed6aa0f507fe0c21bb46bec32637dc4cb1a9f:detect/detect_test.go:discord-api-token:224
96eed6aa0f507fe0c21bb46bec32637dc4cb1a9f:detect/detect_test.go:discord-api-token:255
96eed6aa0f507fe0c21bb46bec32637dc4cb1a9f:detect/detect_test.go:aws-access-token:366
96eed6aa0f507fe0c21bb46bec32637dc4cb1a9f:detect/detect_test.go:aws-access-token:388
96eed6aa0f507fe0c21bb46bec32637dc4cb1a9f:detect/detect_test.go:aws-access-token:414
96eed6aa0f507fe0c21bb46bec32637dc4cb1a9f:detect/detect_test.go:aws-access-token:492
96eed6aa0f507fe0c21bb46bec32637dc4cb1a9f:detect/detect_test.go:aws-access-token:513
bfbc39eb185a217ead81a7174026f1c55f963660:cmd/generate/config/rules/jwt.go:jwt:17
bfbc39eb185a217ead81a7174026f1c55f963660:cmd/generate/config/rules/jwt.go:jwt:19
acce01f2338434a78f6a4a06a097b0fd23280484:README.md:aws-access-token:220
99d620c719020fa24baa831299f0c964da79875e:detect/detect_test.go:aws-access-token:514
111c8b47b65627db117bd20be85ff0aee8961eb9:detect/detect_test.go:private-key:567
99d620c719020fa24baa831299f0c964da79875e:detect/detect_test.go:aws-access-token:512
99d620c719020fa24baa831299f0c964da79875e:detect/detect_test.go:aws-access-token:513
69f161c0a0cc0f7858f7d0609d656f4edcedd84c:detect/detect_test.go:discord-api-token:326
9701bf1724d822c0d5bbb7627535dd639a37bf56:testdata/repos/staged/api/api.go:aws-access-token:7
9701bf1724d822c0d5bbb7627535dd639a37bf56:detect/detect_test.go:aws-access-token:505
9701bf1724d822c0d5bbb7627535dd639a37bf56:detect/detect_test.go:aws-access-token:506
9701bf1724d822c0d5bbb7627535dd639a37bf56:detect/detect_test.go:aws-access-token:507
9701bf1724d822c0d5bbb7627535dd639a37bf56:testdata/repos/staged/api/api.go:aws-access-token:6
9701bf1724d822c0d5bbb7627535dd639a37bf56:testdata/repos/staged/api/api.go:aws-access-token:7
91ff8f9b7020a16dac9b8b9ef98560ea1cb464f8:testdata/repos/small/api/ignoreCommit.go:aws-access-token:20
91ff8f9b7020a16dac9b8b9ef98560ea1cb464f8:testdata/repos/small/api/ignoreGlobal.go:aws-access-token:20
91ff8f9b7020a16dac9b8b9ef98560ea1cb464f8:testdata/repos/nogit/api.go:aws-access-token:20
adf617b3b4628e1160fa3d135b4c3dfd45c05e15:testdata/repos/nogit/api.go:aws-access-token:20
adf617b3b4628e1160fa3d135b4c3dfd45c05e15:testdata/repos/small/api/ignoreGlobal.go:aws-access-token:20
adf617b3b4628e1160fa3d135b4c3dfd45c05e15:testdata/repos/small/api/ignoreCommit.go:aws-access-token:20
f361c5ef71853923277e3f284890083bc7825205:detect/reader_test.go:aws-access-token:12
+29
View File
@@ -0,0 +1,29 @@
project_name: gitleaks
builds:
- main: main.go
binary: gitleaks
goos:
- darwin
- linux
- windows
goarch:
- amd64
- "386"
- arm
- arm64
goarm:
- "6"
- "7"
ldflags:
- -s -w -X=github.com/zricethezav/gitleaks/v8/cmd.Version={{.Version}}
archives:
- builds: [gitleaks]
format_overrides:
- goos: windows
format: zip
replacements:
amd64: x64
386: x32
release:
prerelease: true
+16
View File
@@ -0,0 +1,16 @@
- id: gitleaks
name: Detect hardcoded secrets
description: Detect hardcoded secrets using Gitleaks
entry: gitleaks protect --verbose --redact --staged
language: golang
pass_filenames: false
- id: gitleaks-docker
name: Detect hardcoded secrets
description: Detect hardcoded secrets using Gitleaks
entry: zricethezav/gitleaks protect --verbose --redact --staged
language: docker_image
- id: gitleaks-system
name: Detect hardcoded secrets
description: Detect hardcoded secrets using Gitleaks
entry: gitleaks protect --verbose --redact --staged
language: system
-7
View File
@@ -1,7 +0,0 @@
language: go
go:
- 1.13.x
services:
- docker
script:
- make test
+99
View File
@@ -0,0 +1,99 @@
# Contribution guidelines
## General
### Issues
If you have a feature or bug fix you would like to contribute please check if
there are any open issues describing your proposed addition. If there are open
issues, make a comment stating you are working on fixing or implementing said
issue. If not, then please open an issue describing your addition. Make sure to
link your PR to an issue.
### Pull Requests
Fill out the template as best you can. Make sure your tests pass. If you see a
PR that isn't one you opened and want it introduced in the next release,
give it a :thumbsup: on the PR description.
## Adding new Gitleaks rules
If you want to add a new rule to the [default Gitleaks configuration](https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml) then follow these steps.
1. Create a `cmd/generate/config/rules/{provider}.go` file.
This file is used to generate a new Gitleaks rule.
Let's look at `beamer.go` for example. Comments have been added for context.
```golang
func Beamer() *config.Rule {
// Define Rule
r := config.Rule{
// Human readable description of the rule
Description: "Beamer API token",
// Unique ID for the rule
RuleID: "beamer-api-token",
// Regex capture group for the actual secret
// Regex used for detecting secrets. See regex section below for more details
Regex: generateSemiGenericRegex([]string{"beamer"}, `b_[a-z0-9=_\-]{44}`, true)
// Keywords used for string matching on fragments (think of this as a prefilter)
Keywords: []string{"beamer"},
}
// validate
tps := []string{
generateSampleSecret("beamer", "b_"+secrets.NewSecret(alphaNumericExtended("44"))),
}
return validate(r, tps, nil)
}
```
Feel free to use this example as a template when writing new rules.
This file should be fairly self-explanatory except for a few items;
regex and secret generation. To help with maintence, _most_ rules should
be uniform. The functions,
[`generateSemiGenericRegex`](https://github.com/zricethezav/gitleaks/blob/master/cmd/generate/config/rules/rule.go#L31) and [`generateUniqueTokenRegex`](https://github.com/zricethezav/gitleaks/blob/master/cmd/generate/config/rules/rule.go#L44) will generate rules
that follow defined patterns.
The function signatures look like this:
```golang
func generateSemiGenericRegex(identifiers []string, secretRegex string, isCaseInsensitive bool) *regexp.Regexp
func generateUniqueTokenRegex(secretRegex string, isCaseInsensitive bool) *regexp.Regexp
```
`generateSemiGenericRegex` accepts a list of identifiers, a regex, and a boolean indicating whether the pattern should be case-insensitive.
The list of identifiers _should_ match the list of `Keywords` in the rule
definition above. Both `identifiers` in the `generateSemiGenericRegex`
function _and_ `Keywords` act as filters for Gitleaks telling the program
"_at least one of these strings must be present to be considered a leak_"
`generateUniqueToken` just accepts a regex and a boolean indicating whether the pattern should be case-insensitive. If you are writing a rule for a
token that is unique enough not to require an identifier then you can use
this function. For example, Pulumi's API Token has the prefix `pul-` which is
unique enough to use `generateUniqueToken`. But something like Beamer's API
token that has a `b_` prefix is not unique enough to use `generateUniqueToken`,
so instead we use `generateSemiGenericRegex` and require a `beamer`
identifier is part of the rule.
If a token's prefix has more than `3` characters then you could
probably get away with using `generateUniqueToken`.
Last thing you'll want to hit before we move on from this file is the
validation part. You can use `generateSampleSecret` to create a secret for the
true positives (`tps` in the example above) used in `validate`.
1. Update `cmd/generate/config/main.go`. Extend `configRules` slice with
the `rules.Beamer(),` in `main()`. Try and keep
this alphabetically pretty please.
1. Run `go generate ./...`
1. Check out your new rules in `config/gitleaks.toml` and see if everything looks good.
1. Open a PR
+8 -12
View File
@@ -1,17 +1,13 @@
FROM golang:1.13.4 AS build
FROM golang:1.21 AS build
WORKDIR /go/src/github.com/zricethezav/gitleaks
ARG ldflags
COPY . .
RUN GO111MODULE=on CGO_ENABLED=0 go build -o bin/gitleaks -ldflags "-X="${ldflags} *.go
RUN VERSION=$(git describe --tags --abbrev=0) && \
CGO_ENABLED=0 go build -o bin/gitleaks -ldflags "-X="github.com/zricethezav/gitleaks/v8/cmd.Version=${VERSION}
FROM alpine:3.10
RUN apk add --no-cache bash git openssh
FROM alpine:3.19
RUN apk add --no-cache bash git openssh-client
COPY --from=build /go/src/github.com/zricethezav/gitleaks/bin/* /usr/bin/
RUN git config --global --add safe.directory '*'
ENTRYPOINT ["gitleaks"]
# How to use me :
# docker build -t gitleaks .
# docker run --rm --name=gitleaks gitleaks --repo=https://github.com/zricethezav/gitleaks
# This will check for secrets in https://github.com/zricethezav/gitleaks
+11 -32
View File
@@ -1,45 +1,24 @@
.PHONY: test test-cover build release-builds
.PHONY: test test-cover
VERSION := `git fetch --tags && git tag | sort -V | tail -1`
PKG=github.com/zricethezav/gitleaks
LDFLAGS=-ldflags "-X=github.com/zricethezav/gitleaks/v3/version.Version=$(VERSION)"
_LDFLAGS="github.com/zricethezav/gitleaks/v3/version.Version=$(VERSION)"
VERSION := `git fetch --tags && git tag | sort -V | tail -1`
LDFLAGS=-ldflags "-X=github.com/zricethezav/gitleaks/v8/cmd.Version=$(VERSION)"
COVER=--cover --coverprofile=cover.out
test-cover:
go test ./... --race $(COVER) $(PKG) -v
go test -v ./... --race $(COVER) $(PKG)
go tool cover -html=cover.out
test:
go get golang.org/x/lint/golint
format:
go fmt ./...
go vet ./...
golint ./...
go test ./... --race $(PKG) -v
test-integration:
go test github.com/zricethezav/gitleaks/hosts -v -integration
test: format
go test -v ./... --race $(PKG)
build:
go fmt ./...
golint ./...
go vet ./...
build: format
go mod tidy
go build $(LDFLAGS)
release-builds:
rm -rf build
mkdir build
env GOOS="windows" GOARCH="amd64" go build -o "build/gitleaks-windows-amd64.exe" $(LDFLAGS)
env GOOS="windows" GOARCH="386" go build -o "build/gitleaks-windows-386.exe" $(LDFLAGS)
env GOOS="linux" GOARCH="amd64" go build -o "build/gitleaks-linux-amd64" $(LDFLAGS)
env GOOS="linux" GOARCH="arm" go build -o "build/gitleaks-linux-arm" $(LDFLAGS)
env GOOS="linux" GOARCH="mips" go build -o "build/gitleaks-linux-mips" $(LDFLAGS)
env GOOS="linux" GOARCH="mips" go build -o "build/gitleaks-linux-mips" $(LDFLAGS)
env GOOS="darwin" GOARCH="amd64" go build -o "build/gitleaks-darwin-amd64" $(LDFLAGS)
deploy:
@echo "$(DOCKER_PASSWORD)" | docker login -u "$(DOCKER_USERNAME)" --password-stdin
docker build --build-arg ldflags=$(_LDFLAGS) -f Dockerfile -t zricethezav/gitleaks:latest -t zricethezav/gitleaks:$(VERSION) .
echo "Pushing zricethezav/gitleaks:$(VERSION) and zricethezav/gitleaks:latest"
docker push zricethezav/gitleaks
clean:
find . -type f -name '*.got.*' -delete
find . -type f -name '*.out' -delete
+335 -92
View File
@@ -1,131 +1,374 @@
Gitleaks
--------
# Gitleaks
```
┌─○───┐
│ │╲ │
│ │ ○ │
│ ○ ░ │
└─░───┘
```
<p align="left">
<a href="https://travis-ci.com/zricethezav/gitleaks"><img alt="Travis" src="https://travis-ci.com/zricethezav/gitleaks.svg?branch=master"></a>
<p align="left">
<a href="https://github.com/zricethezav/gitleaks/actions/workflows/test.yml">
<img alt="Github Test" src="https://github.com/zricethezav/gitleaks/actions/workflows/test.yml/badge.svg">
</a>
<a href="https://hub.docker.com/r/zricethezav/gitleaks">
<img src="https://img.shields.io/docker/pulls/zricethezav/gitleaks.svg" />
</a>
<a href="https://github.com/zricethezav/gitleaks-action">
<img alt="gitleaks badge" src="https://img.shields.io/badge/protected%20by-gitleaks-blue">
</a>
<a href="https://twitter.com/intent/follow?screen_name=zricethezav">
<img src="https://img.shields.io/twitter/follow/zricethezav?label=Follow%20zricethezav&style=social&color=blue" alt="Follow @zricethezav" />
</a>
</p>
</p>
Audit git repos for secrets. Gitleaks provides a way for you to find unencrypted secrets and other unwanted data types in git repositories. As part of its core functionality, it provides:
### Join our Discord! [![Discord](https://img.shields.io/discord/1102689410522284044.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/8Hzbrnkr7E)
* Audits for uncommitted changes
* Github and Gitlab support including support for bulk organization and repository owner (user) repository scans, as well as pull/merge request scanning for use in common CI workflows.
* Support for private repository scans, and repositories that require key based authentication
* Output in JSON formats for consumption in other reporting tools and frameworks
* Externalised configuration for environment specific customisation including regex rules
* High performance through the use of src-d's [go-git](https://github.com/src-d/go-git) framework
Gitleaks is a SAST tool for **detecting** and **preventing** hardcoded secrets like passwords, api keys, and tokens in git repos. Gitleaks is an **easy-to-use, all-in-one solution** for detecting secrets, past or present, in your code.
```
➜ ~/code(master) gitleaks git -v
○
│╲
│ ○
○ ░
░ gitleaks
| `repo scan` |
|---|
| <p align="left"><img src="https://raw.githubusercontent.com/zricethezav/gifs/master/repo-scan.gif"></p> | <p align="left"><img src="https://raw.githubusercontent.com/zricethezav/gifs/master/repo-scan.gif"></p> |
| `pre commit scan` |
|---|
| <p align="left"><img src="https://raw.githubusercontent.com/zricethezav/gifs/master/pre-commit-1.gif"></p> |
Finding: "export BUNDLE_ENTERPRISE__CONTRIBSYS__COM=cafebabe:deadbeef",
Secret: cafebabe:deadbeef
RuleID: sidekiq-secret
Entropy: 2.609850
File: cmd/generate/config/rules/sidekiq.go
Line: 23
Commit: cd5226711335c68be1e720b318b7bc3135a30eb2
Author: John
Email: john@users.noreply.github.com
Date: 2022-08-03T12:31:40Z
Fingerprint: cd5226711335c68be1e720b318b7bc3135a30eb2:cmd/generate/config/rules/sidekiq.go:sidekiq-secret:23
```
## Getting Started
Written in Go, gitleaks is available in binary form for many popular platforms and OS types from the [releases page](https://github.com/zricethezav/gitleaks/releases). Alternatively, executed via Docker or it can be installed using Go directly, as per the below;
Gitleaks can be installed using Homebrew, Docker, or Go. Gitleaks is also available in binary form for many popular platforms and OS types on the [releases page](https://github.com/zricethezav/gitleaks/releases). In addition, Gitleaks can be implemented as a pre-commit hook directly in your repo or as a GitHub action using [Gitleaks-Action](https://github.com/gitleaks/gitleaks-action).
#### MacOS
### Installing
```
```bash
# MacOS
brew install gitleaks
# Docker (DockerHub)
docker pull zricethezav/gitleaks:latest
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest [COMMAND] [OPTIONS] [SOURCE_PATH]
# Docker (ghcr.io)
docker pull ghcr.io/gitleaks/gitleaks:latest
docker run -v ${path_to_host_folder_to_scan}:/path ghcr.io/gitleaks/gitleaks:latest [COMMAND] [OPTIONS] [SOURCE_PATH]
# From Source (make sure `go` is installed)
git clone https://github.com/gitleaks/gitleaks.git
cd gitleaks
make build
```
#### Docker
### GitHub Action
```bash
docker pull zricethezav/gitleaks
Check out the official [Gitleaks GitHub Action](https://github.com/gitleaks/gitleaks-action)
```
name: gitleaks
on: [pull_request, push, workflow_dispatch]
jobs:
scan:
name: gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}} # Only required for Organizations, not personal accounts.
```
#### Go
Ensure `GO111MODULE=on` is set as an env var
```bash
go get github.com/zricethezav/gitleaks/v3@latest
### Pre-Commit
1. Install pre-commit from https://pre-commit.com/#install
2. Create a `.pre-commit-config.yaml` file at the root of your repository with the following content:
```
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.19.0
hooks:
- id: gitleaks
```
for a [native execution of GitLeaks](https://github.com/zricethezav/gitleaks/releases) or use the [`gitleaks-docker` pre-commit ID](https://github.com/zricethezav/gitleaks/blob/master/.pre-commit-hooks.yaml) for executing GitLeaks using the [official Docker images](#docker)
3. Auto-update the config to the latest repos' versions by executing `pre-commit autoupdate`
4. Install with `pre-commit install`
5. Now you're all set!
```
➜ git commit -m "this commit contains a secret"
Detect hardcoded secrets.................................................Failed
```
Note: to disable the gitleaks pre-commit hook you can prepend `SKIP=gitleaks` to the commit command
and it will skip running gitleaks
```
➜ SKIP=gitleaks git commit -m "skip gitleaks check"
Detect hardcoded secrets................................................Skipped
```
## Usage
gitleaks has a wide range of configuration options that can be adjusted at runtime or via a configuration file based on your specific requirements.
```
Usage:
gitleaks [OPTIONS]
gitleaks [command]
Application Options:
-v, --verbose Show verbose output from audit
-r, --repo= Target repository
--config= config path
--disk Clones repo(s) to disk
--version version number
--username= Username for git repo
--password= Password for git repo
--access-token= Access token for git repo
--commit= sha of commit to audit
--threads= Maximum number of threads gitleaks spawns
--ssh-key= path to ssh key used for auth
--uncommitted run gitleaks on uncommitted code
--repo-path= Path to repo
--owner-path= Path to owner directory (repos discovered)
--branch= Branch to audit
--report= path to write json leaks file
--report-format= json or csv (default: json)
--redact redact secrets from log messages and leaks
--debug log debug messages
--repo-config Load config from target repo. Config file must be ".gitleaks.toml" or "gitleaks.toml"
--pretty Pretty print json if leaks are present
--commit-from= Commit to start audit from
--commit-to= Commit to stop audit
--timeout= Time allowed per audit. Ex: 10us, 30s, 1m, 1h10m1s
--depth= Number of commits to audit
Available Commands:
completion generate the autocompletion script for the specified shell
dir scan directories or files for secrets
git scan git repositories for secrets
help Help about any command
stdin detect secrets from stdin
version display gitleaks version
--host= git hosting service like gitlab or github. Supported hosts include: Github, Gitlab
--baseurl= Base URL for API requests. Defaults to the public GitLab or GitHub API, but can be set to a domain endpoint to use with a self hosted server.
--org= organization to audit
--user= user to audit
--pr= pull/merge request url
--exclude-forks audit excludes forks
Flags:
-b, --baseline-path string path to baseline with issues that can be ignored
-c, --config string config file path
order of precedence:
1. --config/-c
2. env var GITLEAKS_CONFIG
3. (target path)/.gitleaks.toml
If none of the three options are used, then gitleaks will use the default config
--enable-rule strings only enable specific rules by id
--exit-code int exit code when leaks have been encountered (default 1)
-i, --gitleaks-ignore-path string path to .gitleaksignore file or folder containing one (default ".")
-h, --help help for gitleaks
--ignore-gitleaks-allow ignore gitleaks:allow comments
-l, --log-level string log level (trace, debug, info, warn, error, fatal) (default "info")
--max-target-megabytes int files larger than this will be skipped
--no-banner suppress banner
--no-color turn off color for verbose output
--redact uint[=100] redact secrets from logs and stdout. To redact only parts of the secret just apply a percent value from 0..100. For example --redact=20 (default 100%)
-f, --report-format string output format (json, csv, junit, sarif) (default "json")
-r, --report-path string report file
-v, --verbose show verbose output from scan
--version version for gitleaks
Help Options:
-h, --help Show this help message
Use "gitleaks [command] --help" for more information about a command.
```
### Commands
⚠️ v8.19.0 introduced a change that deprecated `detect` and `protect`. Those commands are still available but
are hidden in the `--help` menu. Take a look at this [gist](https://gist.github.com/zricethezav/b325bb93ebf41b9c0b0507acf12810d2) for easy command translations.
If you find v8.19.0 broke an existing command (`detect`/`protect`), please open an issue.
There are three scanning modes: `git`, `dir`, and `stdin`.
#### Git
The `git` command lets you scan local git repos. Under the hood, gitleaks uses the `git log -p` command to scan patches.
You can configure the behavior of `git log -p` with the `log-opts` option.
For example, if you wanted to run gitleaks on a range of commits you could use the following
command: `gitleaks git -v --log-opts="--all commitA..commitB" path_to_repo`. See the [git log](https://git-scm.com/docs/git-log) documentation for more information.
If there is no target specified as a positional argument, then gitleaks will attempt to scan the current working directory as a git repo.
#### Dir
The `dir` (aliases include `files`, `directory`) command lets you scan directories and files. Example: `gitleaks dir -v path_to_directory_or_file`.
If there is no target specified as a positional argument, then gitleaks will scan the current working directory.
#### Stdin
You can also stream data to gitleaks with the `stdin` command. Example: `cat some_file | gitleaks -v stdin`
### Creating a baseline
When scanning large repositories or repositories with a long history, it can be convenient to use a baseline. When using a baseline,
gitleaks will ignore any old findings that are present in the baseline. A baseline can be any gitleaks report. To create a gitleaks report, run gitleaks with the `--report-path` parameter.
```
gitleaks git --report-path gitleaks-report.json # This will save the report in a file called gitleaks-report.json
```
Once as baseline is created it can be applied when running the detect command again:
```
gitleaks git --baseline-path gitleaks-report.json --report-path findings.json
```
After running the detect command with the --baseline-path parameter, report output (findings.json) will only contain new issues.
## Pre-Commit hook
You can run Gitleaks as a pre-commit hook by copying the example `pre-commit.py` script into
your `.git/hooks/` directory.
## Configuration
Gitleaks offers a configuration format you can follow to write your own secret detection rules:
```toml
# Title for the gitleaks configuration file.
title = "Gitleaks title"
# Extend the base (this) configuration. When you extend a configuration
# the base rules take precedence over the extended rules. I.e., if there are
# duplicate rules in both the base configuration and the extended configuration
# the base rules will override the extended rules.
# Another thing to know with extending configurations is you can chain together
# multiple configuration files to a depth of 2. Allowlist arrays are appended
# and can contain duplicates.
# useDefault and path can NOT be used at the same time. Choose one.
[extend]
# useDefault will extend the base configuration with the default gitleaks config:
# https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml
useDefault = true
# or you can supply a path to a configuration. Path is relative to where gitleaks
# was invoked, not the location of the base config.
path = "common_config.toml"
# An array of tables that contain information that define instructions
# on how to detect secrets
[[rules]]
# Unique identifier for this rule
id = "awesome-rule-1"
# Short human readable description of the rule.
description = "awesome rule 1"
# Golang regular expression used to detect secrets. Note Golang's regex engine
# does not support lookaheads.
regex = '''one-go-style-regex-for-this-rule'''
# Golang regular expression used to match paths. This can be used as a standalone rule or it can be used
# in conjunction with a valid `regex` entry.
path = '''a-file-path-regex'''
# Array of strings used for metadata and reporting purposes.
tags = ["tag","another tag"]
# Int used to extract secret from regex match and used as the group that will have
# its entropy checked if `entropy` is set.
secretGroup = 3
# Float representing the minimum shannon entropy a regex group must have to be considered a secret.
entropy = 3.5
# Keywords are used for pre-regex check filtering. Rules that contain
# keywords will perform a quick string compare check to make sure the
# keyword(s) are in the content being scanned. Ideally these values should
# either be part of the idenitifer or unique strings specific to the rule's regex
# (introduced in v8.6.0)
keywords = [
"auth",
"password",
"token",
]
# You can include an allowlist table for a single rule to reduce false positives or ignore commits
# with known/rotated secrets
[rules.allowlist]
description = "ignore commit A"
commits = [ "commit-A", "commit-B"]
paths = [
'''go\.mod''',
'''go\.sum'''
]
# note: (rule) regexTarget defaults to check the _Secret_ in the finding.
# if regexTarget is not specified then _Secret_ will be used.
# Acceptable values for regexTarget are "match" and "line"
regexTarget = "match"
regexes = [
'''process''',
'''getenv''',
]
# note: stopwords targets the extracted secret, not the entire regex match
# like 'regexes' does. (stopwords introduced in 8.8.0)
stopwords = [
'''client''',
'''endpoint''',
]
# This is a global allowlist which has a higher order of precedence than rule-specific allowlists.
# If a commit listed in the `commits` field below is encountered then that commit will be skipped and no
# secrets will be detected for said commit. The same logic applies for regexes and paths.
[allowlist]
description = "global allow list"
commits = [ "commit-A", "commit-B", "commit-C"]
paths = [
'''gitleaks\.toml''',
'''(.*?)(jpg|gif|doc)'''
]
# note: (global) regexTarget defaults to check the _Secret_ in the finding.
# if regexTarget is not specified then _Secret_ will be used.
# Acceptable values for regexTarget are "match" and "line"
regexTarget = "match"
regexes = [
'''219-09-9999''',
'''078-05-1120''',
'''(9[0-9]{2}|666)-\d{2}-\d{4}''',
]
# note: stopwords targets the extracted secret, not the entire regex match
# like 'regexes' does. (stopwords introduced in 8.8.0)
stopwords = [
'''client''',
'''endpoint''',
]
```
Refer to the default [gitleaks config](https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml) for examples or follow the [contributing guidelines](https://github.com/gitleaks/gitleaks/blob/master/CONTRIBUTING.md) if you would like to contribute to the default configuration. Additionally, you can check out [this gitleaks blog post](https://blog.gitleaks.io/stop-leaking-secrets-configuration-2-3-aeed293b1fbf) which covers advanced configuration setups.
### Additional Configuration
#### gitleaks:allow
If you are knowingly committing a test secret that gitleaks will catch you can add a `gitleaks:allow` comment to that line which will instruct gitleaks
to ignore that secret. Ex:
```
class CustomClass:
discord_client_secret = '8dyfuiRyq=vVc3RRr_edRk-fK__JItpZ' #gitleaks:allow
```
### Docker usage examples
#### .gitleaksignore
Run gitleaks against:
You can ignore specific findings by creating a `.gitleaksignore` file at the root of your repo. In release v8.10.0 Gitleaks added a `Fingerprint` value to the Gitleaks report. Each leak, or finding, has a Fingerprint that uniquely identifies a secret. Add this fingerprint to the `.gitleaksignore` file to ignore that specific secret. See Gitleaks' [.gitleaksignore](https://github.com/zricethezav/gitleaks/blob/master/.gitleaksignore) for an example. Note: this feature is experimental and is subject to change in the future.
###### Public repository
```bash
docker run --rm --name=gitleaks zricethezav/gitleaks -v -r https://github.com/zricethezav/gitleaks.git
```
###### Local repository already cloned into /tmp/
```bash
docker run --rm --name=gitleaks -v /tmp/:/code/ zricethezav/gitleaks -v --repo-path=/code/gitleaks
```
By default repos cloned to memory. Using `--disk` for clone to disk or you can quickly out of memory.
For speed up analyze operation using `--threads` parameter, which set to `ALL - 1` threads at your instance CPU.
## Sponsorships
<p align="left">
<h3><a href="https://coderabbit.ai/?utm_source=oss&utm_medium=sponsorship&utm_campaign=gitleaks">coderabbit.ai</h3>
<a href="https://coderabbit.ai/?utm_source=oss&utm_medium=sponsorship&utm_campaign=gitleaks">
<img alt="CodeRabbit.ai Sponsorship" src="https://github.com/gitleaks/gitleaks/assets/15034943/76c30a85-887b-47ca-9956-17a8e55c6c41" width=200>
</a>
</p>
<p align="left">
<a href="https://www.tines.com/?utm_source=oss&utm_medium=sponsorship&utm_campaign=gitleaks">
<img alt="Tines Sponsorship" src="https://user-images.githubusercontent.com/15034943/146411864-4878f936-b4f7-49a0-b625-f9f40c704bfa.png" width=200>
</a>
</p>
## Exit Codes
Gitleaks provides consistent exist codes to assist in automation workflows such as CICD platforms and bulk scanning.
You can always set the exit code when leaks are encountered with the --exit-code flag. Default exit codes below:
```
0: no leaks
1: leaks present
2: error encountered
0 - no leaks present
1 - leaks or error encountered
126 - unknown flag
```
### Give Thanks
If using gitleaks has made your job easier consider [sponsoring me](https://github.com/sponsors/zricethezav) through github's sponsorship program or donating to one of [Sam](https://www.flickr.com/photos/146541520@N08/albums/72157710121716312)'s favorite places, the Japan House on the University of Illinois at Urbana-Champaign's campus: https://japanhouse.illinois.edu/make-a-gift
+26
View File
@@ -0,0 +1,26 @@
## Who uses Gitleaks?
As the Gitleaks Community grows, we'd like to keep a list of our users.
Here's a running list of some organizations using Gitleaks[^1]:
1. [GitLab](https://docs.gitlab.com/ee/user/application_security/secret_detection/)
1. [Gitleaks](https://gitleaks.io)
1. [GoReleaser](https://goreleaser.com)
2. [Trendyol](https://trendyol.com)
Feel free to [add yours](https://github.com/zricethezav/gitleaks/edit/master/USERS.md)!
<!--
Hey! Thanks for looking into this file!
If you're going to edit it, please:
- keep a-z ordering :)
- edit only the USERS.md file at the repository's root folder
-->
[^1]: Entries were either added by the companies themselves or by the maintainers after seeing it in the wild.
You can see all public repositories using Gitleaks or Gitleaks-Action by [searching on GitHub](https://github.com/search?q=gitleaks).
<!--
Shout out to GoReleaser for this template: https://github.com/goreleaser/goreleaser/blob/main/USERS.md
-->
-56
View File
@@ -1,56 +0,0 @@
package audit
import (
"fmt"
"io/ioutil"
"path"
"github.com/zricethezav/gitleaks/v3/manager"
log "github.com/sirupsen/logrus"
)
// Run accepts a manager and begins an audit based on the options/configs set in the manager.
func Run(m *manager.Manager) error {
if m.Opts.OwnerPath != "" {
files, err := ioutil.ReadDir(m.Opts.OwnerPath)
if err != nil {
return err
}
for _, f := range files {
if !f.IsDir() {
continue
}
m.Opts.RepoPath = fmt.Sprintf("%s/%s", m.Opts.OwnerPath, f.Name())
if err := runHelper(NewRepo(m)); err != nil {
log.Warnf("%s is not a git repo, skipping", f.Name())
}
}
return nil
}
return runHelper(NewRepo(m))
}
func runHelper(r *Repo) error {
if r.Manager.Opts.OpenLocal() {
r.Name = path.Base(r.Manager.Opts.RepoPath)
if err := r.Open(); err != nil {
return err
}
// Check if we are checking uncommitted files. This is the default behavior
// for a "$ gitleaks" command with no options set
if r.Manager.Opts.CheckUncommitted() {
if err := r.AuditUncommitted(); err != nil {
return err
}
return nil
}
} else {
if err := r.Clone(nil); err != nil {
return err
}
}
return r.Audit()
}
-434
View File
@@ -1,434 +0,0 @@
package audit
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"reflect"
"runtime"
"sort"
"testing"
"github.com/zricethezav/gitleaks/v3/config"
"github.com/zricethezav/gitleaks/v3/manager"
"github.com/zricethezav/gitleaks/v3/options"
"github.com/sergi/go-diff/diffmatchpatch"
)
const testRepoBase = "../test_data/test_repos/"
func TestAudit(t *testing.T) {
moveDotGit("dotGit", ".git")
defer moveDotGit(".git", "dotGit")
tests := []struct {
description string
opts options.Options
wantPath string
wantErr error
emptyRepo bool
wantEmpty bool
}{
{
description: "test local repo one aws leak",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_1",
Report: "../test_data/test_local_repo_one_aws_leak.json.got",
ReportFormat: "json",
},
wantPath: "../test_data/test_local_repo_one_aws_leak.json",
},
{
description: "test local repo one aws leak threaded",
opts: options.Options{
Threads: runtime.GOMAXPROCS(0),
RepoPath: "../test_data/test_repos/test_repo_1",
Report: "../test_data/test_local_repo_one_aws_leak.json.got",
ReportFormat: "json",
},
wantPath: "../test_data/test_local_repo_one_aws_leak.json",
},
{
description: "test non existent repo",
opts: options.Options{
RepoPath: "../test_data/test_repos/no_repo_here",
ReportFormat: "json",
},
emptyRepo: true,
},
{
description: "test local repo one aws leak whitelisted",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_1",
ReportFormat: "json",
Config: "../test_data/test_configs/aws_key_whitelist_python_files.toml",
},
wantEmpty: true,
},
{
description: "test local repo two leaks",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_2",
Report: "../test_data/test_local_repo_two_leaks.json.got",
ReportFormat: "json",
},
wantPath: "../test_data/test_local_repo_two_leaks.json",
},
{
description: "test local repo two leaks from commit",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_2",
Report: "../test_data/test_local_repo_two_leaks_commit_from.json.got",
ReportFormat: "json",
CommitFrom: "996865bb912f3bc45898a370a13aadb315014b55",
},
wantPath: "../test_data/test_local_repo_two_leaks_commit_from.json",
},
{
description: "test local repo two leaks to commit",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_2",
Report: "../test_data/test_local_repo_two_leaks_commit_to.json.got",
ReportFormat: "json",
CommitTo: "996865bb912f3bc45898a370a13aadb315014b55",
},
wantPath: "../test_data/test_local_repo_two_leaks_commit_to.json",
},
{
description: "test local repo two leaks range commit",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_2",
Report: "../test_data/test_local_repo_two_leaks_commit_range.json.got",
ReportFormat: "json",
CommitFrom: "d8ac0b73aeeb45843319cdc5ce506516eb49bf7a",
CommitTo: "51f6dcf6b89b93f4075ba92c400b075631a6cc93",
},
wantPath: "../test_data/test_local_repo_two_leaks_commit_range.json",
},
{
description: "test local repo two leaks globally whitelisted",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_2",
Config: "../test_data/test_configs/aws_key_global_whitelist_file.toml",
ReportFormat: "json",
},
wantEmpty: true,
},
{
description: "test local repo two leaks whitelisted",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_2",
Config: "../test_data/test_configs/aws_key_whitelist_files.toml",
ReportFormat: "json",
},
wantEmpty: true,
},
{
description: "test local repo three leaks dev branch",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_3",
Report: "../test_data/test_local_repo_three_leaks.json.got",
Config: "../test_data/test_configs/aws_key.toml",
Branch: "dev",
ReportFormat: "json",
},
wantPath: "../test_data/test_local_repo_three_leaks.json",
},
{
description: "test local repo branch does not exist",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_3",
Branch: "nobranch",
ReportFormat: "json",
},
wantEmpty: true,
},
{
description: "test local repo one aws leak single commit",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_1",
Report: "../test_data/test_local_repo_one_aws_leak_commit.json.got",
Commit: "6557c92612d3b35979bd426d429255b3bf9fab74",
ReportFormat: "json",
},
wantPath: "../test_data/test_local_repo_one_aws_leak_commit.json",
},
{
description: "test local repo one aws leak AND leak on python files",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_1",
Report: "../test_data/test_local_repo_one_aws_leak_and_file_leak.json.got",
Config: "../test_data/test_configs/aws_key_file_regex.toml",
ReportFormat: "json",
},
wantPath: "../test_data/test_local_repo_one_aws_leak_and_file_leak.json",
},
{
description: "test owner path",
opts: options.Options{
OwnerPath: "../test_data/test_repos/",
Report: "../test_data/test_local_owner_aws_leak.json.got",
ReportFormat: "json",
},
wantPath: "../test_data/test_local_owner_aws_leak.json",
},
{
description: "test entropy",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_1",
Report: "../test_data/test_entropy.json.got",
Config: "../test_data/test_configs/entropy.toml",
ReportFormat: "json",
},
wantPath: "../test_data/test_entropy.json",
},
{
description: "test entropy and regex",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_1",
Report: "../test_data/test_regex_entropy.json.got",
Config: "../test_data/test_configs/regex_entropy.toml",
ReportFormat: "json",
},
wantPath: "../test_data/test_regex_entropy.json",
},
{
description: "test local repo four entropy alternative config",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_4",
Report: "../test_data/test_local_repo_four_alt_config_entropy.json.got",
RepoConfig: true,
ReportFormat: "json",
},
wantPath: "../test_data/test_local_repo_four_alt_config_entropy.json",
},
{
description: "test local repo four entropy alternative config",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_1",
Report: "../test_data/test_regex_whitelist.json.got",
Config: "../test_data/test_configs/aws_key_aws_whitelisted.toml",
ReportFormat: "json",
},
wantEmpty: true,
},
{
description: "test local repo one aws leak timeout",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_1",
Report: "../test_data/test_local_repo_one_aws_leak.json.got",
ReportFormat: "json",
Timeout: "10ns",
},
wantEmpty: true,
},
{
description: "test local repo one aws leak long timeout",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_1",
Report: "../test_data/test_local_repo_one_aws_leak.json.got",
ReportFormat: "json",
Timeout: "2m",
},
wantPath: "../test_data/test_local_repo_one_aws_leak.json",
},
{
description: "test owner path depth=2",
opts: options.Options{
OwnerPath: "../test_data/test_repos/",
Report: "../test_data/test_local_owner_aws_leak_depth_2.json.got",
ReportFormat: "json",
Depth: 2,
},
wantPath: "../test_data/test_local_owner_aws_leak_depth_2.json",
},
}
for _, test := range tests {
fmt.Println(test.description)
cfg, err := config.NewConfig(test.opts)
if err != nil {
t.Error(err)
}
m, err := manager.NewManager(test.opts, cfg)
if err != nil {
t.Error(err)
}
err = Run(m)
if test.wantErr != nil {
if err == nil {
t.Errorf("did not receive wantErr: %v", test.wantErr)
}
if err.Error() != test.wantErr.Error() {
t.Errorf("wantErr does not equal err received: %v", err.Error())
}
continue
}
err = m.Report()
if test.wantEmpty {
if len(m.GetLeaks()) != 0 {
t.Errorf("wanted no leaks but got some instead: %+v", m.GetLeaks())
}
continue
}
if test.wantPath != "" {
err := fileCheck(test.wantPath, test.opts.Report)
if err != nil {
t.Error(err)
}
}
}
}
func TestAuditUncommited(t *testing.T) {
moveDotGit("dotGit", ".git")
defer moveDotGit(".git", "dotGit")
tests := []struct {
description string
opts options.Options
wantPath string
wantErr error
emptyRepo bool
wantEmpty bool
fileToChange string
addition string
}{
{
description: "test audit local one leak",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_1",
Report: "../test_data/test_local_repo_one_aws_leak_uncommitted.json.got",
Uncommited: true,
ReportFormat: "json",
},
wantPath: "../test_data/test_local_repo_one_aws_leak_uncommitted.json",
fileToChange: "server.test.py",
addition: " aws_access_key_id='AKIAIO5FODNN7DXAMPLE'\n\n",
},
{
description: "test audit local no leak",
opts: options.Options{
RepoPath: "../test_data/test_repos/test_repo_1",
Uncommited: true,
ReportFormat: "json",
},
wantEmpty: true,
fileToChange: "server.test.py",
addition: "nothing bad",
},
}
for _, test := range tests {
fmt.Println(test.description)
old, err := ioutil.ReadFile(fmt.Sprintf("%s/%s", test.opts.RepoPath, test.fileToChange))
if err != nil {
t.Error(err)
}
altered, err := os.OpenFile(fmt.Sprintf("%s/%s", test.opts.RepoPath, test.fileToChange),
os.O_WRONLY|os.O_APPEND, 0644)
if err != nil {
t.Error(err)
}
_, err = altered.WriteString(test.addition)
if err != nil {
t.Error(err)
}
cfg, err := config.NewConfig(test.opts)
if err != nil {
t.Error(err)
}
m, err := manager.NewManager(test.opts, cfg)
if err != nil {
t.Error(err)
}
if err := Run(m); err != nil {
t.Error(err)
}
if err := m.Report(); err != nil {
t.Error(err)
}
err = ioutil.WriteFile(fmt.Sprintf("%s/%s", test.opts.RepoPath, test.fileToChange), old, 0)
if err != nil {
t.Error(err)
}
if test.wantEmpty {
continue
}
if test.wantPath != "" {
err := fileCheck(test.wantPath, test.opts.Report)
if err != nil {
t.Error(err)
}
}
}
}
func fileCheck(wantPath, gotPath string) error {
var (
gotLeaks []manager.Leak
wantLeaks []manager.Leak
)
want, err := ioutil.ReadFile(wantPath)
if err != nil {
return err
}
got, err := ioutil.ReadFile(gotPath)
if err != nil {
return err
}
err = json.Unmarshal(got, &gotLeaks)
if err != nil {
return err
}
err = json.Unmarshal(want, &wantLeaks)
if err != nil {
return nil
}
sort.Slice(gotLeaks, func(i, j int) bool { return (gotLeaks)[i].Commit < (gotLeaks)[j].Commit })
sort.Slice(wantLeaks, func(i, j int) bool { return (wantLeaks)[i].Commit < (wantLeaks)[j].Commit })
if !reflect.DeepEqual(gotLeaks, wantLeaks) {
dmp := diffmatchpatch.New()
diffs := dmp.DiffMain(string(want), string(got), false)
return fmt.Errorf("does not equal: %s", dmp.DiffPrettyText(diffs))
}
if err := os.Remove(gotPath); err != nil {
return err
}
return nil
}
func moveDotGit(from, to string) error {
repoDirs, err := ioutil.ReadDir("../test_data/test_repos")
if err != nil {
return err
}
for _, dir := range repoDirs {
if !dir.IsDir() {
continue
}
err = os.Rename(fmt.Sprintf("%s/%s/%s", testRepoBase, dir.Name(), from),
fmt.Sprintf("%s/%s/%s", testRepoBase, dir.Name(), to))
if err != nil {
return err
}
}
return nil
}
-403
View File
@@ -1,403 +0,0 @@
package audit
import (
"bytes"
"context"
"crypto/md5"
"fmt"
"io"
"os"
"path"
"path/filepath"
"sync"
"time"
"github.com/zricethezav/gitleaks/v3/config"
"github.com/zricethezav/gitleaks/v3/manager"
"github.com/BurntSushi/toml"
"github.com/sergi/go-diff/diffmatchpatch"
log "github.com/sirupsen/logrus"
"gopkg.in/src-d/go-billy.v4"
"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/object"
"gopkg.in/src-d/go-git.v4/plumbing/storer"
"gopkg.in/src-d/go-git.v4/storage/memory"
)
// Repo wraps a *git.Repository object in addition to a manager object and the name of the repo.
// Commits are inspected from the *git.Repository object. If a commit is found then we send it
// via the manager LeakChan where the manager receives and keeps track of all leaks.
type Repo struct {
*git.Repository
// config is used when the --repo-config option is set.
// This allows users to load up configs specific to their repos.
// Imagine the scenario where you are doing an audit of a large organization
// and you want certain repos to look for specific rules. If those specific repos
// have a gitleaks.toml or .gitleaks.toml config then those configs will be used specifically
// for those repo audits.
config config.Config
// ctx is used to signal timeouts to running goroutines
ctx context.Context
cancel context.CancelFunc
Name string
Manager *manager.Manager
}
// NewRepo initializes and returns a Repo struct.
func NewRepo(m *manager.Manager) *Repo {
return &Repo{
Manager: m,
config: m.Config,
ctx: context.Background(),
}
}
// Clone will clone a repo and return a Repo struct which contains a go-git repo. The clone method
// is determined by the clone options set in Manager.metadata.cloneOptions
func (repo *Repo) Clone(cloneOption *git.CloneOptions) error {
var (
repository *git.Repository
err error
)
if cloneOption == nil {
cloneOption = repo.Manager.CloneOptions
}
log.Infof("cloning... %s", cloneOption.URL)
start := time.Now()
if repo.Manager.CloneDir != "" {
clonePath := fmt.Sprintf("%s/%x", repo.Manager.CloneDir, md5.Sum([]byte(time.Now().String())))
repository, err = git.PlainClone(clonePath, false, cloneOption)
} else {
repository, err = git.Clone(memory.NewStorage(), nil, cloneOption)
}
if err != nil {
return err
}
repo.Name = filepath.Base(repo.Manager.Opts.Repo)
repo.Repository = repository
repo.Manager.RecordTime(manager.CloneTime(howLong(start)))
return nil
}
// AuditUncommitted will do a `git diff` and scan changed files that are being tracked. This is useful functionality
// for a pre-commit hook so you can make sure your code does not have any leaks before committing.
func (repo *Repo) AuditUncommitted() error {
// load up alternative config if possible, if not use manager's config
if repo.Manager.Opts.RepoConfig {
cfg, err := repo.loadRepoConfig()
if err != nil {
return err
}
repo.config = cfg
}
if err := repo.setupTimeout(); err != nil {
return err
}
auditTimeStart := time.Now()
r, err := repo.Head()
if err != nil {
return err
}
c, err := repo.CommitObject(r.Hash())
if err != nil {
return err
}
// Staged change so the commit details do not yet exist. Insert empty defaults.
c.Hash = plumbing.Hash{}
c.Message = "***STAGED CHANGES***"
c.Author.Name = ""
c.Author.Email = ""
c.Author.When = time.Unix(0, 0).UTC()
prevTree, err := c.Tree()
if err != nil {
return err
}
wt, err := repo.Worktree()
if err != nil {
return err
}
status, err := wt.Status()
for fn, state := range status {
var (
prevFileContents string
currFileContents string
filename string
)
if state.Staging != git.Untracked {
if state.Staging == git.Deleted {
// file in staging has been deleted, aka it is not on the filesystem
// so the contents of the file are ""
currFileContents = ""
} else {
workTreeBuf := bytes.NewBuffer(nil)
workTreeFile, err := wt.Filesystem.Open(fn)
if err != nil {
continue
}
if _, err := io.Copy(workTreeBuf, workTreeFile); err != nil {
return err
}
currFileContents = workTreeBuf.String()
filename = workTreeFile.Name()
}
// get files at HEAD state
prevFile, err := prevTree.File(fn)
if err != nil {
prevFileContents = ""
} else {
prevFileContents, err = prevFile.Contents()
if err != nil {
return err
}
if filename == "" {
filename = prevFile.Name
}
}
if fileMatched(filename, repo.config.Whitelist.File) {
log.Debugf("whitelisted file found, skipping audit of file: %s", filename)
} else if fileMatched(filename, repo.config.FileRegex) {
repo.Manager.SendLeaks(manager.Leak{
Line: "N/A",
Offender: filename,
Commit: c.Hash.String(),
Repo: repo.Name,
Rule: "file regex matched" + repo.config.FileRegex.String(),
Message: c.Message,
Author: c.Author.Name,
Email: c.Author.Email,
Date: c.Author.When,
File: filename,
})
} else {
dmp := diffmatchpatch.New()
diffs := dmp.DiffMain(prevFileContents, currFileContents, false)
var diffContents string
for _, d := range diffs {
switch d.Type {
case diffmatchpatch.DiffInsert:
diffContents += fmt.Sprintf("%s\n", d.Text)
case diffmatchpatch.DiffDelete:
diffContents += fmt.Sprintf("%s\n", d.Text)
}
}
InspectString(diffContents, c, repo, filename)
}
}
}
if err != nil {
return err
}
repo.Manager.RecordTime(manager.AuditTime(howLong(auditTimeStart)))
return nil
}
// Audit is responsible for scanning the entire history (default behavior) of a
// git repo. Options that can change the behavior of this function include: --commit, --depth, --branch.
// See options/options.go for an explanation on these options.
func (repo *Repo) Audit() error {
if err := repo.setupTimeout(); err != nil {
return err
}
if repo.Repository == nil {
return fmt.Errorf("%s repo is empty", repo.Name)
}
// load up alternative config if possible, if not use manager's config
if repo.Manager.Opts.RepoConfig {
cfg, err := repo.loadRepoConfig()
if err != nil {
return err
}
repo.config = cfg
}
auditTimeStart := time.Now()
// audit single Commit
if repo.Manager.Opts.Commit != "" {
h := plumbing.NewHash(repo.Manager.Opts.Commit)
c, err := repo.CommitObject(h)
if err != nil {
return err
}
err = inspectCommit(c, repo)
if err != nil {
return err
}
return nil
}
logOpts, err := getLogOptions(repo)
if err != nil {
return err
}
cIter, err := repo.Log(logOpts)
if err != nil {
return err
}
cc := 0
semaphore := make(chan bool, howManyThreads(repo.Manager.Opts.Threads))
wg := sync.WaitGroup{}
err = cIter.ForEach(func(c *object.Commit) error {
if c == nil || c.Hash.String() == repo.Manager.Opts.CommitTo ||
repo.timeoutReached() || repo.depthReached(cc) {
return storer.ErrStop
}
if len(c.ParentHashes) == 0 {
cc++
err = inspectCommit(c, repo)
if err != nil {
return err
}
return nil
}
if isCommitWhiteListed(c.Hash.String(), repo.config.Whitelist.Commits) {
return nil
}
cc++
err = c.Parents().ForEach(func(parent *object.Commit) error {
defer func() {
if err := recover(); err != nil {
// sometimes the patch generation will fail due to a known bug in
// sergi's go-diff: https://github.com/sergi/go-diff/issues/89.
// Once a fix has been merged I will remove this recover.
return
}
}()
if repo.timeoutReached() {
return nil
}
start := time.Now()
patch, err := c.Patch(parent)
if err != nil {
return fmt.Errorf("could not generate patch")
}
repo.Manager.RecordTime(manager.PatchTime(howLong(start)))
wg.Add(1)
semaphore <- true
go func(c *object.Commit, patch *object.Patch) {
defer func() {
<-semaphore
wg.Done()
}()
inspectPatch(patch, c, repo)
}(c, patch)
return nil
})
return nil
})
wg.Wait()
repo.Manager.RecordTime(manager.AuditTime(howLong(auditTimeStart)))
repo.Manager.IncrementCommits(cc)
return nil
}
// Open opens a local repo either from repo-path or $PWD
func (repo *Repo) Open() error {
if repo.Manager.Opts.RepoPath != "" {
// open git repo from repo path
repository, err := git.PlainOpen(repo.Manager.Opts.RepoPath)
if err != nil {
return err
}
repo.Repository = repository
} else {
// open git repo from PWD
dir, err := os.Getwd()
if err != nil {
return err
}
repository, err := git.PlainOpen(dir)
if err != nil {
return err
}
repo.Repository = repository
repo.Name = path.Base(dir)
}
return nil
}
func (repo *Repo) loadRepoConfig() (config.Config, error) {
wt, err := repo.Repository.Worktree()
if err != nil {
return config.Config{}, err
}
var f billy.File
f, _ = wt.Filesystem.Open(".gitleaks.toml")
if f == nil {
f, err = wt.Filesystem.Open("gitleaks.toml")
if err != nil {
return config.Config{}, fmt.Errorf("problem loading repo config: %v", err)
}
}
defer f.Close()
var tomlLoader config.TomlLoader
_, err = toml.DecodeReader(f, &tomlLoader)
return tomlLoader.Parse()
}
// timeoutReached returns true if the timeout deadline has been met. This function should be used
// at the top of loops and before potentially long running goroutines (like checking inefficient regexes)
func (repo *Repo) timeoutReached() bool {
if repo.ctx.Err() == context.DeadlineExceeded {
return true
}
return false
}
// setupTimeout parses the --timeout option and assigns a context with timeout to the manager
// which will exit early if the timeout has been met.
func (repo *Repo) setupTimeout() error {
if repo.Manager.Opts.Timeout == "" {
return nil
}
timeout, err := time.ParseDuration(repo.Manager.Opts.Timeout)
if err != nil {
return err
}
repo.ctx, repo.cancel = context.WithTimeout(context.Background(), timeout)
go func() {
select {
case <-repo.ctx.Done():
log.Warnf("Timeout deadline exceeded: %s", timeout.String())
}
}()
return nil
}
func (repo *Repo) depthReached(i int) bool {
if repo.Manager.Opts.Depth != 0 && repo.Manager.Opts.Depth == i {
log.Warnf("Exceeded depth limit (%d)", i)
return true
}
return false
}
-394
View File
@@ -1,394 +0,0 @@
package audit
import (
"fmt"
"math"
"regexp"
"runtime"
"strings"
"time"
"github.com/zricethezav/gitleaks/v3/config"
"github.com/zricethezav/gitleaks/v3/manager"
log "github.com/sirupsen/logrus"
"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing"
fdiff "gopkg.in/src-d/go-git.v4/plumbing/format/diff"
"gopkg.in/src-d/go-git.v4/plumbing/object"
)
// Inspect patch accepts a patch, commit, and repo. If the patches contains files that are
// binary, then gitleaks will skip auditing that file OR if a file is matched on
// whitelisted files set in the configuration. If a global rule for files is defined and a filename
// matches said global rule, then a leak is sent to the manager.
// After that, file chunks are created which are then inspected by InspectString()
func inspectPatch(patch *object.Patch, c *object.Commit, repo *Repo) {
for _, f := range patch.FilePatches() {
if repo.timeoutReached() {
return
}
if f.IsBinary() {
continue
}
if fileMatched(getFileName(f), repo.config.Whitelist.File) {
log.Debugf("whitelisted file found, skipping audit of file: %s", getFileName(f))
continue
}
if fileMatched(getFileName(f), repo.config.FileRegex) {
repo.Manager.SendLeaks(manager.Leak{
Line: "N/A",
Offender: getFileName(f),
Commit: c.Hash.String(),
Repo: repo.Name,
Rule: "file regex matched" + repo.config.FileRegex.String(),
Author: c.Author.Name,
Email: c.Author.Email,
Date: c.Author.When,
File: getFileName(f),
})
}
for _, chunk := range f.Chunks() {
if chunk.Type() == fdiff.Delete || chunk.Type() == fdiff.Add {
InspectString(chunk.Content(), c, repo, getFileName(f))
}
}
}
}
// getFileName accepts a file patch and returns the filename
func getFileName(f fdiff.FilePatch) string {
fn := "???"
from, to := f.Files()
if from != nil {
return from.Path()
} else if to != nil {
return to.Path()
}
return fn
}
// getShannonEntropy https://en.wiktionary.org/wiki/Shannon_entropy
func shannonEntropy(data string) (entropy float64) {
if data == "" {
return 0
}
charCounts := make(map[rune]int)
for _, char := range data {
charCounts[char]++
}
invLength := 1.0 / float64(len(data))
for _, count := range charCounts {
freq := float64(count) * invLength
entropy -= freq * math.Log2(freq)
}
return entropy
}
// aws_access_key_id='AKIAIO5FODNN7EXAMPLE',
// trippedEntropy checks if a given line falls in between entropy ranges supplied
// by a custom gitleaks configuration. Gitleaks do not check entropy by default.
func trippedEntropy(line string, rule config.Rule) bool {
for _, e := range rule.Entropy {
entropy := shannonEntropy(line)
if entropy > e.P1 && entropy < e.P2 {
return true
}
}
return false
}
func ruleContainRegex(rule config.Rule) bool {
if rule.Regex == nil {
return false
}
if rule.Regex.String() == "" {
return false
}
return true
}
// InspectString accepts a string, commit object, repo, and filename. This function iterates over
// all the rules set by the gitleaks config. If the rule contains entropy checks then entropy will be checked first.
// Next, if the rule contains a regular expression then that will be checked.
func InspectString(content string, c *object.Commit, repo *Repo, filename string) {
for _, rule := range repo.config.Rules {
// check entropy
if len(rule.Entropy) != 0 {
// an optimization would be to switch the regex from FindAllIndex to FindString
// since we are iterating on the lines if entropy rules exist...
for _, line := range strings.Split(content, "\n") {
if repo.timeoutReached() {
return
}
entropyTripped := trippedEntropy(line, rule)
if entropyTripped && !ruleContainRegex(rule) {
repo.Manager.SendLeaks(manager.Leak{
Line: line,
Offender: fmt.Sprintf("Entropy range %+v", rule.Entropy),
Commit: c.Hash.String(),
Repo: repo.Name,
Message: c.Message,
Rule: rule.Description,
Author: c.Author.Name,
Email: c.Author.Email,
Date: c.Author.When,
Tags: strings.Join(rule.Tags, ", "),
File: filename,
})
} else if entropyTripped {
if repo.timeoutReached() {
return
}
// entropy has been tripped which means if there is a regex specified in the same
// rule, we need to inspect the line for a regex match. In otherwords, the current rule has
// both entropy and regex set which work in combination. This helps narrow down false positives
// on searches for generic passwords in code.
match := rule.Regex.FindString(line)
// check if any rules are whitelisting this leak
if len(rule.Whitelist) != 0 {
for _, wl := range rule.Whitelist {
if fileMatched(filename, wl.File) {
// if matched, go to next rule
goto NEXTLINE
}
if wl.Regex.FindString(line) != "" {
goto NEXTLINE
}
}
}
if match != "" {
// both the regex and entropy in this rule have been tripped which means this line
// contains a leak
repo.Manager.SendLeaks(manager.Leak{
Line: line,
Offender: match,
Commit: c.Hash.String(),
Message: c.Message,
Repo: repo.Name,
Rule: rule.Description,
Author: c.Author.Name,
Email: c.Author.Email,
Date: c.Author.When,
Tags: strings.Join(rule.Tags, ", "),
File: filename,
})
}
}
NEXTLINE:
}
return
}
if rule.Regex.String() == "" {
continue
}
if repo.timeoutReached() {
return
}
start := time.Now()
locs := rule.Regex.FindAllIndex([]byte(content), -1)
if len(locs) != 0 {
// check if any rules are whitelisting this leak
if len(rule.Whitelist) != 0 {
for _, wl := range rule.Whitelist {
if fileMatched(filename, wl.File) {
// if matched, go to next rule
goto NEXT
}
}
}
for _, loc := range locs {
start := loc[0]
end := loc[1]
for start != 0 && content[start] != '\n' {
start = start - 1
}
if start != 0 {
// skip newline
start = start + 1
}
for end < len(content)-1 && content[end] != '\n' {
end = end + 1
}
offender := content[loc[0]:loc[1]]
line := content[start:end]
if len(rule.Whitelist) != 0 {
for _, wl := range rule.Whitelist {
if wl.Regex.FindString(line) != "" {
goto NEXT
}
}
}
if repo.Manager.Opts.Redact {
line = strings.ReplaceAll(line, offender, "REDACTED")
offender = "REDACTED"
}
repo.Manager.SendLeaks(manager.Leak{
Line: line,
Offender: offender,
Commit: c.Hash.String(),
Message: c.Message,
Repo: repo.Name,
Rule: rule.Description,
Author: c.Author.Name,
Email: c.Author.Email,
Date: c.Author.When,
Tags: strings.Join(rule.Tags, ", "),
File: filename,
})
}
}
repo.Manager.RecordTime(manager.RegexTime{
Time: time.Now().Sub(start).Nanoseconds(),
Regex: rule.Regex.String(),
})
NEXT:
}
}
// inspectCommit accepts a commit object and a repo. This function is only called when the --commit=
// option has been set. That option tells gitleaks to look only at a single commit and check the contents
// of said commit. Similar to inspectPatch(), if the files contained in the commit are a binaries or if they are
// whitelisted then those files will be skipped.
func inspectCommit(c *object.Commit, repo *Repo) error {
fIter, err := c.Files()
if err != nil {
return err
}
err = fIter.ForEach(func(f *object.File) error {
bin, err := f.IsBinary()
if bin || repo.timeoutReached() {
return nil
} else if err != nil {
return err
}
if fileMatched(f, repo.config.Whitelist.File) {
log.Debugf("whitelisted file found, skipping audit of file: %s", f.Name)
return nil
}
if fileMatched(f.Name, repo.config.FileRegex) {
repo.Manager.SendLeaks(manager.Leak{
Line: "N/A",
Offender: f.Name,
Commit: c.Hash.String(),
Repo: repo.Name,
Rule: "file regex matched" + repo.config.FileRegex.String(),
Author: c.Author.Name,
Email: c.Author.Email,
Date: c.Author.When,
File: f.Name,
})
}
content, err := f.Contents()
if err != nil {
return err
}
InspectString(content, c, repo, f.Name)
return nil
})
return err
}
// howManyThreads will return a number 1-GOMAXPROCS which is the number
// of goroutines that will spawn during gitleaks execution
func howManyThreads(threads int) int {
maxThreads := runtime.GOMAXPROCS(0)
if threads == 0 {
return 1
} else if threads > maxThreads {
log.Warnf("%d threads set too high, setting to system max, %d", threads, maxThreads)
return maxThreads
}
return threads
}
func isCommitWhiteListed(commitHash string, whitelistedCommits []string) bool {
for _, hash := range whitelistedCommits {
if commitHash == hash {
return true
}
}
return false
}
func fileMatched(f interface{}, re *regexp.Regexp) bool {
if re == nil {
return false
}
switch f.(type) {
case nil:
return false
case string:
if re.FindString(f.(string)) != "" {
return true
}
return false
case *object.File:
if re.FindString(f.(*object.File).Name) != "" {
return true
}
return false
}
return false
}
// getLogOptions determines what log options are used when iterating through commits.
// It is similar to `git log {branch}`. Default behavior is to log ALL branches so
// gitleaks gets the full git history.
func getLogOptions(repo *Repo) (*git.LogOptions, error) {
var logOpts git.LogOptions
if repo.Manager.Opts.CommitFrom != "" {
logOpts.From = plumbing.NewHash(repo.Manager.Opts.CommitFrom)
}
if repo.Manager.Opts.Branch != "" {
refs, err := repo.Storer.IterReferences()
if err != nil {
return nil, err
}
err = refs.ForEach(func(ref *plumbing.Reference) error {
if ref.Name().IsTag() {
return nil
}
// check heads first
if ref.Name().String() == "refs/heads/"+repo.Manager.Opts.Branch {
logOpts = git.LogOptions{
From: ref.Hash(),
}
return nil
} else if ref.Name().String() == "refs/remotes/origin/"+repo.Manager.Opts.Branch {
logOpts = git.LogOptions{
From: ref.Hash(),
}
return nil
}
return nil
})
if logOpts.From.IsZero() {
return nil, fmt.Errorf("could not find branch %s", repo.Manager.Opts.Branch)
}
return &logOpts, nil
}
if !logOpts.From.IsZero() {
return &logOpts, nil
}
return &git.LogOptions{All: true}, nil
}
// howLong accepts a time.Time object which is subtracted from time.Now() and
// converted to nanoseconds which is returned
func howLong(t time.Time) int64 {
return time.Now().Sub(t).Nanoseconds()
}
+129
View File
@@ -0,0 +1,129 @@
// The `detect` and `protect` command is now deprecated. Here are some equivalent commands
// to help guide you.
// OLD CMD: gitleaks detect --source={repo}
// NEW CMD: gitleaks git {repo}
// OLD CMD: gitleaks protect --source={repo}
// NEW CMD: gitleaks git --pre-commit {repo}
// OLD CMD: gitleaks protect --staged --source={repo}
// NEW CMD: gitleaks git --pre-commit --staged {repo}
// OLD CMD: gitleaks detect --no-git --source={repo}
// NEW CMD: gitleaks directory {directory/file}
// OLD CMD: gitleaks detect --no-git --pipe
// NEW CMD: gitleaks stdin
package cmd
import (
"os"
"time"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/zricethezav/gitleaks/v8/report"
"github.com/zricethezav/gitleaks/v8/sources"
)
func init() {
rootCmd.AddCommand(detectCmd)
detectCmd.Flags().Bool("no-git", false, "treat git repo as a regular directory and scan those files, --log-opts has no effect on the scan when --no-git is set")
detectCmd.Flags().Bool("pipe", false, "scan input from stdin, ex: `cat some_file | gitleaks detect --pipe`")
detectCmd.Flags().Bool("follow-symlinks", false, "scan files that are symlinks to other files")
detectCmd.Flags().StringP("source", "s", ".", "path to source")
detectCmd.Flags().String("log-opts", "", "git log options")
}
var detectCmd = &cobra.Command{
Use: "detect",
Short: "detect secrets in code",
Run: runDetect,
Hidden: true,
}
func runDetect(cmd *cobra.Command, args []string) {
source, err := cmd.Flags().GetString("source")
if err != nil {
log.Fatal().Err(err).Msg("could not get source")
}
initConfig(source)
var findings []report.Finding
// setup config (aka, the thing that defines rules)
cfg := Config(cmd)
// start timer
start := time.Now()
detector := Detector(cmd, cfg, source)
// set exit code
exitCode, err := cmd.Flags().GetInt("exit-code")
if err != nil {
log.Fatal().Err(err).Msg("could not get exit code")
}
// determine what type of scan:
// - git: scan the history of the repo
// - no-git: scan files by treating the repo as a plain directory
noGit, err := cmd.Flags().GetBool("no-git")
if err != nil {
log.Fatal().Err(err).Msg("could not call GetBool() for no-git")
}
fromPipe, err := cmd.Flags().GetBool("pipe")
if err != nil {
log.Fatal().Err(err).Msg("could not call GetBool() for pipe")
}
// start the detector scan
if noGit {
var paths <-chan sources.ScanTarget
paths, err = sources.DirectoryTargets(source, detector.Sema, detector.FollowSymlinks)
if err != nil {
log.Fatal().Err(err)
}
findings, err = detector.DetectFiles(paths)
if err != nil {
// don't exit on error, just log it
log.Error().Err(err).Msg("failed scan directory")
}
} else if fromPipe {
findings, err = detector.DetectReader(os.Stdin, 10)
if err != nil {
// log fatal to exit, no need to continue since a report
// will not be generated when scanning from a pipe...for now
log.Fatal().Err(err).Msg("failed scan input from stdin")
}
} else {
var (
gitCmd *sources.GitCmd
logOpts string
)
logOpts, err = cmd.Flags().GetString("log-opts")
if err != nil {
log.Fatal().Err(err).Msg("could not call GetString() for log-opts")
}
gitCmd, err = sources.NewGitLogCmd(source, logOpts)
if err != nil {
log.Fatal().Err(err).Msg("could not create Git cmd")
}
findings, err = detector.DetectGit(gitCmd)
if err != nil {
// don't exit on error, just log it
log.Error().Err(err).Msg("failed to scan Git repository")
}
}
// set follow symlinks flag
if detector.FollowSymlinks, err = cmd.Flags().GetBool("follow-symlinks"); err != nil {
log.Fatal().Err(err).Msg("")
}
findingSummaryAndExit(findings, cmd, cfg, exitCode, start, err)
}
+68
View File
@@ -0,0 +1,68 @@
package cmd
import (
"time"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/zricethezav/gitleaks/v8/report"
"github.com/zricethezav/gitleaks/v8/sources"
)
func init() {
rootCmd.AddCommand(directoryCmd)
directoryCmd.Flags().Bool("follow-symlinks", false, "scan files that are symlinks to other files")
}
var directoryCmd = &cobra.Command{
Use: "dir [flags] [path]",
Aliases: []string{"file", "directory"},
Short: "scan directories or files for secrets",
Run: runDirectory,
}
func runDirectory(cmd *cobra.Command, args []string) {
// grab source
source := "."
if len(args) == 1 {
source = args[0]
if source == "" {
source = "."
}
}
initConfig(source)
var (
findings []report.Finding
err error
)
// setup config (aka, the thing that defines rules)
cfg := Config(cmd)
// start timer
start := time.Now()
detector := Detector(cmd, cfg, source)
// set exit code
exitCode, err := cmd.Flags().GetInt("exit-code")
if err != nil {
log.Fatal().Err(err).Msg("could not get exit code")
}
var paths <-chan sources.ScanTarget
paths, err = sources.DirectoryTargets(source, detector.Sema, detector.FollowSymlinks)
if err != nil {
log.Fatal().Err(err)
}
findings, err = detector.DetectFiles(paths)
if err != nil {
// don't exit on error, just log it
log.Error().Err(err).Msg("failed scan directory")
}
findingSummaryAndExit(findings, cmd, cfg, exitCode, start, err)
}
+234
View File
@@ -0,0 +1,234 @@
package main
import (
"os"
"text/template"
"github.com/rs/zerolog/log"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/rules"
"github.com/zricethezav/gitleaks/v8/config"
)
const (
templatePath = "rules/config.tmpl"
)
//go:generate go run $GOFILE ../../../config/gitleaks.toml
func main() {
if len(os.Args) < 2 {
os.Stderr.WriteString("Specify path to the gitleaks.toml config\n")
os.Exit(2)
}
gitleaksConfigPath := os.Args[1]
configRules := []*config.Rule{
rules.AdafruitAPIKey(),
rules.AdobeClientID(),
rules.AdobeClientSecret(),
rules.AgeSecretKey(),
rules.Airtable(),
rules.AlgoliaApiKey(),
rules.AlibabaAccessKey(),
rules.AlibabaSecretKey(),
rules.AsanaClientID(),
rules.AsanaClientSecret(),
rules.Atlassian(),
rules.Authress(),
rules.AWS(),
rules.BitBucketClientID(),
rules.BitBucketClientSecret(),
rules.BittrexAccessKey(),
rules.BittrexSecretKey(),
rules.Beamer(),
rules.CodecovAccessToken(),
rules.CoinbaseAccessToken(),
rules.Clojars(),
rules.CloudflareAPIKey(),
rules.CloudflareGlobalAPIKey(),
rules.CloudflareOriginCAKey(),
rules.ConfluentAccessToken(),
rules.ConfluentSecretKey(),
rules.Contentful(),
rules.Databricks(),
rules.DatadogtokenAccessToken(),
rules.DefinedNetworkingAPIToken(),
rules.DigitalOceanPAT(),
rules.DigitalOceanOAuthToken(),
rules.DigitalOceanRefreshToken(),
rules.DiscordAPIToken(),
rules.DiscordClientID(),
rules.DiscordClientSecret(),
rules.Doppler(),
rules.DropBoxAPISecret(),
rules.DropBoxLongLivedAPIToken(),
rules.DropBoxShortLivedAPIToken(),
rules.DroneciAccessToken(),
rules.Duffel(),
rules.Dynatrace(),
rules.EasyPost(),
rules.EasyPostTestAPI(),
rules.EtsyAccessToken(),
rules.FacebookSecret(),
rules.FacebookAccessToken(),
rules.FacebookPageAccessToken(),
rules.FastlyAPIToken(),
rules.FinicityClientSecret(),
rules.FinicityAPIToken(),
rules.FlickrAccessToken(),
rules.FinnhubAccessToken(),
rules.FlutterwavePublicKey(),
rules.FlutterwaveSecretKey(),
rules.FlutterwaveEncKey(),
rules.FrameIO(),
rules.FreshbooksAccessToken(),
rules.GoCardless(),
// TODO figure out what makes sense for GCP
// rules.GCPServiceAccount(),
rules.GCPAPIKey(),
rules.GitHubPat(),
rules.GitHubFineGrainedPat(),
rules.GitHubOauth(),
rules.GitHubApp(),
rules.GitHubRefresh(),
rules.GitlabPat(),
rules.GitlabPipelineTriggerToken(),
rules.GitlabRunnerRegistrationToken(),
rules.GitterAccessToken(),
rules.GrafanaApiKey(),
rules.GrafanaCloudApiToken(),
rules.GrafanaServiceAccountToken(),
rules.HarnessApiKey(),
rules.HashiCorpTerraform(),
rules.HashicorpField(),
rules.Heroku(),
rules.HubSpot(),
rules.HuggingFaceAccessToken(),
rules.HuggingFaceOrganizationApiToken(),
rules.Intercom(),
rules.Intra42ClientSecret(),
rules.JFrogAPIKey(),
rules.JFrogIdentityToken(),
rules.JWT(),
rules.JWTBase64(),
rules.KrakenAccessToken(),
rules.KubernetesSecretWithDataAfter(),
rules.KubernetesSecretWithDataBefore(),
rules.KucoinAccessToken(),
rules.KucoinSecretKey(),
rules.LaunchDarklyAccessToken(),
rules.LinearAPIToken(),
rules.LinearClientSecret(),
rules.LinkedinClientID(),
rules.LinkedinClientSecret(),
rules.LobAPIToken(),
rules.LobPubAPIToken(),
rules.MailChimp(),
rules.MailGunPubAPIToken(),
rules.MailGunPrivateAPIToken(),
rules.MailGunSigningKey(),
rules.MapBox(),
rules.MattermostAccessToken(),
rules.MessageBirdAPIToken(),
rules.MessageBirdClientID(),
rules.NetlifyAccessToken(),
rules.NewRelicUserID(),
rules.NewRelicUserKey(),
rules.NewRelicBrowserAPIKey(),
rules.NewRelicInsertKey(),
rules.NPM(),
rules.NytimesAccessToken(),
rules.OktaAccessToken(),
rules.OpenAI(),
rules.OpenshiftUserToken(),
rules.PlaidAccessID(),
rules.PlaidSecretKey(),
rules.PlaidAccessToken(),
rules.PlanetScalePassword(),
rules.PlanetScaleAPIToken(),
rules.PlanetScaleOAuthToken(),
rules.PostManAPI(),
rules.Prefect(),
rules.PrivateKey(),
rules.PulumiAPIToken(),
rules.PyPiUploadToken(),
rules.RapidAPIAccessToken(),
rules.ReadMe(),
rules.RubyGemsAPIToken(),
rules.ScalingoAPIToken(),
rules.SendbirdAccessID(),
rules.SendbirdAccessToken(),
rules.SendGridAPIToken(),
rules.SendInBlueAPIToken(),
rules.SentryAccessToken(),
rules.ShippoAPIToken(),
rules.ShopifyAccessToken(),
rules.ShopifyCustomAccessToken(),
rules.ShopifyPrivateAppAccessToken(),
rules.ShopifySharedSecret(),
rules.SidekiqSecret(),
rules.SidekiqSensitiveUrl(),
rules.SlackBotToken(),
rules.SlackUserToken(),
rules.SlackAppLevelToken(),
rules.SlackConfigurationToken(),
rules.SlackConfigurationRefreshToken(),
rules.SlackLegacyBotToken(),
rules.SlackLegacyWorkspaceToken(),
rules.SlackLegacyToken(),
rules.SlackWebHookUrl(),
rules.Snyk(),
rules.StripeAccessToken(),
rules.SquareAccessToken(),
rules.SquareSpaceAccessToken(),
rules.SumoLogicAccessID(),
rules.SumoLogicAccessToken(),
rules.TeamsWebhook(),
rules.TelegramBotToken(),
rules.TravisCIAccessToken(),
rules.Twilio(),
rules.TwitchAPIToken(),
rules.TwitterAPIKey(),
rules.TwitterAPISecret(),
rules.TwitterAccessToken(),
rules.TwitterAccessSecret(),
rules.TwitterBearerToken(),
rules.Typeform(),
rules.VaultBatchToken(),
rules.VaultServiceToken(),
rules.YandexAPIKey(),
rules.YandexAWSAccessToken(),
rules.YandexAccessToken(),
rules.ZendeskSecretKey(),
rules.GenericCredential(),
rules.InfracostAPIToken(),
}
// ensure rules have unique ids
ruleLookUp := make(map[string]config.Rule, len(configRules))
for _, rule := range configRules {
// check if rule is in ruleLookUp
if _, ok := ruleLookUp[rule.RuleID]; ok {
log.Fatal().Msgf("rule id %s is not unique", rule.RuleID)
}
// TODO: eventually change all the signatures to get ride of this
// nasty dereferencing.
ruleLookUp[rule.RuleID] = *rule
}
tmpl, err := template.ParseFiles(templatePath)
if err != nil {
log.Fatal().Err(err).Msg("Failed to parse template")
}
f, err := os.Create(gitleaksConfigPath)
if err != nil {
log.Fatal().Err(err).Msg("Failed to create rules.toml")
}
if err = tmpl.Execute(f, config.Config{Rules: ruleLookUp}); err != nil {
log.Fatal().Err(err).Msg("could not execute template")
}
}
+23
View File
@@ -0,0 +1,23 @@
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 AdafruitAPIKey() *config.Rule {
// define rule
r := config.Rule{
Description: "Identified a potential Adafruit API Key, which could lead to unauthorized access to Adafruit services and sensitive data exposure.",
RuleID: "adafruit-api-key",
Regex: utils.GenerateSemiGenericRegex([]string{"adafruit"}, utils.AlphaNumericExtendedShort("32"), true),
Keywords: []string{"adafruit"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("adafruit", secrets.NewSecret(utils.AlphaNumericExtendedShort("32"))),
}
return utils.Validate(r, tps, nil)
}
+39
View File
@@ -0,0 +1,39 @@
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 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",
Regex: utils.GenerateSemiGenericRegex([]string{"adobe"}, utils.Hex("32"), true),
Keywords: []string{"adobe"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("adobe", secrets.NewSecret(utils.Hex("32"))),
}
return utils.Validate(r, tps, nil)
}
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),
Keywords: []string{"p8e-"},
}
// validate
tps := []string{
"adobeClient := \"p8e-" + secrets.NewSecret(utils.Hex("32")) + "\"",
}
return utils.Validate(r, tps, nil)
}
+24
View File
@@ -0,0 +1,24 @@
package rules
import (
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"regexp"
"github.com/zricethezav/gitleaks/v8/config"
)
func AgeSecretKey() *config.Rule {
// define rule
r := config.Rule{
Description: "Discovered a potential Age encryption tool secret key, risking data decryption and unauthorized access to sensitive information.",
RuleID: "age-secret-key",
Regex: regexp.MustCompile(`AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}`),
Keywords: []string{"AGE-SECRET-KEY-1"},
}
// validate
tps := []string{
`apiKey := "AGE-SECRET-KEY-1QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ`, // gitleaks:allow
}
return utils.Validate(r, tps, nil)
}
+23
View File
@@ -0,0 +1,23 @@
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 Airtable() *config.Rule {
// define rule
r := config.Rule{
Description: "Uncovered a possible Airtable API Key, potentially compromising database access and leading to data leakage or alteration.",
RuleID: "airtable-api-key",
Regex: utils.GenerateSemiGenericRegex([]string{"airtable"}, utils.AlphaNumeric("17"), true),
Keywords: []string{"airtable"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("airtable", secrets.NewSecret(utils.AlphaNumeric("17"))),
}
return utils.Validate(r, tps, nil)
}
+23
View File
@@ -0,0 +1,23 @@
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 AlgoliaApiKey() *config.Rule {
// define rule
r := config.Rule{
Description: "Identified an Algolia API Key, which could result in unauthorized search operations and data exposure on Algolia-managed platforms.",
RuleID: "algolia-api-key",
Regex: utils.GenerateSemiGenericRegex([]string{"algolia"}, `[a-z0-9]{32}`, true),
Keywords: []string{"algolia"},
}
// validate
tps := []string{
"algolia_key := " + secrets.NewSecret(utils.Hex("32")),
}
return utils.Validate(r, tps, nil)
}
+42
View File
@@ -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"
)
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),
Keywords: []string{"LTAI"},
}
// validate
tps := []string{
"alibabaKey := \"LTAI" + secrets.NewSecret(utils.Hex("20")) + "\"",
}
return utils.Validate(r, tps, nil)
}
// TODO
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"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("alibaba", secrets.NewSecret(utils.AlphaNumeric("30"))),
}
return utils.Validate(r, tps, nil)
}
+40
View File
@@ -0,0 +1,40 @@
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 AsanaClientID() *config.Rule {
// define rule
r := config.Rule{
Description: "Discovered a potential Asana Client ID, risking unauthorized access to Asana projects and sensitive task information.",
RuleID: "asana-client-id",
Regex: utils.GenerateSemiGenericRegex([]string{"asana"}, utils.Numeric("16"), true),
Keywords: []string{"asana"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("asana", secrets.NewSecret(utils.Numeric("16"))),
}
return utils.Validate(r, tps, nil)
}
func AsanaClientSecret() *config.Rule {
// define rule
r := config.Rule{
Description: "Identified an Asana Client Secret, which could lead to compromised project management integrity and unauthorized access.",
RuleID: "asana-client-secret",
Regex: utils.GenerateSemiGenericRegex([]string{"asana"}, utils.AlphaNumeric("32"), true),
Keywords: []string{"asana"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("asana", secrets.NewSecret(utils.AlphaNumeric("32"))),
}
return utils.Validate(r, tps, nil)
}
+25
View File
@@ -0,0 +1,25 @@
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 Atlassian() *config.Rule {
// define rule
r := config.Rule{
Description: "Detected an Atlassian API token, posing a threat to project management and collaboration tool security and data confidentiality.",
RuleID: "atlassian-api-token",
Regex: utils.GenerateSemiGenericRegex([]string{
"atlassian", "confluence", "jira"}, utils.AlphaNumeric("24"), true),
Keywords: []string{"atlassian", "confluence", "jira"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("atlassian", secrets.NewSecret(utils.AlphaNumeric("24"))),
utils.GenerateSampleSecret("confluence", secrets.NewSecret(utils.AlphaNumeric("24"))),
}
return utils.Validate(r, tps, nil)
}
+32
View File
@@ -0,0 +1,32 @@
package rules
import (
"fmt"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
)
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),
Keywords: []string{"sc_", "ext_", "scauth_", "authress_"},
}
// validate
// https://authress.io/knowledge-base/docs/authorization/service-clients/secrets-scanning/#1-detection
service_client_id := "sc_" + utils.AlphaNumeric("10")
access_key_id := utils.AlphaNumeric("4")
account_id := "acc_" + utils.AlphaNumeric("10")
signature_key := utils.AlphaNumericExtendedShort("40")
tps := []string{
utils.GenerateSampleSecret("authress", secrets.NewSecret(fmt.Sprintf(`%s\.%s\.%s\.%s`, service_client_id, access_key_id, account_id, signature_key))),
}
return utils.Validate(r, tps, nil)
}
+28
View File
@@ -0,0 +1,28 @@
package rules
import (
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"regexp"
"github.com/zricethezav/gitleaks/v8/config"
)
func AWS() *config.Rule {
// define 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}"),
Keywords: []string{
"AKIA",
"ASIA",
"ABIA",
"ACCA",
},
}
// validate
tps := []string{utils.GenerateSampleSecret("AWS", "AKIALALEMEL33243OLIB")} // gitleaks:allow
return utils.Validate(r, tps, nil)
}
+24
View File
@@ -0,0 +1,24 @@
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 Beamer() *config.Rule {
// define rule
r := config.Rule{
Description: "Detected a Beamer API token, potentially compromising content management and exposing sensitive notifications and updates.",
RuleID: "beamer-api-token",
Regex: utils.GenerateSemiGenericRegex([]string{"beamer"},
`b_[a-z0-9=_\-]{44}`, true),
Keywords: []string{"beamer"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("beamer", "b_"+secrets.NewSecret(utils.AlphaNumericExtended("44"))),
}
return utils.Validate(r, tps, nil)
}
+40
View File
@@ -0,0 +1,40 @@
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 BitBucketClientID() *config.Rule {
// define rule
r := config.Rule{
Description: "Discovered a potential Bitbucket Client ID, risking unauthorized repository access and potential codebase exposure.",
RuleID: "bitbucket-client-id",
Regex: utils.GenerateSemiGenericRegex([]string{"bitbucket"}, utils.AlphaNumeric("32"), true),
Keywords: []string{"bitbucket"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("bitbucket", secrets.NewSecret(utils.AlphaNumeric("32"))),
}
return utils.Validate(r, tps, nil)
}
func BitBucketClientSecret() *config.Rule {
// define rule
r := config.Rule{
Description: "Discovered a potential Bitbucket Client Secret, posing a risk of compromised code repositories and unauthorized access.",
RuleID: "bitbucket-client-secret",
Regex: utils.GenerateSemiGenericRegex([]string{"bitbucket"}, utils.AlphaNumericExtended("64"), true),
Keywords: []string{"bitbucket"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("bitbucket", secrets.NewSecret(utils.AlphaNumeric("64"))),
}
return utils.Validate(r, tps, nil)
}
+40
View File
@@ -0,0 +1,40 @@
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 BittrexAccessKey() *config.Rule {
// define rule
r := config.Rule{
Description: "Identified a Bittrex Access Key, which could lead to unauthorized access to cryptocurrency trading accounts and financial loss.",
RuleID: "bittrex-access-key",
Regex: utils.GenerateSemiGenericRegex([]string{"bittrex"}, utils.AlphaNumeric("32"), true),
Keywords: []string{"bittrex"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("bittrex", secrets.NewSecret(utils.AlphaNumeric("32"))),
}
return utils.Validate(r, tps, nil)
}
func BittrexSecretKey() *config.Rule {
// define rule
r := config.Rule{
Description: "Detected a Bittrex Secret Key, potentially compromising cryptocurrency transactions and financial security.",
RuleID: "bittrex-secret-key",
Regex: utils.GenerateSemiGenericRegex([]string{"bittrex"}, utils.AlphaNumeric("32"), true),
Keywords: []string{"bittrex"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("bittrex", secrets.NewSecret(utils.AlphaNumeric("32"))),
}
return utils.Validate(r, tps, nil)
}
+25
View File
@@ -0,0 +1,25 @@
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"
)
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",
Regex: regexp.MustCompile(`(?i)CLOJARS_[a-z0-9]{60}`),
Keywords: []string{"clojars"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("clojars", "CLOJARS_"+secrets.NewSecret(utils.AlphaNumeric("60"))),
}
return utils.Validate(r, tps, nil)
}
+77
View File
@@ -0,0 +1,77 @@
package rules
import (
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
)
var global_keys = []string{
`cloudflare_global_api_key = "d3d1443e0adc9c24564c6c5676d679d47e2ca"`, // gitleaks:allow
`CLOUDFLARE_GLOBAL_API_KEY: 674538c7ecac77d064958a04a83d9e9db068c`, // gitleaks:allow
`cloudflare: "0574b9f43978174cc2cb9a1068681225433c4"`, // gitleaks:allow
}
var api_keys = []string{
`cloudflare_api_key = "Bu0rrK-lerk6y0Suqo1qSqlDDajOk61wZchCkje4"`, // gitleaks:allow
`CLOUDFLARE_API_KEY: 5oK0U90ME14yU6CVxV90crvfqVlNH2wRKBwcLWDc`, // gitleaks:allow
`cloudflare: "oj9Yoyq0zmOyWmPPob1aoY5YSNNuJ0fbZSOURBlX"`, // gitleaks:allow
}
var origin_ca_keys = []string{
`CLOUDFLARE_ORIGIN_CA: v1.0-aaa334dc886f30631ba0a610-0d98ef66290d7e50aac7c27b5986c99e6f3f1084c881d8ac0eae5de1d1aa0644076ff57022069b3237d19afe60ad045f207ef2b16387ee37b749441b2ae2e9ebe5b4606e846475d4a5`,
`CLOUDFLARE_ORIGIN_CA: v1.0-15d20c7fccb4234ac5cdd756-d5c2630d1b606535cf9320ae7456b090e0896cec64169a92fae4e931ab0f72f111b2e4ffed5b2bb40f6fba6b2214df23b188a23693d59ce3fb0d28f7e89a2206d98271b002dac695ed`,
}
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",
Regex: utils.GenerateSemiGenericRegex(identifiers, utils.Hex("37"), true),
Keywords: identifiers,
}
// validate
tps := global_keys
fps := append(api_keys, origin_ca_keys...)
return utils.Validate(r, tps, fps)
}
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",
Regex: utils.GenerateSemiGenericRegex(identifiers, utils.AlphaNumericExtendedShort("40"), true),
Keywords: identifiers,
}
// validate
tps := api_keys
fps := append(global_keys, origin_ca_keys...)
return utils.Validate(r, tps, fps)
}
func CloudflareOriginCAKey() *config.Rule {
ca_identifiers := append(identifiers, "v1.0-")
// define rule
r := 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,
}
// validate
tps := origin_ca_keys
fps := append(global_keys, api_keys...)
return utils.Validate(r, tps, fps)
}
+25
View File
@@ -0,0 +1,25 @@
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 CodecovAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "codecov-access-token",
Description: "Found a pattern resembling a Codecov Access Token, posing a risk of unauthorized access to code coverage reports and sensitive data.",
Regex: utils.GenerateSemiGenericRegex([]string{"codecov"}, utils.AlphaNumeric("32"), true),
Keywords: []string{
"codecov",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("codecov", secrets.NewSecret(utils.AlphaNumeric("32"))),
}
return utils.Validate(r, tps, nil)
}
+27
View File
@@ -0,0 +1,27 @@
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 CoinbaseAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "coinbase-access-token",
Description: "Detected a Coinbase Access Token, posing a risk of unauthorized access to cryptocurrency accounts and financial transactions.",
Regex: utils.GenerateSemiGenericRegex([]string{"coinbase"},
utils.AlphaNumericExtendedShort("64"), true),
Keywords: []string{
"coinbase",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("coinbase",
secrets.NewSecret(utils.AlphaNumericExtendedShort("64"))),
}
return utils.Validate(r, tps, nil)
}
+66
View File
@@ -0,0 +1,66 @@
# This file has been auto-generated. Do not edit manually.
# If you would like to contribute new rules, please use
# cmd/generate/config/main.go and follow the contributing guidelines
# at https://github.com/zricethezav/gitleaks/blob/master/CONTRIBUTING.md
# This is the default gitleaks configuration file.
# Rules and allowlists are defined within this file.
# Rules instruct gitleaks on what should be considered a secret.
# Allowlists instruct gitleaks on what is allowed, i.e. not a secret.
title = "gitleaks config"
[allowlist]
description = "global allow lists"
paths = [
'''gitleaks.toml''',
'''(.*?)(jpg|gif|doc|docx|zip|xls|pdf|bin|svg|socket|vsidx|v2|suo|wsuo|.dll|pdb|exe)$''',
'''(go.mod|go.sum|go.work|go.work.sum)$''',
'''gradle.lockfile''',
'''verification-metadata.xml''',
'''node_modules''',
'''package-lock.json''',
'''yarn.lock''',
'''pnpm-lock.yaml''',
'''poetry.lock''',
'''Database.refactorlog''',
'''vendor''',
]
{{ range $i, $rule := .Rules }}[[rules]]
id = "{{$rule.RuleID}}"
description = "{{$rule.Description}}"
regex = '''{{$rule.Regex}}'''
{{- with $rule.Path }}
path = '''{{ . }}'''{{ end -}}
{{- with $rule.SecretGroup }}
secretGroup = {{ . }}{{ end -}}
{{- with $rule.Entropy }}
entropy = {{ . }}{{ end -}}
{{- with $rule.Keywords }}
keywords = [
{{ range $j, $keyword := . }}"{{ $keyword }}",{{ end }}
]{{ end }}
{{- with $rule.Tags }}
tags = [
{{ range $j, $tag := . }}"{{ $tag }}",{{ end }}
]{{ end }}
{{ if or $rule.Allowlist.Regexes $rule.Allowlist.Paths $rule.Allowlist.Commits $rule.Allowlist.StopWords }}
[rules.allowlist]
{{ with $rule.Allowlist.RegexTarget }}
regexTarget = "{{ . }}"{{ end -}}
{{- with $rule.Allowlist.Regexes }}
regexes = [
{{ range $j, $regex := . }}"{{ $regex }}",{{ end }}
]{{ end }}
{{- with $rule.Allowlist.Paths }}paths = [
{{ range $j, $path := . }}"{{ $path }}",{{ end }}
]{{ end }}
{{- with $rule.Allowlist.Commits }}commits = [
{{ range $j, $commit := . }}"{{ $commit }}",{{ end }}
]{{ end }}
{{- with $rule.Allowlist.StopWords }}stopwords = [{{ range $j, $stopword := . }}
"{{ $stopword }}",{{ end }}
]{{ end }}
{{ end }}
{{ end }}
+44
View File
@@ -0,0 +1,44 @@
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 ConfluentSecretKey() *config.Rule {
// define rule
r := config.Rule{
RuleID: "confluent-secret-key",
Description: "Found a Confluent Secret Key, potentially risking unauthorized operations and data access within Confluent services.",
Regex: utils.GenerateSemiGenericRegex([]string{"confluent"}, utils.AlphaNumeric("64"), true),
Keywords: []string{
"confluent",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("confluent", secrets.NewSecret(utils.AlphaNumeric("64"))),
}
return utils.Validate(r, tps, nil)
}
func ConfluentAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "confluent-access-token",
Description: "Identified a Confluent Access Token, which could compromise access to streaming data platforms and sensitive data flow.",
Regex: utils.GenerateSemiGenericRegex([]string{"confluent"}, utils.AlphaNumeric("16"), true),
Keywords: []string{
"confluent",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("confluent", secrets.NewSecret(utils.AlphaNumeric("16"))),
}
return utils.Validate(r, tps, nil)
}
+24
View File
@@ -0,0 +1,24 @@
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 Contentful() *config.Rule {
// define rule
r := config.Rule{
Description: "Discovered a Contentful delivery API token, posing a risk to content management systems and data integrity.",
RuleID: "contentful-delivery-api-token",
Regex: utils.GenerateSemiGenericRegex([]string{"contentful"},
utils.AlphaNumericExtended("43"), true),
Keywords: []string{"contentful"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("contentful", secrets.NewSecret(utils.AlphaNumeric("43"))),
}
return utils.Validate(r, tps, nil)
}
+23
View File
@@ -0,0 +1,23 @@
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 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),
Keywords: []string{"dapi"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("databricks", "dapi"+secrets.NewSecret(utils.Hex("32"))),
}
return utils.Validate(r, tps, nil)
}
+26
View File
@@ -0,0 +1,26 @@
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 DatadogtokenAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "datadog-access-token",
Description: "Detected a Datadog Access Token, potentially risking monitoring and analytics data exposure and manipulation.",
Regex: utils.GenerateSemiGenericRegex([]string{"datadog"},
utils.AlphaNumeric("40"), true),
Keywords: []string{
"datadog",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("datadog", secrets.NewSecret(utils.AlphaNumeric("40"))),
}
return utils.Validate(r, tps, nil)
}
@@ -0,0 +1,30 @@
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 DefinedNetworkingAPIToken() *config.Rule {
// Define Rule
r := config.Rule{
// Human redable description of the rule
Description: "Identified a Defined Networking API token, which could lead to unauthorized network operations and data breaches.",
// Unique ID for the rule
RuleID: "defined-networking-api-token",
// Regex used for detecting secrets. See regex section below for more details
Regex: utils.GenerateSemiGenericRegex([]string{"dnkey"}, `dnkey-[a-z0-9=_\-]{26}-[a-z0-9=_\-]{52}`, true),
// Keywords used for string matching on fragments (think of this as a prefilter)
Keywords: []string{"dnkey"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("dnkey", "dnkey-"+secrets.NewSecret(utils.AlphaNumericExtended("26"))+"-"+secrets.NewSecret(utils.AlphaNumericExtended("52"))),
}
return utils.Validate(r, tps, nil)
}
+51
View File
@@ -0,0 +1,51 @@
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 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),
Keywords: []string{"dop_v1_"},
}
tps := []string{
utils.GenerateSampleSecret("do", "dop_v1_"+secrets.NewSecret(utils.Hex("64"))),
}
return utils.Validate(r, tps, nil)
}
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_"},
}
tps := []string{
utils.GenerateSampleSecret("do", "doo_v1_"+secrets.NewSecret(utils.Hex("64"))),
}
return utils.Validate(r, tps, nil)
}
func DigitalOceanRefreshToken() *config.Rule {
r := config.Rule{
Description: "Uncovered a DigitalOcean OAuth Refresh Token, which could allow prolonged unauthorized access and resource manipulation.",
RuleID: "digitalocean-refresh-token",
Regex: utils.GenerateUniqueTokenRegex(`dor_v1_[a-f0-9]{64}`, true),
Keywords: []string{"dor_v1_"},
}
tps := []string{
utils.GenerateSampleSecret("do", "dor_v1_"+secrets.NewSecret(utils.Hex("64"))),
}
return utils.Validate(r, tps, nil)
}
+55
View File
@@ -0,0 +1,55 @@
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 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",
Regex: utils.GenerateSemiGenericRegex([]string{"discord"}, utils.Hex("64"), true),
Keywords: []string{"discord"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("discord", secrets.NewSecret(utils.Hex("64"))),
}
return utils.Validate(r, tps, nil)
}
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",
Regex: utils.GenerateSemiGenericRegex([]string{"discord"}, utils.Numeric("18"), true),
Keywords: []string{"discord"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("discord", secrets.NewSecret(utils.Numeric("18"))),
}
return utils.Validate(r, tps, nil)
}
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",
Regex: utils.GenerateSemiGenericRegex([]string{"discord"}, utils.AlphaNumericExtended("32"), true),
Keywords: []string{"discord"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("discord", secrets.NewSecret(utils.Numeric("32"))),
}
return utils.Validate(r, tps, nil)
}
+28
View File
@@ -0,0 +1,28 @@
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"
)
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",
Regex: regexp.MustCompile(`dp\.pt\.(?i)[a-z0-9]{43}`),
Keywords: []string{"doppler"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("doppler", "dp.pt."+secrets.NewSecret(utils.AlphaNumeric("43"))),
}
return utils.Validate(r, tps, nil)
}
// TODO add additional doppler formats:
// https://docs.doppler.com/reference/auth-token-formats
+26
View File
@@ -0,0 +1,26 @@
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 DroneciAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "droneci-access-token",
Description: "Detected a Droneci Access Token, potentially compromising continuous integration and deployment workflows.",
Regex: utils.GenerateSemiGenericRegex([]string{"droneci"}, utils.AlphaNumeric("32"), true),
Keywords: []string{
"droneci",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("droneci", secrets.NewSecret(utils.AlphaNumeric("32"))),
}
return utils.Validate(r, tps, nil)
}
+50
View File
@@ -0,0 +1,50 @@
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 DropBoxAPISecret() *config.Rule {
// define rule
r := config.Rule{
Description: "Identified a Dropbox API secret, which could lead to unauthorized file access and data breaches in Dropbox storage.",
RuleID: "dropbox-api-token",
Regex: utils.GenerateSemiGenericRegex([]string{"dropbox"}, utils.AlphaNumeric("15"), true),
Keywords: []string{"dropbox"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("dropbox", secrets.NewSecret(utils.AlphaNumeric("15"))),
}
return utils.Validate(r, tps, nil)
}
func DropBoxShortLivedAPIToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "dropbox-short-lived-api-token",
Description: "Discovered a Dropbox short-lived API token, posing a risk of temporary but potentially harmful data access and manipulation.",
Regex: utils.GenerateSemiGenericRegex([]string{"dropbox"}, `sl\.[a-z0-9\-=_]{135}`, true),
Keywords: []string{"dropbox"},
}
// validate TODO
return &r
}
func DropBoxLongLivedAPIToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "dropbox-long-lived-api-token",
Description: "Found a Dropbox long-lived API token, risking prolonged unauthorized access to cloud storage and sensitive data.",
Regex: utils.GenerateSemiGenericRegex([]string{"dropbox"}, `[a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\-_=]{43}`, true),
Keywords: []string{"dropbox"},
}
// validate TODO
return &r
}
+25
View File
@@ -0,0 +1,25 @@
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"
)
func Duffel() *config.Rule {
// define rule
r := 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"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("duffel", "duffel_test_"+secrets.NewSecret(utils.AlphaNumericExtended("43"))),
}
return utils.Validate(r, tps, nil)
}
+25
View File
@@ -0,0 +1,25 @@
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"
)
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",
Regex: regexp.MustCompile(`dt0c01\.(?i)[a-z0-9]{24}\.[a-z0-9]{64}`),
Keywords: []string{"dynatrace"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("dynatrace", "dt0c01."+secrets.NewSecret(utils.AlphaNumeric("24"))+"."+secrets.NewSecret(utils.AlphaNumeric("64"))),
}
return utils.Validate(r, tps, nil)
}
+41
View File
@@ -0,0 +1,41 @@
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"
)
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",
Regex: regexp.MustCompile(`\bEZAK(?i)[a-z0-9]{54}`),
Keywords: []string{"EZAK"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("EZAK", "EZAK"+secrets.NewSecret(utils.AlphaNumeric("54"))),
}
return utils.Validate(r, tps, nil)
}
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",
Regex: regexp.MustCompile(`\bEZTK(?i)[a-z0-9]{54}`),
Keywords: []string{"EZTK"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("EZTK", "EZTK"+secrets.NewSecret(utils.AlphaNumeric("54"))),
}
return utils.Validate(r, tps, nil)
}
+26
View File
@@ -0,0 +1,26 @@
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 EtsyAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "etsy-access-token",
Description: "Found an Etsy Access Token, potentially compromising Etsy shop management and customer data.",
Regex: utils.GenerateSemiGenericRegex([]string{"etsy"}, utils.AlphaNumeric("24"), true),
Keywords: []string{
"etsy",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("etsy", secrets.NewSecret(utils.AlphaNumeric("24"))),
}
return utils.Validate(r, tps, nil)
}
+66
View File
@@ -0,0 +1,66 @@
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"
)
// This rule includes both App Secret and Client Access Token
// https://developers.facebook.com/docs/facebook-login/guides/access-tokens/
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",
Regex: utils.GenerateSemiGenericRegex([]string{"facebook"}, utils.Hex("32"), true),
Keywords: []string{"facebook"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("facebook", secrets.NewSecret(utils.Hex("32"))),
`facebook_app_secret = "6dca6432e45d933e13650d1882bd5e69"`, // gitleaks:allow
`facebook_client_access_token: 26f5fd13099f2c1331aafb86f6489692`, // gitleaks:allow
}
return utils.Validate(r, tps, nil)
}
// https://developers.facebook.com/docs/facebook-login/guides/access-tokens/#apptokens
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",
Regex: utils.GenerateUniqueTokenRegex(`\d{15,16}(\||%)[0-9a-z\-_]{27,40}`, true),
}
// validate
tps := []string{
`{"access_token":"911602140448729|AY-lRJZq9BoDLobvAiP25L7RcMg","token_type":"bearer"}`, // gitleaks:allow
`1308742762612587|rhoK1cbv0DOU_RTX_87O4MkX7AI`, // gitleaks:allow
`1477036645700765|wRPf2v3mt2JfMqCLK8n7oltrEmc`, // gitleaks:allow
}
return utils.Validate(r, tps, nil)
}
// https://developers.facebook.com/docs/facebook-login/guides/access-tokens/#pagetokens
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),
Keywords: []string{"EAAM", "EAAC"},
}
// validate
tps := []string{
`EAAM9GOnCB9kBO2frzOAWGN2zMnZClQshlWydZCrBNdodesbwimx1mfVJgqZBP5RSpMfUzWhtjTTXHG5I1UlvlwRZCgjm3ZBVGeTYiqAAoxyED6HaUdhpGVNoPUwAuAWWFsi9OvyYBQt22DGLqMIgD7VktuCTTZCWKasz81Q822FPhMTB9VFFyClNzQ0NLZClt9zxpsMMrUZCo1VU1rL3CKavir5QTfBjfCEzHNlWAUDUV2YZD`, // gitleaks:allow
`EAAM9GOnCB9kBO2zXpAtRBmCrsPPjdA3KeBl4tqsEpcYd09cpjm9MZCBIklZBjIQBKGIJgFwm8IE17G5pipsfRBRBEHMWxvJsL7iHLUouiprxKRQfAagw8BEEDucceqxTiDhVW2IZAQNNbf0d1JhcapAGntx5S1Csm4j0GgZB3DuUfI2HJ9aViTtdfH2vjBy0wtpXm2iamevohGfoF4NgyRHusDLjqy91uYMkfrkc`, // gitleaks:allow
`- name: FACEBOOK_TOKEN
value: "EAACEdEose0cBA1bad3afsf2aew"`, // gitleaks:allow
}
return utils.Validate(r, tps, nil)
}
+24
View File
@@ -0,0 +1,24 @@
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 FastlyAPIToken() *config.Rule {
// define rule
r := config.Rule{
Description: "Uncovered a Fastly API key, which may compromise CDN and edge cloud services, leading to content delivery and security issues.",
RuleID: "fastly-api-token",
Regex: utils.GenerateSemiGenericRegex([]string{"fastly"}, utils.AlphaNumericExtended("32"), true),
Keywords: []string{"fastly"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("fastly", secrets.NewSecret(utils.AlphaNumericExtended("32"))),
}
return utils.Validate(r, tps, nil)
}
+41
View File
@@ -0,0 +1,41 @@
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 FinicityClientSecret() *config.Rule {
// define rule
r := config.Rule{
Description: "Identified a Finicity Client Secret, which could lead to compromised financial service integrations and data breaches.",
RuleID: "finicity-client-secret",
Regex: utils.GenerateSemiGenericRegex([]string{"finicity"}, utils.AlphaNumeric("20"), true),
Keywords: []string{"finicity"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("finicity", secrets.NewSecret(utils.AlphaNumeric("20"))),
}
return utils.Validate(r, tps, nil)
}
func FinicityAPIToken() *config.Rule {
// define rule
r := config.Rule{
Description: "Detected a Finicity API token, potentially risking financial data access and unauthorized financial operations.",
RuleID: "finicity-api-token",
Regex: utils.GenerateSemiGenericRegex([]string{"finicity"}, utils.Hex("32"), true),
Keywords: []string{"finicity"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("finicity", secrets.NewSecret(utils.Hex("32"))),
}
return utils.Validate(r, tps, nil)
}
+26
View File
@@ -0,0 +1,26 @@
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 FinnhubAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "finnhub-access-token",
Description: "Found a Finnhub Access Token, risking unauthorized access to financial market data and analytics.",
Regex: utils.GenerateSemiGenericRegex([]string{"finnhub"}, utils.AlphaNumeric("20"), true),
Keywords: []string{
"finnhub",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("finnhub", secrets.NewSecret(utils.AlphaNumeric("20"))),
}
return utils.Validate(r, tps, nil)
}
+26
View File
@@ -0,0 +1,26 @@
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 FlickrAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "flickr-access-token",
Description: "Discovered a Flickr Access Token, posing a risk of unauthorized photo management and potential data leakage.",
Regex: utils.GenerateSemiGenericRegex([]string{"flickr"}, utils.AlphaNumeric("32"), true),
Keywords: []string{
"flickr",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("flickr", secrets.NewSecret(utils.AlphaNumeric("32"))),
}
return utils.Validate(r, tps, nil)
}
+57
View File
@@ -0,0 +1,57 @@
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"
)
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",
Regex: regexp.MustCompile(`FLWPUBK_TEST-(?i)[a-h0-9]{32}-X`),
Keywords: []string{"FLWPUBK_TEST"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("flutterwavePubKey", "FLWPUBK_TEST-"+secrets.NewSecret(utils.Hex("32"))+"-X"),
}
return utils.Validate(r, tps, nil)
}
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",
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{32}-X`),
Keywords: []string{"FLWSECK_TEST"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("flutterwavePubKey", "FLWSECK_TEST-"+secrets.NewSecret(utils.Hex("32"))+"-X"),
}
return utils.Validate(r, tps, nil)
}
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",
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{12}`),
Keywords: []string{"FLWSECK_TEST"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("flutterwavePubKey", "FLWSECK_TEST-"+secrets.NewSecret(utils.Hex("12"))),
}
return utils.Validate(r, tps, nil)
}
+25
View File
@@ -0,0 +1,25 @@
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"
)
func FrameIO() *config.Rule {
// define rule
r := config.Rule{
Description: "Found a Frame.io API token, potentially compromising video collaboration and project management.",
RuleID: "frameio-api-token",
Regex: regexp.MustCompile(`fio-u-(?i)[a-z0-9\-_=]{64}`),
Keywords: []string{"fio-u-"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("frameio", "fio-u-"+secrets.NewSecret(utils.AlphaNumericExtended("64"))),
}
return utils.Validate(r, tps, nil)
}
+26
View File
@@ -0,0 +1,26 @@
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 FreshbooksAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "freshbooks-access-token",
Description: "Discovered a Freshbooks Access Token, posing a risk to accounting software access and sensitive financial data exposure.",
Regex: utils.GenerateSemiGenericRegex([]string{"freshbooks"}, utils.AlphaNumeric("64"), true),
Keywords: []string{
"freshbooks",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("freshbooks", secrets.NewSecret(utils.AlphaNumeric("64"))),
}
return utils.Validate(r, tps, nil)
}
+45
View File
@@ -0,0 +1,45 @@
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"
)
// TODO this one could probably use some work
func GCPServiceAccount() *config.Rule {
// define rule
r := config.Rule{
Description: "Google (GCP) Service-account",
RuleID: "gcp-service-account",
Regex: regexp.MustCompile(`\"type\": \"service_account\"`),
Keywords: []string{`\"type\": \"service_account\"`},
}
// validate
tps := []string{
`"type": "service_account"`,
}
return utils.Validate(r, tps, nil)
}
func GCPAPIKey() *config.Rule {
// define rule
r := config.Rule{
RuleID: "gcp-api-key",
Description: "Uncovered a GCP API key, which could lead to unauthorized access to Google Cloud services and data breaches.",
Regex: utils.GenerateUniqueTokenRegex(`AIza[0-9A-Za-z\\-_]{35}`, true),
Keywords: []string{
"AIza",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("gcp", secrets.NewSecret(`AIza[0-9A-Za-z\\-_]{35}`)),
}
return utils.Validate(r, tps, nil)
}
+55
View File
@@ -0,0 +1,55 @@
package rules
import (
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
)
func GenericCredential() *config.Rule {
// define rule
r := 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{
"key",
"api",
"token",
"secret",
"client",
"passwd",
"password",
"auth",
"access",
}, `[0-9a-z\-_.=]{10,150}`, true),
Keywords: []string{
"key",
"api",
"token",
"secret",
"client",
"passwd",
"password",
"auth",
"access",
},
Entropy: 3.5,
Allowlist: config.Allowlist{
StopWords: DefaultStopWords,
},
}
// validate
tps := []string{
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`,
`password combination.
R5: Regulatory--21`,
}
return utils.Validate(r, tps, fps)
}
+90
View File
@@ -0,0 +1,90 @@
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"
)
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",
Regex: regexp.MustCompile(`ghp_[0-9a-zA-Z]{36}`),
Keywords: []string{"ghp_"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("github", "ghp_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
}
return utils.Validate(r, tps, nil)
}
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",
Regex: regexp.MustCompile(`github_pat_[0-9a-zA-Z_]{82}`),
Keywords: []string{"github_pat_"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("github", "github_pat_"+secrets.NewSecret(utils.AlphaNumeric("82"))),
}
return utils.Validate(r, tps, nil)
}
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",
Regex: regexp.MustCompile(`gho_[0-9a-zA-Z]{36}`),
Keywords: []string{"gho_"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("github", "gho_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
}
return utils.Validate(r, tps, nil)
}
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",
Regex: regexp.MustCompile(`(?:ghu|ghs)_[0-9a-zA-Z]{36}`),
Keywords: []string{"ghu_", "ghs_"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("github", "ghu_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
utils.GenerateSampleSecret("github", "ghs_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
}
return utils.Validate(r, tps, nil)
}
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",
Regex: regexp.MustCompile(`ghr_[0-9a-zA-Z]{36}`),
Keywords: []string{"ghr_"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("github", "ghr_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
}
return utils.Validate(r, tps, nil)
}
+57
View File
@@ -0,0 +1,57 @@
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"
)
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}`),
Keywords: []string{"glpat-"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("gitlab", "glpat-"+secrets.NewSecret(utils.AlphaNumeric("20"))),
}
return utils.Validate(r, tps, nil)
}
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",
Regex: regexp.MustCompile(`glptt-[0-9a-f]{40}`),
Keywords: []string{"glptt-"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("gitlab", "glptt-"+secrets.NewSecret(utils.Hex("40"))),
}
return utils.Validate(r, tps, nil)
}
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}`),
Keywords: []string{"GR1348941"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("gitlab", "GR1348941"+secrets.NewSecret(utils.AlphaNumeric("20"))),
}
return utils.Validate(r, tps, nil)
}
+28
View File
@@ -0,0 +1,28 @@
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 GitterAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "gitter-access-token",
Description: "Uncovered a Gitter Access Token, which may lead to unauthorized access to chat and communication services.",
Regex: utils.GenerateSemiGenericRegex([]string{"gitter"},
utils.AlphaNumericExtendedShort("40"), true),
Keywords: []string{
"gitter",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("gitter",
secrets.NewSecret(utils.AlphaNumericExtendedShort("40"))),
}
return utils.Validate(r, tps, nil)
}
+27
View File
@@ -0,0 +1,27 @@
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 GoCardless() *config.Rule {
// define rule
r := config.Rule{
RuleID: "gocardless-api-token",
Description: "Detected a GoCardless API token, potentially risking unauthorized direct debit payment operations and financial data exposure.",
Regex: utils.GenerateSemiGenericRegex([]string{"gocardless"}, `live_(?i)[a-z0-9\-_=]{40}`, true),
Keywords: []string{
"live_",
"gocardless",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("gocardless", "live_"+secrets.NewSecret(utils.AlphaNumericExtended("40"))),
}
return utils.Validate(r, tps, nil)
}
+66
View File
@@ -0,0 +1,66 @@
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 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"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("grafana-api-key",
"eyJrIjoi"+
secrets.NewSecret(utils.AlphaNumeric("70"))),
}
return utils.Validate(r, tps, nil)
}
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_"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("grafana-cloud-api-token",
"glc_"+
secrets.NewSecret(utils.AlphaNumeric("32"))),
}
return utils.Validate(r, tps, nil)
}
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_"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("grafana-service-account-token",
"glsa_"+
secrets.NewSecret(utils.AlphaNumeric("32"))+
"_"+
secrets.NewSecret((utils.Hex("8")))),
}
return utils.Validate(r, tps, nil)
}
+29
View File
@@ -0,0 +1,29 @@
package rules
import (
"regexp"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
)
func HarnessApiKey() *config.Rule {
// Define rule for Harness Personal Access Token (PAT) and Service Account Token (SAT)
r := config.Rule{
Description: "Identified a Harness Access Token (PAT or SAT), risking unauthorized access to a Harness account.",
RuleID: "harness-api-key",
Regex: regexp.MustCompile(`(?:pat|sat)\.[a-zA-Z0-9_-]{22}\.[a-zA-Z0-9]{24}\.[a-zA-Z0-9]{20}`),
Keywords: []string{"pat.", "sat."},
}
// Generate a sample secret for validation
tps := []string{
utils.GenerateSampleSecret("harness", "pat."+secrets.NewSecret(utils.AlphaNumeric("22"))+"."+secrets.NewSecret(utils.AlphaNumeric("24"))+"."+secrets.NewSecret(utils.AlphaNumeric("20"))),
utils.GenerateSampleSecret("harness", "sat."+secrets.NewSecret(utils.AlphaNumeric("22"))+"."+secrets.NewSecret(utils.AlphaNumeric("24"))+"."+secrets.NewSecret(utils.AlphaNumeric("20"))),
}
// validate the rule
return utils.Validate(r, tps, nil)
}
+57
View File
@@ -0,0 +1,57 @@
package rules
import (
"fmt"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"regexp"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
)
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",
Regex: regexp.MustCompile(`(?i)[a-z0-9]{14}\.(?-i:atlasv1)\.[a-z0-9\-_=]{60,70}`),
Entropy: 3.5,
Keywords: []string{"atlasv1"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("hashicorpToken", secrets.NewSecret(utils.Hex("14"))+".atlasv1."+secrets.NewSecret(utils.AlphaNumericExtended("60,70"))),
`#token = "hE1hlYILrSqpqh.atlasv1.ARjZuyzl33F71WR55s6ln5GQ1HWIwTDDH3MiRjz7OnpCfaCb1RCF5zGaSncCWmJdcYA"`,
}
fps := []string{
`token = "xxxxxxxxxxxxxx.atlasv1.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"`, // low entropy
}
return utils.Validate(r, tps, fps)
}
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",
Regex: utils.GenerateSemiGenericRegex(keywords, fmt.Sprintf(`"%s"`, utils.AlphaNumericExtended("8,20")), true),
Keywords: keywords,
Path: regexp.MustCompile(`(?i)\.(?:tf|hcl)$`),
}
tps := map[string]string{
// Example from: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/sql_server.html
"file.tf": "administrator_login_password = " + `"thisIsDog11"`,
// https://registry.terraform.io/providers/petoju/mysql/latest/docs
"file.hcl": "password = " + `"rootpasswd"`,
}
fps := map[string]string{
"file.tf": "administrator_login_password = var.db_password",
"file.hcl": `password = "${aws_db_instance.default.password}"`,
"unrelated.js": "password = " + `"rootpasswd"`,
}
return utils.ValidateWithPaths(r, tps, fps)
}
+24
View File
@@ -0,0 +1,24 @@
package rules
import (
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
)
func Heroku() *config.Rule {
// define rule
r := config.Rule{
Description: "Detected a Heroku API Key, potentially compromising cloud application deployments and operational security.",
RuleID: "heroku-api-key",
Regex: utils.GenerateSemiGenericRegex([]string{"heroku"}, utils.Hex8_4_4_4_12(), true),
Keywords: []string{"heroku"},
}
// validate
tps := []string{
`const HEROKU_KEY = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
`heroku_api_key = "832d2129-a846-4e27-99f4-7004b6ad53ef"`, // gitleaks:allow
}
return utils.Validate(r, tps, nil)
}
+24
View File
@@ -0,0 +1,24 @@
package rules
import (
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
)
func HubSpot() *config.Rule {
// define rule
r := config.Rule{
Description: "Found a HubSpot API Token, posing a risk to CRM data integrity and unauthorized marketing operations.",
RuleID: "hubspot-api-key",
Regex: utils.GenerateSemiGenericRegex([]string{"hubspot"},
`[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}`, true),
Keywords: []string{"hubspot"},
}
// validate
tps := []string{
`const hubspotKey = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
}
return utils.Validate(r, tps, nil)
}
+116
View File
@@ -0,0 +1,116 @@
package rules
import (
"fmt"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"regexp"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
)
// Reference: https://huggingface.co/docs/hub/security-tokens
//
// Old tokens have the prefix `api_`, however, I am not sure it's worth detecting them as that would be high noise.
// https://huggingface.co/docs/api-inference/quicktour
func HuggingFaceAccessToken() *config.Rule {
// define rule
r := 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,
Keywords: []string{
"hf_",
},
}
// validate
tps := []string{
`huggingface-cli login --token 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`,
`huggingface-cli login --token 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`,
`huggingface-cli login --token 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`,
`huggingface-cli login --token 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`,
`huggingface-cli login --token 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`,
`huggingface-cli login --token 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`,
`huggingface-cli login --token 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`,
`huggingface-cli login --token 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`,
`-H "Authorization: Bearer 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"`,
`DEV=1 HF_TOKEN=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 poetry run python app.py`,
`use_auth_token='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')`,
`CI_HUB_USER_TOKEN = "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"`,
`- Change line 5 and add your Hugging Face token, that is, instead of 'hf_token = "ADD_YOUR_HUGGING_FACE_TOKEN_HERE"', you will need to change it to something like'hf_token = "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"'`,
` " hf_token = \"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\"\n",`,
`# Not critical, only usable on the sandboxed CI instance.
TOKEN = "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"`,
` parser.add_argument("--hf_token", type=str, default='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', help="Hugging Face Access Token to access PyAnnote gated models")`,
}
fps := []string{
`- (id)hf_requiredCharacteristicTypesForDisplayMetadata;`,
`amazon.de#@#div[data-cel-widget="desktop-rhf_SponsoredProductsRemoteRHFSearchEXPSubsK2ClickPagination"]`,
` _kHMSymptomhf_generatedByHomeAppForDebuggingPurposesKey,`,
` #define OSCHF_DebugGetExpectedAverageCrystalAmplitude NOROM_OSCHF_DebugGetExpectedAverageCrystalAmplitude`,
` M_UINT (ServingCellPriorityParametersDescription_t, H_PRIO, 2, &hf_servingcellpriorityparametersdescription_h_prio),`,
`+HWI-ST565_0092:4:1101:5508:5860#ACTTGA/1
bb_eeeeegfgffhiiiiiiiiiiihiiiiicgafhf_eefghihhiiiifhifhhdhifhiiiihifdgdhggf\bbceceedbcd
@HWI-ST565_0092:4:1101:7621:5770#ACTTGA/1`,
`y{}x|~|}{~}}~|~}||�~|�{��|{}{|~z{}{{|{||{|}|{}{~|y}vjoePbUBJ7&;"; <; :;?!!;<7%$IACa_ecghbfbaebejhahfbhf_ddbficghbgfbhhcghdghfhigiifhhehhdggcgfchf_fgcei^[[.40&54"5666 6`,
` change_dir(cwd)
subdirs = glob.glob('HF_CAASIMULIAComputeServicesBuildTime.HF*.Linux64')
if len(subdirs) == 1:`,
` os.environ.get("HF_AUTH_TOKEN",
"hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),`,
`# HuggingFace API Token https://huggingface.co/settings/tokens
HUGGINGFACE_API_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,`,
}
return utils.Validate(r, tps, fps)
}
// Will be deprecated Aug 1st, 2023.
func HuggingFaceOrganizationApiToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "huggingface-organization-api-token",
Description: "Uncovered a Hugging Face Organization API token, potentially compromising AI organization accounts and associated data.",
Regex: regexp.MustCompile(`(?:^|[\\'"` + "`" + ` >=:\(,)])(api_org_[a-zA-Z]{34})(?:$|[\\'"` + "`" + ` <\),])`),
Entropy: 2,
Keywords: []string{
"api_org_",
},
}
// validate
tps := []string{
`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`,
"`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`",
`\'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'\`,
`\"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\"`,
`,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,`,
`(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)`,
`<foo>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</foo>`,
`def test_private_space(self):
hf_token = "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" # Intentionally revealing this key for testing purposes
io = gr.load(`,
`hf_token = "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" # Intentionally revealing this key for testing purposes`,
`"news_train_dataset = datasets.load_dataset('nlpHakdang/aihub-news30k', data_files = \"train_news_text.csv\", use_auth_token='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')\n",`,
`os.environ['HUGGINGFACEHUB_API_TOKEN'] = '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'`,
fmt.Sprintf("api_org_%s", secrets.NewSecret(`[a-zA-Z]{34}`)),
}
fps := []string{
`public static final String API_ORG_EXIST = "APIOrganizationExist";`,
`const api_org_controller = require('../../controllers/api/index').organizations;`,
`API_ORG_CREATE("https://qyapi.weixin.qq.com/cgi-bin/department/create?access_token=ACCESS_TOKEN"),`,
`def test_internal_api_org_inclusion_with_href(api_name, href, expected, monkeypatch, called_with):
monkeypatch.setattr("requests.sessions.Session.request", called_with)`,
` def _api_org_96726c78_4ae3_402f_b08b_7a78c6903d2a(self, method, url, body, headers):
body = self.fixtures.load("api_org_96726c78_4ae3_402f_b08b_7a78c6903d2a.xml")
return httplib.OK, body, headers, httplib.responses[httplib.OK]`,
`<p>You should see a token <code>hf_xxxxx</code> (old tokens are <code>api_XXXXXXXX</code> or <code>api_org_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</code>).</p>`,
` From Hugging Face docs:
You should see a token hf_xxxxx (old tokens are api_XXXXXXXX or api_org_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx).
If you do not submit your API token when sending requests to the API, you will not be able to run inference on your private models.`,
}
return utils.Validate(r, tps, fps)
}
+32
View File
@@ -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 InfracostAPIToken() *config.Rule {
// define rule
r := config.Rule{
// Human readable description of the rule
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-"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("ico", "ico-"+secrets.NewSecret("[A-Za-z0-9]{32}")),
}
return utils.Validate(r, tps, nil)
}
+24
View File
@@ -0,0 +1,24 @@
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 Intercom() *config.Rule {
// define rule
r := config.Rule{
Description: "Identified an Intercom API Token, which could compromise customer communication channels and data privacy.",
RuleID: "intercom-api-key",
Regex: utils.GenerateSemiGenericRegex([]string{"intercom"}, utils.AlphaNumericExtended("60"), true),
Keywords: []string{"intercom"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("intercom", secrets.NewSecret(utils.AlphaNumericExtended("60"))),
}
return utils.Validate(r, tps, nil)
}
+30
View File
@@ -0,0 +1,30 @@
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 Intra42ClientSecret() *config.Rule {
// define 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),
Keywords: []string{
"intra",
"s-s4t2ud-",
"s-s4t2af-",
},
}
// validate
tps := []string{
"clientSecret := \"s-s4t2ud-" + secrets.NewSecret(utils.Hex("64")) + "\"",
"clientSecret := \"s-s4t2af-" + secrets.NewSecret(utils.Hex("64")) + "\"",
"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", // gitleaks:allow
"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", // gitleaks:allow
}
return utils.Validate(r, tps, nil)
}
+65
View File
@@ -0,0 +1,65 @@
package rules
import (
"fmt"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
)
func JFrogAPIKey() *config.Rule {
keywords := []string{"jfrog", "artifactory", "bintray", "xray"}
// Define Rule
r := config.Rule{
// Human readable description of the rule
Description: "Found a JFrog API Key, posing a risk of unauthorized access to software artifact repositories and build pipelines.",
// Unique ID for the rule
RuleID: "jfrog-api-key",
// Regex capture group for the actual secret
// Regex used for detecting secrets. See regex section below for more details
Regex: utils.GenerateSemiGenericRegex(keywords, utils.AlphaNumeric("73"), true),
// Keywords used for string matching on fragments (think of this as a prefilter)
Keywords: keywords,
}
// validate
tps := []string{
fmt.Sprintf("--set imagePullSecretJfrog.password=%s", secrets.NewSecret(utils.AlphaNumeric("73"))),
}
return utils.Validate(r, tps, nil)
}
func JFrogIdentityToken() *config.Rule {
keywords := []string{"jfrog", "artifactory", "bintray", "xray"}
// Define Rule
r := config.Rule{
// Human readable description of the rule
Description: "Discovered a JFrog Identity Token, potentially compromising access to JFrog services and sensitive software artifacts.",
// Unique ID for the rule
RuleID: "jfrog-identity-token",
// Regex capture group for the actual secret
// Regex used for detecting secrets. See regex section below for more details
Regex: utils.GenerateSemiGenericRegex(keywords, utils.AlphaNumeric("64"), true),
// Keywords used for string matching on fragments (think of this as a prefilter)
Keywords: keywords,
}
// validate
tps := []string{
utils.GenerateSampleSecret("jfrog", secrets.NewSecret(utils.AlphaNumeric("64"))),
utils.GenerateSampleSecret("artifactory", secrets.NewSecret(utils.AlphaNumeric("64"))),
utils.GenerateSampleSecret("bintray", secrets.NewSecret(utils.AlphaNumeric("64"))),
utils.GenerateSampleSecret("xray", secrets.NewSecret(utils.AlphaNumeric("64"))),
}
return utils.Validate(r, tps, nil)
}
+189
View File
@@ -0,0 +1,189 @@
package rules
import (
b64 "encoding/base64"
"fmt"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"regexp"
"github.com/zricethezav/gitleaks/v8/config"
)
func JWT() *config.Rule {
// define rule
r := 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),
Keywords: []string{"ey"},
}
// validate
tps := []string{`eyJhbGciOieeeiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwic3ViZSI6IjEyMzQ1Njc4OTAiLCJuYW1lZWEiOiJKb2huIERvZSIsInN1ZmV3YWZiIjoiMTIzNDU2Nzg5MCIsIm5hbWVmZWF3ZnciOiJKb2huIERvZSIsIm5hbWVhZmV3ZmEiOiJKb2huIERvZSIsInN1ZndhZndlYWIiOiIxMjM0NTY3ODkwIiwibmFtZWZ3YWYiOiJKb2huIERvZSIsInN1YmZ3YWYiOiIxMjM0NTY3ODkwIiwibmFtZndhZSI6IkpvaG4gRG9lIiwiaWZ3YWZhYXQiOjE1MTYyMzkwMjJ9.a_5icKBDo-8EjUlrfvz2k2k-FYaindQ0DEYNrlsnRG0==`, // gitleaks:allow
`JWT := eyJhbGciOieeeiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwic3ViZSI6IjEyMzQ1Njc4OTAiLCJuYW1lZWEiOiJKb2huIERvZSIsInN1ZmV3YWZiIjoiMTIzNDU2Nzg5MCIsIm5hbWVmZWF3ZnciOiJKb2huIERvZSIsIm5hbWVhZmV3ZmEiOiJKb2huIERvZSIsInN1ZndhZndlYWIiOiIxMjM0NTY3ODkwIiwibmFtZWZ3YWYiOiJKb2huIERvZSIsInN1YmZ3YWYiOiIxMjM0NTY3ODkwIiwibmFtZndhZSI6IkpvaG4gRG9lIiwiaWZ3YWZhYXQiOjE1MTYyMzkwMjJ9.a_5icKBDo-8EjUlrfvz2k2k-FYaindQ0DEYNrlsnRG0`, // gitleaks:allow
`"access_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NLZXkiOiJRMzFDVlMxUFNDSjRPVEsyWVZFTSIsImF0X2hhc2giOiI4amItZFE2OXRtZEVueUZaMUttNWhnIiwiYXVkIjoiZXhhbXBsZS1hcHAiLCJlbWFpbCI6ImFkbWluQGV4YW1wbGUuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImV4cCI6IjE1OTQ2MDAxODIiLCJpYXQiOjE1OTQ1ODkzODQsImlzcyI6Imh0dHA6Ly8xMjcuMC4wLjE6NTU1Ni9kZXgiLCJuYW1lIjoiYWRtaW4iLCJzdWIiOiJDaVF3T0dFNE5qZzBZaTFrWWpnNExUUmlOek10T1RCaE9TMHpZMlF4TmpZeFpqVTBOallTQld4dlkyRnMifQ.nrbzIJz99Om7TvJ04jnSTmhvlM7aR9hMM1Aqjp2ONJ1UKYCvegBLrTu6cYR968_OpmnAGJ8vkd7sIjUjtR4zbw"`, // gitleaks:allow
`https://dai2-playlistserver.aws.syncbak.com/cpl/20980038/dai2v5/1.0/7b2264657669636554797065223a387d/master.m3u8?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkdyYXkyMDE2MDgyOSJ9.eyJtaWQiOiIyMDk4MDAzOCIsImNpZCI6MjE5MDMsInNpZCI6MTU4LCJtZDUiOiIwN2QxMmRjNjAwOTM2MGI0MmY3NjNkNTRiMWIwZjI1NCIsImlhdCI6MTY2MDkxMzU2MCwiZXhwIjoxNjkyNDQ5NTYwLCJpc3MiOiJTeW5jYmFrIChURykifQ.JrWVgwzIn_RcNuWhkzIjr1i4qjXU1v4n0KFrSzoTQvQ`, // gitleaks:allow `
`"SessionToken": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NLZXkiOiI2TjJCQUxYN0VMTzgyN0RYUzNHSyIsImFjciI6IjAiLCJhdWQiOiJhY2NvdW50IiwiYXV0aF90aW1lIjoxNTY5OTEwNTUyLCJhenAiOiJhY2NvdW50IiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJleHAiOjE1Njk5MTQ1NTQsImlhdCI6MTU2OTkxMDk1NCwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgxL2F1dGgvcmVhbG1zL2RlbW8iLCJqdGkiOiJkOTk4YTBlZS01NDk2LTQ4OWYtYWJlMi00ZWE5MjJiZDlhYWYiLCJuYmYiOjAsInBvbGljeSI6InJlYWR3cml0ZSIsInByZWZlcnJlZF91c2VybmFtZSI6Im5ld3VzZXIxIiwic2Vzc2lvbl9zdGF0ZSI6IjJiYTAyYTI2LWE5MTUtNDUxNC04M2M1LWE0YjgwYjc4ZTgxNyIsInN1YiI6IjY4ZmMzODVhLTA5MjItNGQyMS04N2U5LTZkZTdhYjA3Njc2NSIsInR5cCI6IklEIn0._UG_-ZHgwdRnsp0gFdwChb7VlbPs-Gr_RNUz9EV7TggCD59qjCFAKjNrVHfOSVkKvYEMe0PvwfRKjnJl3A_mBA",`, // gitleaks:allow
`2020/11/04 21:08:40 Access Token:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiYTAwYzI3ZDEtYjVhYS00NjU0LWFmMTYtYjExNzNkZTY1NjI5Iiwicm9sZXMiOlsiYWRtaW4iXSwiaWF0IjoxNjA0NTE2OTIwLCJleHAiOjE2MDQ1MTc4MjAsImp0aSI6IjYzNmVmMDc0LTE2MzktNGJhZi1hNGNiLTQ4ZDM4NGMxMzliYSIsImlzcyI6Im15YXBwIn0.T9B0zG0AHShO5JfQgrMQBlToH33KHgp8nLMPFpN6QmM"`, // gitleaks:allow
`"idToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Ik56azVNREl5TVRnNFJqWTBORGswT0VJM1JrRXpORGN4UmtVMU1FWXdNemczT1VKQlFqRTBNZyJ9.eyJuaWNrbmFtZSI6InRlc3QtaW50ZXJhY3RpdmUtY2xpIiwibmFtZSI6IlRlc3RpbmcgSW50ZXJhY3RpdmUgQ2xpIiwicGljdHVyZSI6Imh0dHBzOi8vaW50ZXJhdGNpdmUuY2xpL3Rlc3RpbmcucG5nIiwidXBkYXRlZF9hdCI6IjIwMTktMDktMTZUMTU6MTg6NDMuOTk5WiIsImVtYWlsIjoidGVzdGluZ0BpbnRlcmFjdGl2ZS5jbGkiLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6Ly9zZXJ2ZXJsZXNzaW5jLmF1dGgwLmNvbS8iLCJzdWIiOiJ0ZXN0LWludGVyYWN0aXZlLWNsaSIsImF1ZCI6IlhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYIiwiaWF0IjoxNTYwMDAwMDAwLCJleHAiOjMwMDAwMDAwMDB9.GcNQtWSxv9CHTABw-HIjYSvRxTEapDUDqIIWRGmz01XmShQxRGOHRuUg1NKU4w9MpOlB6txHKs8UWd2eZkzw_Z4QmIuLyAVhVklpWP2-xeysPLUyqVTgqAg8kgIUAwdKjmrdpQqHhGd-Q1BIX62-E-qKKx8prmADSw_hgmuvlMuSCa1ajCnfyUXycQxDmbFrvjd24lJER0FSpB2nWWW3KxZ_UBX-TuVmiEtRXg9GYeSv6oIU78PrIhYgJ0QjERRF1yAYamIXNRs-KZ7Z4YiFNC4uKzFH1524pZkS4Q0-pweIvBrrsjekz-vEYcbaVG1zAxDu_yNrYPk5phCy8MHTrQ",`, // gitleaks:allow
`TokenIssuer1WithAzp = "eyJhbGciOiJSUzI1NiIsImtpZCI6InRUX3c5TFJOclk3d0phbEdzVFlTdDdydXRaaTg2R3Z5YzBFS1I0Q2FRQXciLCJ0eXAiOiJKV1QifQ.eyJhenAiOiJiYXIiLCJleHAiOjQ3MzQxMjU0NTMsImlhdCI6MTU4MDUyNTQ1MywiaXNzIjoidGVzdC1pc3N1ZXItMUBpc3Rpby5pbyIsInN1YiI6InN1Yi0xIn0.SO4qjRJPYItkpGGpCDfEhaUfdthO8L9b_aawao4dJKyqqXN0uYdsJau_JZzyPQ1emAmJP7VyjwELrlszA6xV65na_O-eny23iwhEoroChQMpcr9DWqSUBUfpbHSPFAjUv38SUbQfLgar0HrMxQlTAzB0vyzn2g6-cukP469ZlOUmzvi9b4UpolTLp_WPgEHKjZw8CL56CcuJqBIKgfn0M7ta2bY_qx-UrsEW0CqnXol7vhXuDAfMeWZYKuDP8qc2VH1T6wpO2JnZ0EaNDuZfQLOWFYKsFGlaYcus9j462AfJQBSFQTbkIjkvKMK6aI_rMEesAnJr2eei1UYi14JYiQ"`, // gitleaks:allow
`eyJhbGciOiJSUzI1NiIsImtpZCI6IkRIRmJwb0lVcXJZOHQyenBBMnFYZkNtcjVWTzVaRXI0UnpIVV8tZW52dlEiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjM1MzczOTExMDQsImdyb3VwcyI6WyJncm91cDEiLCJncm91cDIiXSwiaWF0IjoxNTM3MzkxMTA0LCJpc3MiOiJ0ZXN0aW5nQHNlY3VyZS5pc3Rpby5pbyIsInNjb3BlIjpbInNjb3BlMSIsInNjb3BlMiJdLCJzdWIiOiJ0ZXN0aW5nQHNlY3VyZS5pc3Rpby5pbyJ9.EdJnEZSH6X8hcyEii7c8H5lnhgjB5dwo07M5oheC8Xz8mOllyg--AHCFWHybM48reunF--oGaG6IXVngCEpVF0_P5DwsUoBgpPmK1JOaKN6_pe9sh0ZwTtdgK_RP01PuI7kUdbOTlkuUi2AO-qUyOm7Art2POzo36DLQlUXv8Ad7NBOqfQaKjE9ndaPWT7aexUsBHxmgiGbz1SyLH879f7uHYPbPKlpHU6P9S-DaKnGLaEchnoKnov7ajhrEhGXAQRukhDPKUHO9L30oPIr5IJllEQfHYtt6IZvlNUGeLUcif3wpry1R5tBXRicx2sXMQ7LyuDremDbcNy_iE76Upg`, // gitleaks:allow
`python examples/cli.py eyJhbGciOiJIUzI1NiJ9.eyJJc3N1ZXIiOiJJc3N1ZXIiLCJVc2VybmFtZSI6IkJhZFNlY3JldHMiLCJleHAiOjE1OTMxMzM0ODMsImlhdCI6MTQ2NjkwMzA4M30.ovqRikAo_0kKJ0GVrAwQlezymxrLGjcEiW_s3UJMMCo`, // gitleaks:allow
`"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VybmFtZTpib2IifQ.HcfCW67Uda-0gz54ZWTqmtgJnZeNem0Q757eTa9EZuw"`, // gitleaks:allow
`"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1ODk1ODU1NjN9.PtfDS1niGoZ7pV6kplI-_q1fVKLnknQ3IwcrLZhoVCU",`, // gitleaks:allow
`// authorization: 'eyJhbGciOiJIUzUxMiIsImlhdCI6MTU3Njk5Njc5OSwiZXhwIjoxNTg0ODU5MTk5fQ.eyJ1aWQiOjQ1NzQyN30.0ei5UE6OgLBzN2_IS7xUIbIfW_S1Wzl42q2UeusbboxuzvctO_4Mz6YRr6f0PBLUVZMETxt8F0_4-yqIJ3_kUQ',`, // gitleaks:allow
`eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJpc3Rpby1jbmktdG9rZW4tcGpwYnciLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiaXN0aW8tY25pIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiZmY2MDY0ODAtY2MxMC0xMWU4LTkxYzctMDAwYWY3MGE5YmE4Iiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmlzdGlvLWNuaSJ9.0YHfuEwYn6tbtgy1YOhOjEtuQ8TnvmA_1RkuggfVGigMpCMGoOkIWwxpeDVXZm7dNwRmQVwLhchA3MeXz0QGRmStLa-VncedkmPOGSC-FyPvPybhZI53w3nhIVU3Vkh9_s-E2H2zFTwRQthxlDAlldNqEHpM9fINIVs0Z3bAogz2DYHwerSOtfZU-6d8b5nn73gnNhl6zBJ_0qg22SZjc6TrDYk--WwjUbU5_OIW6YxEmFnNVqfSeCrpg18IiJCsB0XRkixgu46Ev63jsrJ1vi41PVvBN79X7F-SiNNwTqwACRZvlX1zRw_GV7o4iPvnKn685WLOyMfoB5K6hSxrpQ`, // gitleaks:allow
`const TestKubernetesJWT_A = "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImFkbWluLXRva2VuLXFsejQyIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiNzM4YmMyNTEtNjUzMi0xMWU5LWI2N2YtNDhlNmM4YjhlY2I1Iiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50OmRlZmF1bHQ6YWRtaW4ifQ.ixMlnWrAG7NVuTTKu8cdcYfM7gweS3jlKaEsIBNGOVEjPE7rtXtgMkAwjQTdYR08_0QBjkgzy5fQC5ZNyglSwONJ-bPaXGvhoH1cTnRi1dz9H_63CfqOCvQP1sbdkMeRxNTGVAyWZT76rXoCUIfHP4LY2I8aab0KN9FTIcgZRF0XPTtT70UwGIrSmRpxW38zjiy2ymWL01cc5VWGhJqVysmWmYk3wNp0h5N57H_MOrz4apQR4pKaamzskzjLxO55gpbmZFC76qWuUdexAR7DT2fpbHLOw90atN_NlLMY-VrXyW3-Ei5EhYaVreMB9PSpKwkrA4jULITohV-sxpa1LA"`, // gitleaks:allow
`string: grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJkZXYtdG8tYW5hbHl0aWMtYXBpLW1hYy10ZXN0QGRldnRvLTE3NTQxOS5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsImF1ZCI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL29hdXRoMi92NC90b2tlbiIsImV4cCI6MTUxOTIyOTAxOSwiaWF0IjoxNTE5MjI4ODk5LCJzY29wZSI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL2F1dGgvYW5hbHl0aWNzLnJlYWRvbmx5In0.V8CSfSS7sKfoE5857jE9WDrGFHF1CyRr3cZpdUv9MjaaTcPRSLuNxB8yrxRP_7hNmlRgx_KdUzBgDJp3M_9tU4rZgFaIC7-bctvz_0rqbnMqSTniHYNGo7w__zO0bRaTpR3ILOfoxCQLcVC-tA4eCIMzRCznkY0VAaoLM7K-hnwQz6fCqSF31fmOwzAdVBPi5qnMETogh_7SiHn4WNUYI0FQf5SFLhcCbBZtORcbANe9hXp9po2P-VTBqs6u9dAZw5kZ2c1l5zbzrjYp5VcYl1XQFQTxP2zgMxhpX3k1UH9ObggOMUxvASyLbPZ7viOPKRlFxkAAHPTN2N1FYbpVeA`, // gitleaks:allow
`eyJhbGciOiJSUzI1NiIsImtpZCI6IlM1WGxrRnVIclJRaEVDbmg3cndZZFVTRTFpT0lfQzZsZ2NXbHZoOS1pbVUifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLWo1a3B2Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJiZTZjZmUwZS0yYzFhLTRkNTYtYmVkMC1jYWRmYjYxNzA1N2YiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZXJuZXRlcy1kYXNoYm9hcmQ6YWRtaW4tdXNlciJ9.LaBPEh6Qantd8tAc0X5DY9dDwUqZpxu38FHnp9TSJw-ghs3TsjrscFulUeEAtp2ng3ElLcU4SbNKPGJflF2dyW9Tmfn-Kt_6Jwq8HQ9GOCwAicEz0JVireHA7EWhATzuT56eO6MTe-2j5bpGnPQRJJtQ8AbtAN3nVK7RPjSzmc8Ppqx1z5i4oCGwiyRlGwqT-FkCtQLbQaQ4XmrASQoN4pJ_OBy5slztUhk32HdGP6pQx5c-nfei-of_4ij_fHrP0xEEfmVVvXqi9WKv1PLkQ3qTiSFDzv8M2sE4T6XmCGBbw7gyHzEGSpOAPZr00bX_YMCUvEF0lyP4YK696xWCBA`, // gitleaks:allow
`$ curl "http://admin:password@127.0.0.1:8080/api/v2/token"
{"access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsiQVBJIl0sImV4cCI6MTYxMzMzNTI2MSwianRpIjoiYzBrb2gxZmNkcnBjaHNzMGZwZmciLCJuYmYiOjE2MTMzMzQ2MzEsInBlcm1pc3Npb25zIjpbIioiXSwic3ViIjoiYUJ0SHUwMHNBUmxzZ29yeEtLQ1pZZWVqSTRKVTlXbThHSGNiVWtWVmc1TT0iLCJ1c2VybmFtZSI6ImFkbWluIn0.WiyqvUF-92zCr--y4Q_sxn-tPnISFzGZd_exsG-K7ME","expires_at":"2021-02-14T20:41:01Z"}`, // gitleaks:allow
`curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsiQVBJIl0sImV4cCI6MTYxMzMzNTI2MSwianRpIjoiYzBrb2gxZmNkcnBjaHNzMGZwZmciLCJuYmYiOjE2MTMzMzQ2MzEsInBlcm1pc3Npb25zIjpbIioiXSwic3ViIjoiYUJ0SHUwMHNBUmxzZ29yeEtLQ1pZZWVqSTRKVTlXbThHSGNiVWtWVmc1TT0iLCJ1c2VybmFtZSI6ImFkbWluIn0.WiyqvUF-92zCr--y4Q_sxn-tPnISFzGZd_exsG-K7ME" "http://127.0.0.1:8080/api/v2/dumpdata?output-data=1"`, // gitleaks:allow
`"authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiZ3Vlc3QiLCJzdWIiOiJZV3hwWTJVPSIsIm5iZiI6MTUxNDg1MTEzOSwiZXhwIjoxNjQxMDgxNTM5fQ.K5DnnbbIOspRbpCr2IKXE9cPVatGOCBrBQobQmBmaeU"`, // gitleaks:allow
`{"signatures": [ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxlcyI6W3sibmFtZSI6Ii5tYW5pZmVzdCIsImhhc2giOiJjMjEzMTU0NGM3MTZhMjVhNWUzMWY1MDQzMDBmNTI0MGU4MjM1Y2FkYjlhNTdmMGJkMWI2ZjRiZDc0YjI2NjEyIiwiYWxnb3JpdGhtIjoiU0hBMjU2In0seyJuYW1lIjoicm9sZXMvYmluZGluZ3MvZGF0YS5qc29uIiwiaGFzaCI6IjQyY2ZlNjc2OGI1N2JiNWY3NTAzYzE2NWMyOGRkMDdhYzViODEzNTU0ZWJjODUwZjJjYzM1ODQzZTcxMzdiMWQifV0sImlhdCI6MTU5MjI0ODAyNywiaXNzIjoiSldUU2VydmljZSIsImtleWlkIjoibXlQdWJsaWNLZXkiLCJzY29wZSI6IndyaXRlIn0.ZjtUgXC6USwmhv4XP9gFH6MzZwpZrGpAL_2sTK1P-mg"]}`, // gitleaks:allow
`"id_token": "eyJ4NXQiOiJOVEF4Wm1NeE5ETXlaRGczTVRVMVpHTTBNekV6T0RKaFpXSTRORE5sWkRVMU9HRmtOakZpTVEiLCJraWQiOiJOVEF4Wm1NeE5ETXlaRGczTVRVMVpHTTBNekV6T0RKaFpXSTRORE5sWkRVMU9HRmtOakZpTVEiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJQb0VnWFA2dVZPNDVJc0VOUm5nRFhqNUF1NVlhIiwiYXpwIjoiUG9FZ1hQNnVWTzQ1SXNFTlJuZ0RYajVBdTVZYSIsImlzcyI6Imh0dHBzOlwvXC9sb2NhbGhvc3Q6OTQ0M1wvb2F1dGgyXC90b2tlbiIsImV4cCI6MTUzNDg5MTc3OCwiaWF0IjoxNTM0ODg4MTc4LCJqdGkiOiIxODQ0MzI5Yy1kNjVhLTQ4YTMtODIyOC05ZGY3M2ZlODNkNTYifQ.ELZ8ujk2Xp9xTGgMqnCa5ehuimaAPXWlSCW5QeBbTJIT4M5OB_2XEVIV6p89kftjUdKu50oiYe4SbfrxmLm6NGSGd2qxkjzJK3SRKqsrmVWEn19juj8fz1neKtUdXVHuSZu6ws_bMDy4f_9hN2Jv9dFnkoyeNT54r4jSTJ4A2FzN2rkiURheVVsc8qlm8O7g64Az-5h4UGryyXU4zsnjDCBKYk9jdbEpcUskrFMYhuUlj1RWSASiGhHHHDU5dTRqHkVLIItfG48k_fb-ehU60T7EFWH1JBdNjOxM9oN_yb0hGwOjLUyCUJO_Y7xcd5F4dZzrBg8LffFmvJ09wzHNtQ",`, // gitleaks:allow
` # The following default key is generated by the local Supabase start and doesn't change
- SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0`, // gitleaks:allow
`Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoxLCJiIjoyLCJjIjozfQ.hxhGCCCmGV9nT1slief1WgEsOsfdnlVizNrODxfh1M8`, // gitleaks:allow
`--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhY3RvclR5cGUiOiJVU0VSIiwiYWN0b3JJZCI6ImRhdGFodWIiLCJ0eXBlIjoiUEVSU09OQUwiLCJ2ZXJzaW9uIjoiMSIsImV4cCI6MTY1MDY2MDY1NSwianRpIjoiM2E4ZDY3ZTItOTM5Yi00NTY3LWE0MjYtZDdlMDA1ZGU3NjJjIiwic3ViIjoiZGF0YWh1YiIsImlzcyI6ImRhdGFodWItbWV0YWRhdGEtc2VydmljZSJ9.pp_vW2u1tiiTT7U0nDF2EQdcayOMB8jatiOA8Je4JJA' \`, // gitleaks:allow
`"Cookie": "auth-token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NDIxMTEsImlzQWRtaW4iOmZhbHNlLCJnaXRodWJJZCI6ImR5ZXhwbG9kZSIsImFwcFJvbGVzIjpbInVzZXIiXSwicm9sZXMiOnsiNDciOiJzdHVkZW50IiwiNTYiOiJzdHVkZW50In0sImNvdXJzZXNSb2xlcyI6eyI0NyI6WyJzdHVkZW50Il0sIjU2IjpbInN0dWRlbnQiXX0sImNvdXJzZXMiOnsiNDciOnsibWVudG9ySWQiOm51bGwsInN0dWRlbnRJZCI6NjY3OTMsInJvbGVzIjpbInN0dWRlbnQiXX0sIjU2Ijp7Im1lbnRvcklkIjpudWxsLCJzdHVkZW50SWQiOjYzMzk4LCJyb2xlcyI6WyJzdHVkZW50Il19fSwiaWF0IjoxNjQ1MjA5NzI2LCJleHAiOjE2NDUzODI1MjZ9.btpYeSioEDUNMI6bAPqgu5zndA8XR5DT8P9U9kotOEA",`, // gitleaks:allow
`<li> <a class="cbtn btn-grad-s btn-shadow btn-width"
target="_blank"
href="https://demo.kuboard.cn/dashboard?k8sToken=eyJhbGciOiJSUzI1NiIsImtpZCI6InZ6SzVqZFNJOXZFMmxQSkhXamNBcFY4RU9FR0RvSUR5bzJIY0NwVG1zODQifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJvYXJkLXZpZXdlci10b2tlbi0yOW40cyIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJrdWJvYXJkLXZpZXdlciIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjQzMWMwNmYyLTNiNTAtNGEyMy1hYjM1LTkyNDQwNTQ2NzFkZCIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprdWJlLXN5c3RlbTprdWJvYXJkLXZpZXdlciJ9.kgwTa6t00gNC0vgr6HOvCqkDghPcW-jVDg-_K6WLy97ppb9jvaqVz-AxXzF7mJqXnNetbJw-8-x_L3ogSsDlTKmRucao96VA2tPKxel8pM04J8MU0ZmYgWhTJelibbxmQK3jwGM4x32bckOOvmtumcXdsBRN0z1SZ1iu4H0VoaswhfoFS4ZJKoe61xyqoDhQx4RLCVJh_-Uctd5RCcPLWFEk-BHqC8vUTy8QcRst6RIIozQdTqsv7Xs6bH6dHrHFS--eVVTH2orQdm8znuUFhlqFOOjmCIMzIlaUQC_SO9URIGYOs0jrk27N9KC0HvQ5dLgFmwyNJ0Gu7cYi23NP1A">
在线演示</a></li>`, // gitleaks:allow
`eyJhbGciOiJSUzI1NiIsImtpZCI6IlM1WGxrRnVIclJRaEVDbmg3cndZZFVTRTFpT0lfQzZsZ2NXbHZoOS1pbVUifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLWo1a3B2Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJiZTZjZmUwZS0yYzFhLTRkNTYtYmVkMC1jYWRmYjYxNzA1N2YiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZXJuZXRlcy1kYXNoYm9hcmQ6YWRtaW4tdXNlciJ9.LaBPEh6Qantd8tAc0X5DY9dDwUqZpxu38FHnp9TSJw-ghs3TsjrscFulUeEAtp2ng3ElLcU4SbNKPGJflF2dyW9Tmfn-Kt_6Jwq8HQ9GOCwAicEz0JVireHA7EWhATzuT56eO6MTe-2j5bpGnPQRJJtQ8AbtAN3nVK7RPjSzmc8Ppqx1z5i4oCGwiyRlGwqT-FkCtQLbQaQ4XmrASQoN4pJ_OBy5slztUhk32HdGP6pQx5c-nfei-of_4ij_fHrP0xEEfmVVvXqi9WKv1PLkQ3qTiSFDzv8M2sE4T6XmCGBbw7gyHzEGSpOAPZr00bX_YMCUvEF0lyP4YK696xWCBA`, // gitleaks:allow
`eyJhbGciOiJSUzI1NiJ9.eyJ1c2VybmFtZSI6IlRlc3QiLCJsb2dnZWQtaW4tdXNlciI6eyJzY29wZWRQZXJtaXNzaW9uIjpbXSwicGVybWlzc2lvbnMiOlsiQS5hZG1pbl9jdXN0b21lcl9kZWxldGUiLCJBLm5vcm1hbF91c2VyX2FwcCIsIkEubm9ybWFsX3VzZXJfY29uZmlndXJhdGlvbiIsIkEubm9ybWFsX3VzZXJfd2VsY29tZV9jb250cm9scyIsIkEubm9ybWFsX3VzZXJfb3JkZXIiLCJBLm5vcm1hbF91c2VyX3NlYXJjaCIsIkEubm9ybWFsX3VzZXJfc2VhcmNoX3BjIiwiQS5ub3JtYWxfdXNlcl9zZWFyY2hfcHJpdmF0ZSIsIkEubm9ybWFsX3VzZXJfcHJpY2luZyIsIkEubm9ybWFsX3VzZXJfcHJpdmF0ZSIsIkEubm9ybWFsX3VzZXJfY29tbWVyY2lhbCIsIkEubm9ybWFsX3VzZXJfcGMiXSwibmFtZSI6WyJUZXN0Il0sIm1haWwiOlsiVGVzdEBleGFtcGxlLmNvbSJdLCJvcmdhbml6YXRpb24iOlsiWC1YeHh4eHguMTIzNCJdLCJsb2NhdGlvbiI6WyIxMjMyMSJdLCJ1bml0IjpbIjEwMyJdLCJjb3VudHJ5IjpbIkNOIl0sInVzZXJUeXBlIjoiZW1wbG95ZWUifSwiaWRlbnRpdHktaWQiOiJNb2NrIn0.EK5TbwsIgde3mT3n7NK2W7TCvpgQQLzshvPPANRQeUmKOv2AWbo_7vNEDTSkwUlaHRN3-dknv8F95p5MsGTzH6Uva8aOPJG6JdBIoYX_ud3aBN-hY1i2Xpf8pqjeINfY3_gDNAB9gdMznEej2uqhPwUXmZtcuWPdUCCeNqPJbRUAJeVXxLr_JtQzO2jmuwNY_YYp7KaEIANZwG1spvLuIGZ0HA03u8ye9c2lfqYcjgfIkjMrwgWPamR7joZOZPdQSO2EHrF7bUWMjRNY-FF5V7tOjEijkknE_nDq5THcEvx1seHYFdFNwy9LSSGGPVmZMKTKQ3UUlZZyBMXcOpOA9w`, // gitleaks:allow
// TODO: Detect newlines or escapes (\)?
// https://github.com/mongodb/mongo/blob/1960b792ade4e179ddc6113a3cd400e9492ca11d/src/mongo/crypto/README.JWT.md?plain=1#L115-L117
// TODO: Detect empty claims section?
// `eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImVwayI6eyJrdHkiOiJFQyIsImNydiI6IlAtMzg0Iiwia2V5X29wcyI6W10sImV4dCI6dHJ1ZSwieCI6IllUcEY3bGtTc3JvZVVUVFdCb21LNzBTN0FhVTJyc0ptMURpZ1ZzbjRMY2F5eUxFNFBabldkYmFVcE9jQVV5a1ciLCJ5IjoiLU5pS3loUktjSk52Nm02Z0ZJUWc4cy1Xd1VXUW9uT3A5dkQ4cHpoa2tUU3U2RzFlU2FUTVlhZGltQ2Q4V0ExMSJ9LCJhcHUiOiIiLCJhcHYiOiIifQ`,
`String tokenWithNoneAlg = "eyJhbGciOiJub25lIn0.eyJzdWIiOiJ0ZXN0LXVzZXIifQ.";`, // gitleaks:allow
`# Req: Invoke-RestMethod -Uri 'http://localhost:8085/users' -Headers @{ 'X-API-KEY' = 'eyJhbGciOiJub25lIn0.eyJ1c2VybmFtZSI6Im1vcnR5Iiwic3ViIjoiMTIzIn0.' }`, // gitleaks:allow
}
fps := []string{}
return utils.Validate(r, tps, fps)
}
func JWTBase64() *config.Rule {
// define rule
r := config.Rule{
RuleID: "jwt-base64",
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}`),
Keywords: []string{"zxlk"},
}
tps := generateTestValues()
fps := []string{
`-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG/MacGPG2 v2
Comment: GPGTools - https://gpgtools.org
mQENBFOrMNcBCAC+gLI4s3bUkobS5NpOQbWfjWXbqC0Ixpc5bZYDOvsmfstmswna
UWUXkRH9RONabzrAu4TGvW0f5DkC2fuWWHJhZWEccn+VE83+avMZN4/mzldSXPNX
A6F7+wHb1DjG+FCDcxMghkwDjGc16LOtZGufUo5iRQaC5pmNBOgDWdiObGPKOTEL
/uU8zLtKi2cibbkhRm22IGOzGyZMZN6zvEtPzlCp3eZEGMW0Ig+kbl6SaSDrSJNK
wElYcr/kJ9QF6CQ2iwZCGeL2jH5QaOi5uj1LXONpCd9nPeyDXc+Z20gXZiqkwRLc
IBPKza6hq/+4nwHBq8DNLv0W4xNC59jLbIhpABEBAAG0LEZyYW5rIE5vdGhhZnQg
PGZub3RoYWZ0QGFsdW1uaS5zdGFuZm9yZC5lZHU+iQE9BBMBCgAnBQJTqzDXAhsD
BQkHhh+ABQsJCAcDBRUKCQgLBRYCAwEAAh4BAheAAAoJECqYOYG1w7FJOr4IAK8x
ec4jbjd6jkKe0YJGdPzg6TM73ISV5VrUlJX7O3jgxHB4M8KIHN/8A/+ZxLk7WM96
iq0C8atWHkCkQBtNduWhzAFccQlpxrrb18T5/oItcrmX9Dx2H5WeIl4WAoqe0MTk
iMPv29RMMH9RJvXL0ihuuH4Z0VxV5nurI9QmGzG69QOzfP9qY1EfQEceO7OqXXvY
vvBEUbmWshLuHJ6tOQY5ib3+aLO7m+yJTgJ7s6DHBDqLhqJPW0g7jiJcrDhYXsoS
JMMhMdUhckeZfTXm1N3Dc+/t9/E8NZjdZ2q/ZZzvygC4mu0uihwBKFqoFvXCHRaW
Rf4uYxE+/Upna/mbXQi5AQ0EU6sw1wEIALSp9Cc4t/F2k+rwEfEMXihXLcLM9Dmh
ukz++kMSCSuq4QHE+I4rLda/lVSNJCXaXrGVkzJuzmpEeQFdhr6nLW9ZYhzK8FIc
YyfsYTQxXUVf5W4e/XfKNoG9lrwQd5XHxJTBJ57XjjoWJYPQ69NWH8622foOBpux
xewgR2LEFgl+ksu7aQL4cQif6D3dko3EiIf1t0LDBXxFEREFCg+vkDFsDIW5bdaI
mDYwewGj7dAPLuo0sx1We+uBxb+j30xw/ASDOBhO3ratQWs+4w2FC7gw7cuf0CJC
/hMEw8nloGsIbqBmAnLdlQBxkfFG9DqRBNdSUM8xI66F0eGaaPHJ/S8AEQEAAYkB
JQQYAQoADwUCU6sw1wIbDAUJB4YfgAAKCRAqmDmBtcOxSZvvB/4w6S5YZQUmDVYK
9HPOm49qWxGPd5dLHr2g388sJ4LDK98Q9oicHgf2R35OXTyqhv4kFJL3eukQ6oLW
QOqQKLRycrQUu7eSESAiVmJ1gbuXLAWJmvUABGSYzj3BjWQRexYW/MZ51XqNftF9
oOSAoFWrdqeJbHoxPTXIb6P8EWk4Ei2j2bSIfBBSbBMSB6Kfk9IjpISM8+97RS5o
6605rmM5MY1Lz8cq8AZIYJs/MnUCZrpQ0c9QSWrflHAeWAy6xMGfdSynbEExQ4z8
AIfKWMro74nRFbAnv/BzrF2R8uHmdE7T6q9ZZsAydlaxQbdmyhCeGAdw93CwAypb
vHVobJ8A
=mIC1
-----END PGP PUBLIC KEY BLOCK-----`,
}
return utils.Validate(r, tps, fps)
}
func generateTestValues() []string {
// Sample JWT from RFC-7519
jwtSuffix := ".eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
// Validate known header parameters
// https://www.iana.org/assignments/jose/jose.xhtml
headers := map[string][]string{
"alg": {
`"ES256"`,
`"ES384"`,
`"ES512"`,
`"ECDH-ES"`,
`"HS256"`,
`"HS384"`,
`"HS512"`,
`"RS256"`,
`"RS384"`,
`"RS512"`,
`"PS256"`,
`"PS384"`, `"PS512"`,
`"none"`,
// Nonstandard
`"A128KW"`,
`"ECDH-ES+A256KW"`,
`"RSA-OAEP"`,
},
"apu": {`"Tx9qG69ZfodhRos-8qfhTPc6ZFnNUcgNDVdHqX1UR3s"`, `"RfXdxTfIzilWBzWWX3ovHBDzgDcLNy0BFJWSxa0dqnw"`},
"apv": {`"ZGlkOmVsZW06cm9wc3RlbjpFa"`, `"ZGlkOmtleTp6Nk1rak1TWWF1dU1neDlhekV5VW5UVzVvNWpGUmtiQnU1VDgzZjM5dU53bnNHbW0jejZMU29HdFpTclVNWnVkQWFnekVmWWY3azhqSFpjR0Q3OVNveDd2NHdDa0RLTlN3"`},
"aud": {`"https://vault.example.com"`, `"http://example.com"`},
"b64": {`true`, `false`},
"crit": {`["exp"]`},
"cty": {`"example"`, `"json"`},
"epk": {`{"crv":"X25519","kty":"OKP","x":"Tx9qG69ZfodhRos-8qfhTPc6ZFnNUcgNDVdHqX1UR3s"}`, `{"kty":"OKP","crv":"X25519","x":"RfXdxTfIzilWBzWWX3ovHBDzgDcLNy0BFJWSxa0dqnw"}`},
"enc": {`"A256GCM"`, `"A256CBC-HS512"`, `"A128CBC-HS256"`},
"jku": {`"https://c2id.com/jwks.json"`},
"jwk": {`{"crv":"P-256","kid":"DB2X:GSG2:72H3:AE3R:KCMI:Y77E:W7TF:ERHK:V5HR:JJ2Y:YMS6:HFGJ","kty":"EC","x":"jyr9-xZBorSC9fhqNsmfU_Ud31wbaZ-bVGz0HmySvbQ","y":"vkE6qZCCvYRWjSUwgAOvibQx_s8FipYkAiHS0VnAFNs"}`, `{"kty":"RSA","n":"jyTwiSJACtW_SW-aiihQS5Y5QR704zUwjhlevY0oK-y5wP7SlIc2hq2OPVRarCzjhOxZl2AQFzM5VCR7xRDcnIn9t_pl7Mgsnx9hKDS9yQ24YXzhQ4cMEVVuqwcHvXqPdWDSoCZ1ccMqiiPyBSNGQTXMPY5PBxMOR47XwOb4eNMOPqnzVio3MEtL2wphtEonP3MY6pxJJzzel04wSCRZ4n06reqwER3KwRFPnRpRxAgmSEot5IBLIT3jj-amT5sD7YoUDbPmLk23zgDBIhX88fkClilg1W-fUi1XxYZomEPGvV7OrE1yszt4YDPqKgjJT8t2JPy__1ri-8rZgSxn5Q","e":"AQAB"`},
"iss": {`"http://localhost:8087/realms/grafana"`, `"kubernetes/serviceaccount"`},
"iv": {`"zjJPRrj0TGez9JYkChTrB3iqKoDkiBhn"`, `"10PlAIteHLVABtt"`},
"kid": {`"my_key_id"`, `"did:example:123#zC1Rnuvw9rVa6E5TKF4uQVRuQuaCpVgB81Um2u17Fu7UK"`},
"key_ops": {`["sign"]`, `["decrypt"]`, `["encrypt"]`},
"kty": {`"EC"`, `"RSA"`},
"nonce": {`"Os_sBjfWzVZenwwjvLrwXA"`, `"LDDZAGcBuKYpuNlFTCxPYw"`},
"p2c": {`4096`, `1000`},
"p2s": {`"c_ORk4HSsqZD2LvVeCUHqg"`},
"ppt": {`"foo"`},
"sub": {`"project_path:my-group/my-project:ref_type:branch:ref:feature-branch-1"`, `"1234567890"`},
// I cannot find any real-world examples of the svt header
// and the RFC doesn't seem to explicitly state the content.
"svt": {``},
"tag": {`"h6mJqHn33oCsDd5X57MI-g"`},
"typ": {`"JWT"`, `"JWK"`, `"JSOE"`, `"JSON"`, `"plain"`},
"url": {`"https://example.com"`},
"use": {`"enc"`, `"sig"`},
"ver": {`"2"`, `"3"`},
"version": {`"2"`, `"3"`},
"x5c": {`["MIICmzCCAYMCBgF4HR7HNDANBgkqhkiG9w0BAQsFADARMQ8wDQYDVQQDDAZtYXN0ZXIwHhcNMjEwMzEwMTcwOTE5WhcNMzEwMzEwMTcxMDU5WjARMQ8wDQYDVQQDDAZtYXN0ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDCpLzXHp8i09R2HU5YJPyncC4tiAWWmaDrVZenqynWlWKOjIXb0Y5JoP3ET68u16Bf7mHQGc/u9rRvCw4A92HpJ15WyUSJ80YcK0gPTE0Woc1ZxdK3h4t9AoA8VSrROwQ77w/VAdGrrJ4bwkAVrFqSRpqAsW5XxV3/bU8YkVaG8mh0kuFf/5ib0vxdSkg+mz+ZCuIxQ5YN77kNaMecO19XuaBo7FsG9WjfCPxXYuajkuLgdptPgwTN4np70h0WjaSP/jhjL2ixf48w+27wFDP+ic+B/TCOtVa3fj1GPo6RLxHGU0Zh64jFhmvRM6E/kX7IQ+FJcOwp1VPA9/vMABopAgMBAAEwDQYJKoZIhvcNAQELBQADggEBALILq1Z4oQNJZEUt24VZcvknsWtQtvPxl3JNcBQgDR5/IMgl5VndRZ9OT56KUqrR5xRsWiCvh5Lgv4fUEzAAo9ToiPLub1SKP063zWrvfgi3YZ19bty0iXFm7l2cpQ3ejFV7WpcdLJE0lapFdPLo6QaRdgNu/1p4vbYg7zSK1fQ0OY5b3ajhAx/bhWlrN685owRbO5/r4rUOa6oo9l4Qn7jUxKUx4rcoe7zUM7qrpOPqKvn0DBp3n1/+9pOZXCjIfZGvYwP5NhzBDCkRzaXcJHlOqWzMBzyovVrzVmUilBcj+EsTYJs0gVXKzduX5zO6YWhFs23lu7AijdkxTY65YM0="]`},
"x5t": {`"IYIeevIT57t8ppUejM42Bqx6f3I"`},
"x5t#S256": {`"TuOrBy2NcTlFSWuZ8Kh8W8AjQagb4fnfP1SlKMO8-So"`},
"x5u": {`"https://tel.example.org/passport.cer"`},
"zip": {`"DEF"`},
}
var examples []string
for key, values := range headers {
for _, value := range values {
header := fmt.Sprintf(`{"%s":%s}`, key, value)
jwt := []byte(b64.RawURLEncoding.EncodeToString([]byte(header)) + jwtSuffix)
examples = append(examples, b64.StdEncoding.EncodeToString(jwt))
examples = append(examples, b64.RawStdEncoding.EncodeToString(jwt))
examples = append(examples, b64.URLEncoding.EncodeToString(jwt))
examples = append(examples, b64.RawURLEncoding.EncodeToString(jwt))
}
}
return examples
}
+28
View File
@@ -0,0 +1,28 @@
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 KrakenAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "kraken-access-token",
Description: "Identified a Kraken Access Token, potentially compromising cryptocurrency trading accounts and financial security.",
Regex: utils.GenerateSemiGenericRegex([]string{"kraken"},
utils.AlphaNumericExtendedLong("80,90"), true),
Keywords: []string{
"kraken",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("kraken",
secrets.NewSecret(utils.AlphaNumericExtendedLong("80,90"))),
}
return utils.Validate(r, tps, nil)
}
+69
View File
@@ -0,0 +1,69 @@
package rules
import (
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"regexp"
"github.com/zricethezav/gitleaks/v8/config"
)
// The kubernetes rules are split into two functions to make the complex proximity matching of the data-key and the kind-identifier more readable and testable
// KubernetesSecretWithDataBefore validates if we detected a kubernetes secret which contains data, before the resource identifier!
func KubernetesSecretWithDataBefore() *config.Rule {
// define rule
r := config.Rule{
RuleID: "kubernetes-secret-with-data-before",
Description: "Possible Kubernetes Secret detected, posing a risk of leaking credentials/tokens from your deployments",
// We try to match secrets by looking if we have the keyword
Regex: utils.GenerateUniqueTokenRegex(`(?i)(?:\b(?:data:))(\W+(?:\w+\W+){0,200}?)\bkind:.{0,10}Secret\b`, true),
Keywords: []string{
"Secret",
},
// Kubernetes secrets are always yaml files, we limit to common yaml-endings to make this rule more safe!
Path: regexp.MustCompile(`(?i)\.ya?ml$`),
}
// validate
tps := map[string]string{
// Sample Kubernetes Secret from https://kubernetes.io/docs/concepts/configuration/secret/
// These secrets contain the "data"-key before the actual identifier "kind: Secret"
"kubernetes.yaml": "apiVersion: v1'\n' data:'\n' extra: YmFyCg=='\n' kind: secret'\n' metadata:'\n' name: secret-sa-sample'\n' annotations:'\n' kubernetes.io/service-account.name: 'sa-name'", // gitleaks:allow
"kubernetes.yml": "apiVersion: v1'\n' data:'\n' password: UyFCXCpkJHpEc2I9'\n' username: YWRtaW4='\n' kind: Secret'\n' metadata:'\n' creationTimestamp: '2022-06-28T17:44:13Z''\n' name: db-user-pass'\n' namespace: default'\n' type: Opaque", // gitleaks:allow
// Quoted Test Cases
"kubernetes-quoted-1.yaml": "apiVersion: v1'\n' data:'\n' extra: YmFyCg=='\n' kind: 'Secret''\n' metadata:'\n' name: 'secret-sa-sample''\n' annotations:'\n' kubernetes.io/service-account.name: 'sa-name'", // gitleaks:allow
"kubernetes-quoted-2.yaml": "apiVersion: v1'\n' data:'\n' extra: YmFyCg=='\n' kind: 'secret''\n' metadata:'\n' name: 'secret-sa-sample''\n' annotations:'\n' kubernetes.io/service-account.name: 'sa-name'", // gitleaks:allow
}
return utils.ValidateWithPaths(r, tps, nil)
}
// KubernetesSecretWithDataAfter validates if we detected a kubernetes secret which contains data, after the resource identifier!
func KubernetesSecretWithDataAfter() *config.Rule {
// define rule
r := config.Rule{
RuleID: "kubernetes-secret-with-data-after",
Description: "Possible Kubernetes Secret detected, posing a risk of leaking credentials/tokens from your deployments",
// We try to match secrets by looking if we have the keyword
Regex: utils.GenerateUniqueTokenRegex(`(?i)(?:\bkind:.{0,10}Secret\b)(?:.|\s){0,200}?\b(?:data:)\s*(.+)`, true),
Keywords: []string{
"Secret",
},
// Kubernetes secrets are always yaml files, we limit to common yaml-endings to make this rule more safe!
Path: regexp.MustCompile(`(?i)\.ya?ml$`),
}
// validate
tps := map[string]string{
// Sample Kubernetes Secret from https://kubernetes.io/docs/concepts/configuration/secret/
// These secrets contain the data after the actual identifier "kind: Secret"
"kubernetes.yaml": "apiVersion: v1'\n' kind: secret'\n' data:'\n' extra: YmFyCg=='\n' metadata:'\n' name: secret-sa-sample'\n' annotations:'\n' kubernetes.io/service-account.name: 'sa-name'", // gitleaks:allow
"kubernetes.yml": "apiVersion: v1'\n' kind: Secret'\n' data:'\n' password: UyFCXCpkJHpEc2I9'\n' username: YWRtaW4='\n' metadata:'\n' creationTimestamp: '2022-06-28T17:44:13Z''\n' name: db-user-pass'\n' namespace: default'\n' type: Opaque", // gitleaks:allow
// Quoted Test Cases
"kubernetes-quoted-1.yaml": "apiVersion: v1'\n' kind: 'Secret''\n' data:'\n' password: UyFCXCpkJHpEc2I9'\n' username: YWRtaW4='\n' metadata:'\n' name: db-user-pass'\n' namespace: default'\n' type: Opaque", // gitleaks:allow
"kubernetes-quoted-2.yaml": "apiVersion: v1'\n' kind: 'secret''\n' data:'\n' password: UyFCXCpkJHpEc2I9'\n' username: YWRtaW4='\n' metadata:'\n' name: db-user-pass'\n' namespace: default'\n' type: Opaque", // gitleaks:allow
}
return utils.ValidateWithPaths(r, tps, nil)
}
+45
View File
@@ -0,0 +1,45 @@
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 KucoinAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "kucoin-access-token",
Description: "Found a Kucoin Access Token, risking unauthorized access to cryptocurrency exchange services and transactions.",
Regex: utils.GenerateSemiGenericRegex([]string{"kucoin"}, utils.Hex("24"), true),
Keywords: []string{
"kucoin",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("kucoin", secrets.NewSecret(utils.Hex("24"))),
}
return utils.Validate(r, tps, nil)
}
func KucoinSecretKey() *config.Rule {
// define rule
r := config.Rule{
RuleID: "kucoin-secret-key",
Description: "Discovered a Kucoin Secret Key, which could lead to compromised cryptocurrency operations and financial data breaches.",
Regex: utils.GenerateSemiGenericRegex([]string{"kucoin"}, utils.Hex8_4_4_4_12(), true),
Keywords: []string{
"kucoin",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("kucoin", secrets.NewSecret(utils.Hex8_4_4_4_12())),
}
return utils.Validate(r, tps, nil)
}
+26
View File
@@ -0,0 +1,26 @@
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 LaunchDarklyAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "launchdarkly-access-token",
Description: "Uncovered a Launchdarkly Access Token, potentially compromising feature flag management and application functionality.",
Regex: utils.GenerateSemiGenericRegex([]string{"launchdarkly"}, utils.AlphaNumericExtended("40"), true),
Keywords: []string{
"launchdarkly",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("launchdarkly", secrets.NewSecret(utils.AlphaNumericExtended("40"))),
}
return utils.Validate(r, tps, nil)
}
+41
View File
@@ -0,0 +1,41 @@
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"
)
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",
Regex: regexp.MustCompile(`lin_api_(?i)[a-z0-9]{40}`),
Keywords: []string{"lin_api_"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("linear", "lin_api_"+secrets.NewSecret(utils.AlphaNumeric("40"))),
}
return utils.Validate(r, tps, nil)
}
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",
Regex: utils.GenerateSemiGenericRegex([]string{"linear"}, utils.Hex("32"), true),
Keywords: []string{"linear"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("linear", secrets.NewSecret(utils.Hex("32"))),
}
return utils.Validate(r, tps, nil)
}
+53
View File
@@ -0,0 +1,53 @@
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 LinkedinClientSecret() *config.Rule {
// define rule
r := config.Rule{
RuleID: "linkedin-client-secret",
Description: "Discovered a LinkedIn Client secret, potentially compromising LinkedIn application integrations and user data.",
Regex: utils.GenerateSemiGenericRegex([]string{
"linkedin",
"linked-in",
}, utils.AlphaNumeric("16"), true),
Keywords: []string{
"linkedin",
"linked-in",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("linkedin", secrets.NewSecret(utils.AlphaNumeric("16"))),
}
return utils.Validate(r, tps, nil)
}
func LinkedinClientID() *config.Rule {
// define rule
r := config.Rule{
RuleID: "linkedin-client-id",
Description: "Found a LinkedIn Client ID, risking unauthorized access to LinkedIn integrations and professional data exposure.",
Regex: utils.GenerateSemiGenericRegex([]string{
"linkedin",
"linked-in",
}, utils.AlphaNumeric("14"), true),
Keywords: []string{
"linkedin",
"linked-in",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("linkedin", secrets.NewSecret(utils.AlphaNumeric("14"))),
}
return utils.Validate(r, tps, nil)
}
+47
View File
@@ -0,0 +1,47 @@
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 LobPubAPIToken() *config.Rule {
// define rule
r := config.Rule{
Description: "Detected a Lob Publishable API Key, posing a risk of exposing mail and print service integrations.",
RuleID: "lob-pub-api-key",
Regex: utils.GenerateSemiGenericRegex([]string{"lob"}, `(test|live)_pub_[a-f0-9]{31}`, true),
Keywords: []string{
"test_pub",
"live_pub",
"_pub",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("lob", "test_pub_"+secrets.NewSecret(utils.Hex("31"))),
}
return utils.Validate(r, tps, nil)
}
func LobAPIToken() *config.Rule {
// define rule
r := config.Rule{
Description: "Uncovered a Lob API Key, which could lead to unauthorized access to mailing and address verification services.",
RuleID: "lob-api-key",
Regex: utils.GenerateSemiGenericRegex([]string{"lob"}, `(live|test)_[a-f0-9]{35}`, true),
Keywords: []string{
"test_",
"live_",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("lob", "test_"+secrets.NewSecret(utils.Hex("35"))),
}
return utils.Validate(r, tps, nil)
}
+32
View File
@@ -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 MailChimp() *config.Rule {
// define rule
r := config.Rule{
RuleID: "mailchimp-api-key",
Description: "Identified a Mailchimp API key, potentially compromising email marketing campaigns and subscriber data.",
Regex: utils.GenerateSemiGenericRegex([]string{"MailchimpSDK.initialize", "mailchimp"}, utils.Hex("32")+`-us\d\d`, true),
Keywords: []string{
"mailchimp",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("mailchimp", secrets.NewSecret(utils.Hex("32"))+"-us20"),
`mailchimp_api_key: cefa780880ba5f5696192a34f6292c35-us18`, // gitleaks:allow
`MAILCHIMPE_KEY = "b5b9f8e50c640da28993e8b6a48e3e53-us18"`, // gitleaks:allow
}
fps := []string{
// False Negative
`MailchimpSDK.initialize(token: 3012a5754bbd716926f99c028f7ea428-us18)`, // gitleaks:allow
}
return utils.Validate(r, tps, fps)
}
+64
View File
@@ -0,0 +1,64 @@
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 MailGunPrivateAPIToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "mailgun-private-api-token",
Description: "Found a Mailgun private API token, risking unauthorized email service operations and data breaches.",
Regex: utils.GenerateSemiGenericRegex([]string{"mailgun"}, `key-[a-f0-9]{32}`, true),
Keywords: []string{
"mailgun",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("mailgun", "key-"+secrets.NewSecret(utils.Hex("32"))),
}
return utils.Validate(r, tps, nil)
}
func MailGunPubAPIToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "mailgun-pub-key",
Description: "Discovered a Mailgun public validation key, which could expose email verification processes and associated data.",
Regex: utils.GenerateSemiGenericRegex([]string{"mailgun"}, `pubkey-[a-f0-9]{32}`, true),
Keywords: []string{
"mailgun",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("mailgun", "pubkey-"+secrets.NewSecret(utils.Hex("32"))),
}
return utils.Validate(r, tps, nil)
}
func MailGunSigningKey() *config.Rule {
// define rule
r := config.Rule{
RuleID: "mailgun-signing-key",
Description: "Uncovered a Mailgun webhook signing key, potentially compromising email automation and data integrity.",
Regex: utils.GenerateSemiGenericRegex([]string{"mailgun"}, `[a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8}`, true),
Keywords: []string{
"mailgun",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("mailgun", secrets.NewSecret(utils.Hex("32"))+"-00001111-22223333"),
}
return utils.Validate(r, tps, nil)
}
+24
View File
@@ -0,0 +1,24 @@
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 MapBox() *config.Rule {
// define rule
r := config.Rule{
Description: "Detected a MapBox API token, posing a risk to geospatial services and sensitive location data exposure.",
RuleID: "mapbox-api-token",
Regex: utils.GenerateSemiGenericRegex([]string{"mapbox"}, `pk\.[a-z0-9]{60}\.[a-z0-9]{22}`, true),
Keywords: []string{"mapbox"},
}
// validate
tps := []string{
utils.GenerateSampleSecret("mapbox", "pk."+secrets.NewSecret(utils.AlphaNumeric("60"))+"."+secrets.NewSecret(utils.AlphaNumeric("22"))),
}
return utils.Validate(r, tps, nil)
}
+26
View File
@@ -0,0 +1,26 @@
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 MattermostAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "mattermost-access-token",
Description: "Identified a Mattermost Access Token, which may compromise team communication channels and data privacy.",
Regex: utils.GenerateSemiGenericRegex([]string{"mattermost"}, utils.AlphaNumeric("26"), true),
Keywords: []string{
"mattermost",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("mattermost", secrets.NewSecret(utils.AlphaNumeric("26"))),
}
return utils.Validate(r, tps, nil)
}
+59
View File
@@ -0,0 +1,59 @@
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 MessageBirdAPIToken() *config.Rule {
// define rule
r := config.Rule{
Description: "Found a MessageBird API token, risking unauthorized access to communication platforms and message data.",
RuleID: "messagebird-api-token",
Regex: utils.GenerateSemiGenericRegex([]string{
"messagebird",
"message-bird",
"message_bird",
}, utils.AlphaNumeric("25"), true),
Keywords: []string{
"messagebird",
"message-bird",
"message_bird",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("messagebird", secrets.NewSecret(utils.AlphaNumeric("25"))),
utils.GenerateSampleSecret("message-bird", secrets.NewSecret(utils.AlphaNumeric("25"))),
utils.GenerateSampleSecret("message_bird", secrets.NewSecret(utils.AlphaNumeric("25"))),
}
return utils.Validate(r, tps, nil)
}
func MessageBirdClientID() *config.Rule {
// define rule
r := config.Rule{
Description: "Discovered a MessageBird client ID, potentially compromising API integrations and sensitive communication data.",
RuleID: "messagebird-client-id",
Regex: utils.GenerateSemiGenericRegex([]string{
"messagebird",
"message-bird",
"message_bird",
}, utils.Hex8_4_4_4_12(), true),
Keywords: []string{
"messagebird",
"message-bird",
"message_bird",
},
}
// validate
tps := []string{
`const MessageBirdClientID = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
}
return utils.Validate(r, tps, nil)
}
+27
View File
@@ -0,0 +1,27 @@
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 NetlifyAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "netlify-access-token",
Description: "Detected a Netlify Access Token, potentially compromising web hosting services and site management.",
Regex: utils.GenerateSemiGenericRegex([]string{"netlify"},
utils.AlphaNumericExtended("40,46"), true),
Keywords: []string{
"netlify",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("netlify", secrets.NewSecret(utils.AlphaNumericExtended("40,46"))),
}
return utils.Validate(r, tps, nil)
}
+101
View File
@@ -0,0 +1,101 @@
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 NewRelicUserID() *config.Rule {
// define rule
r := config.Rule{
RuleID: "new-relic-user-api-key",
Description: "Discovered a New Relic user API Key, which could lead to compromised application insights and performance monitoring.",
Regex: utils.GenerateSemiGenericRegex([]string{
"new-relic",
"newrelic",
"new_relic",
}, `NRAK-[a-z0-9]{27}`, true),
Keywords: []string{
"NRAK",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("new-relic", "NRAK-"+secrets.NewSecret(utils.AlphaNumeric("27"))),
}
return utils.Validate(r, tps, nil)
}
func NewRelicUserKey() *config.Rule {
// define rule
r := config.Rule{
RuleID: "new-relic-user-api-id",
Description: "Found a New Relic user API ID, posing a risk to application monitoring services and data integrity.",
Regex: utils.GenerateSemiGenericRegex([]string{
"new-relic",
"newrelic",
"new_relic",
}, utils.AlphaNumeric("64"), true),
Keywords: []string{
"new-relic",
"newrelic",
"new_relic",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("new-relic", secrets.NewSecret(utils.AlphaNumeric("64"))),
}
return utils.Validate(r, tps, nil)
}
func NewRelicBrowserAPIKey() *config.Rule {
// define rule
r := config.Rule{
RuleID: "new-relic-browser-api-token",
Description: "Identified a New Relic ingest browser API token, risking unauthorized access to application performance data and analytics.",
Regex: utils.GenerateSemiGenericRegex([]string{
"new-relic",
"newrelic",
"new_relic",
}, `NRJS-[a-f0-9]{19}`, true),
Keywords: []string{
"NRJS-",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("new-relic", "NRJS-"+secrets.NewSecret(utils.Hex("19"))),
}
return utils.Validate(r, tps, nil)
}
func NewRelicInsertKey() *config.Rule {
// define rule
r := config.Rule{
RuleID: "new-relic-insert-key",
Description: "Discovered a New Relic insight insert key, compromising data injection into the platform.",
Regex: utils.GenerateSemiGenericRegex([]string{
"new-relic",
"newrelic",
"new_relic",
}, `NRII-[a-z0-9-]{32}`, true),
Keywords: []string{
"NRII-",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("new-relic", "NRII-"+secrets.NewSecret(utils.Hex("32"))),
}
return utils.Validate(r, tps, nil)
}
+26
View File
@@ -0,0 +1,26 @@
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 NPM() *config.Rule {
// define rule
r := 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),
Keywords: []string{
"npm_",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("npmAccessToken", "npm_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
}
return utils.Validate(r, tps, nil)
}
+30
View File
@@ -0,0 +1,30 @@
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 NytimesAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "nytimes-access-token",
Description: "Detected a Nytimes Access Token, risking unauthorized access to New York Times APIs and content services.",
Regex: utils.GenerateSemiGenericRegex([]string{
"nytimes", "new-york-times,", "newyorktimes"},
utils.AlphaNumericExtended("32"), true),
Keywords: []string{
"nytimes",
"new-york-times",
"newyorktimes",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("nytimes", secrets.NewSecret(utils.AlphaNumeric("32"))),
}
return utils.Validate(r, tps, nil)
}
+27
View File
@@ -0,0 +1,27 @@
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 OktaAccessToken() *config.Rule {
// define 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),
Keywords: []string{
"okta",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("okta", secrets.NewSecret(utils.AlphaNumeric("42"))),
}
return utils.Validate(r, tps, nil)
}
+26
View File
@@ -0,0 +1,26 @@
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 OpenAI() *config.Rule {
// define 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),
Keywords: []string{
"T3BlbkFJ",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("openaiApiKey", "sk-"+secrets.NewSecret(utils.AlphaNumeric("20"))+"T3BlbkFJ"+secrets.NewSecret(utils.AlphaNumeric("20"))),
}
return utils.Validate(r, tps, nil)
}
+38
View File
@@ -0,0 +1,38 @@
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"
)
// OpenShift 4 user tokens are prefixed with `sha256~`.
// https://docs.redhat.com/en/documentation/openshift_container_platform/4.10/html-single/authentication_and_authorization/index#oauth-view-details-tokens_managing-oauth-access-tokens
func OpenshiftUserToken() *config.Rule {
r := 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,
Keywords: []string{
"sha256~",
},
}
// validate
tps := []string{
`Authorization: Bearer sha256~kV46hPnEYhCWFnB85r5NrprAxggzgb6GOeLbgcKNsH0`, // https://github.com/openshift/console/blob/edae2305e01c2e0e8c33727af720ef960088eee3/dynamic-demo-plugin/README.md?plain=1#L114
`oc login --token=sha256~ZBMKw9VAayhdnyANaHvjJeXDiGwA7Fsr5gtLKj3-eh- `, // https://github.com/IBM/tekton-tutorial-openshift/blob/2a97d22ba282accad50821bca069210ea89de706/docs/lab1/0_setup.md?plain=1#L85
"sha256~" + secrets.NewSecret(`[\w-]{43}`),
}
fps := []string{
`--set kraken.kubeconfig.token.token="sha256~XXXXXXXXXX_PUT_YOUR_TOKEN_HERE_XXXXXXXXXXXX" \`, // https://github.com/krkn-chaos/krkn/blob/f3933f0e6239824eb9b5c46ff0e5d503b8465d6a/docs/index.md?plain=1#L307
`oc login --token=sha256~_xxxxxx_xxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxx-X \
--server=https://api.${zone}.appuio.cloud:6443`,
}
return utils.Validate(r, tps, fps)
}
+69
View File
@@ -0,0 +1,69 @@
package rules
import (
"fmt"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
)
func PlaidAccessID() *config.Rule {
// define rule
r := config.Rule{
RuleID: "plaid-client-id",
Description: "Uncovered a Plaid Client ID, which could lead to unauthorized financial service integrations and data breaches.",
Regex: utils.GenerateSemiGenericRegex([]string{"plaid"}, utils.AlphaNumeric("24"), true),
Entropy: 3.5,
Keywords: []string{
"plaid",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("plaid", secrets.NewSecret(utils.AlphaNumeric("24"))),
}
return utils.Validate(r, tps, nil)
}
func PlaidSecretKey() *config.Rule {
// define rule
r := config.Rule{
RuleID: "plaid-secret-key",
Description: "Detected a Plaid Secret key, risking unauthorized access to financial accounts and sensitive transaction data.",
Regex: utils.GenerateSemiGenericRegex([]string{"plaid"}, utils.AlphaNumeric("30"), true),
Entropy: 3.5,
Keywords: []string{
"plaid",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("plaid", secrets.NewSecret(utils.AlphaNumeric("30"))),
}
return utils.Validate(r, tps, nil)
}
func PlaidAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "plaid-api-token",
Description: "Discovered a Plaid API Token, potentially compromising financial data aggregation and banking services.",
Regex: utils.GenerateSemiGenericRegex([]string{"plaid"},
fmt.Sprintf("access-(?:sandbox|development|production)-%s", utils.Hex8_4_4_4_12()), true),
Keywords: []string{
"plaid",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("plaid", secrets.NewSecret(fmt.Sprintf("access-(?:sandbox|development|production)-%s", utils.Hex8_4_4_4_12()))),
}
return utils.Validate(r, tps, nil)
}
+70
View File
@@ -0,0 +1,70 @@
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 PlanetScalePassword() *config.Rule {
// define 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),
Keywords: []string{
"pscale_pw_",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("planetScalePassword", "pscale_pw_"+secrets.NewSecret(utils.AlphaNumericExtended("32"))),
utils.GenerateSampleSecret("planetScalePassword", "pscale_pw_"+secrets.NewSecret(utils.AlphaNumericExtended("43"))),
utils.GenerateSampleSecret("planetScalePassword", "pscale_pw_"+secrets.NewSecret(utils.AlphaNumericExtended("64"))),
}
return utils.Validate(r, tps, nil)
}
func PlanetScaleAPIToken() *config.Rule {
// define 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),
Keywords: []string{
"pscale_tkn_",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("planetScalePassword", "pscale_tkn_"+secrets.NewSecret(utils.AlphaNumericExtended("32"))),
utils.GenerateSampleSecret("planetScalePassword", "pscale_tkn_"+secrets.NewSecret(utils.AlphaNumericExtended("43"))),
utils.GenerateSampleSecret("planetScalePassword", "pscale_tkn_"+secrets.NewSecret(utils.AlphaNumericExtended("64"))),
}
return utils.Validate(r, tps, nil)
}
func PlanetScaleOAuthToken() *config.Rule {
// define 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),
Keywords: []string{
"pscale_oauth_",
},
}
// validate
tps := []string{
utils.GenerateSampleSecret("planetScalePassword", "pscale_oauth_"+secrets.NewSecret(utils.AlphaNumericExtended("32"))),
utils.GenerateSampleSecret("planetScalePassword", "pscale_oauth_"+secrets.NewSecret(utils.AlphaNumericExtended("43"))),
utils.GenerateSampleSecret("planetScalePassword", "pscale_oauth_"+secrets.NewSecret(utils.AlphaNumericExtended("64"))),
}
return utils.Validate(r, tps, nil)
}
Loaded 100 of 554 files, more files were not shown because too many files have changed in this diff. Show more