Files
gitleaks/cmd/generate/config/rules
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
..
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-06-27 08:58:00 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-06-20 14:57:48 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-08-19 10:43:01 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-09-04 08:58:57 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-08-19 08:24:15 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-08-19 08:24:15 -05:00
2022-04-21 08:31:58 -05:00
2022-08-03 07:31:40 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-08-03 07:31:40 -05:00
2022-08-03 07:31:40 -05:00
2022-04-21 08:31:58 -05:00
2022-06-28 06:10:02 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-04-21 08:31:58 -05:00
2022-08-03 15:46:46 -05:00

package rules

import (
	"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
	"github.com/zricethezav/gitleaks/v8/config"
)

func ReadMe() *config.Rule {
	// define rule
	r := config.Rule{
		RuleID:      "readme-api-token",
		Description: "Readme API token",
		Regex:       generateUniqueTokenRegex(`rdme_[a-z0-9]{70}`),
		SecretGroup: 1,
		Keywords: []string{
			"rdme_",
		},
	}

	// validate
	tps := []string{
		generateSampleSecret("api-token", "rdme_"+secrets.NewSecret(alphaNumeric("70"))),
	}
	return validate(r, tps, nil)
}