Generate comprehensive secret samples (#1484)

* feat(config): comprehensive samples

* refactor(config): use new generate func

* chore(config): comment unsupported cases

* feat(config): enable '?=' case

* feat(config): enable '+=' case

* feat(config): enable escaped json case

* feat(config): enable '<' (xml) case

* feat(config): enable multiline yaml case

* chore(config): add comment case

* feat(config): add php cases

* feat(config): add java case

* chore(config): address review comments

* fix(config): prevent matching '=='

* feat(config): add URL cases

* chore(config): revert regex changes
To be tackled in separate PRs.
This commit is contained in:
Richard Gomez authored and GitHub committed 2024-10-30 09:34:21 -05:00
1 parent d1d9054ef0
commit c11adc91ad
110 files changed
+436 -621

No files matched your search

+6 -6
View File
@@ -17,11 +17,11 @@ func SquareAccessToken() *config.Rule {
}
// validate
tps := []string{
utils.GenerateSampleSecret("square", secrets.NewSecret(`(?:EAAA|sq0atp-)[\w-]{22,60}`)),
tps := utils.GenerateSampleSecrets("square", secrets.NewSecret(`(?:EAAA|sq0atp-)[\w-]{22,60}`))
tps = append(tps,
"ARG token=sq0atp-812erere3wewew45678901", // gitleaks:allow
"ARG token=EAAAlsBxkkVgvmr7FasTFbM6VUGZ31EJ4jZKTJZySgElBDJ_wyafHuBFquFexY7E", // gitleaks:allow",
}
)
fps := []string{
`aws-cli@sha256:eaaa7b11777babe28e6133a8b19ff71cea687e0d7f05158dee95a71f76ce3d00`,
}
@@ -39,9 +39,9 @@ func SquareSecret() *config.Rule {
}
// validate
tps := []string{
utils.GenerateSampleSecret("square", secrets.NewSecret(`sq0csp-[\w-]{43}`)),
tps := utils.GenerateSampleSecrets("square", secrets.NewSecret(`sq0csp-[0-9A-Za-z\\-_]{43}`))
tps = append(tps,
`value: "sq0csp-0p9h7g6f4s3s3s3-4a3ardgwa6ADRDJDDKUFYDYDYDY"`, // gitleaks:allow
}
)
return utils.Validate(r, tps, nil)
}