Files
gitleaks/cmd/generate/config/rules
..
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-30 08:21:14 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-04 19:39:53 -05:00
2024-10-27 07:43:55 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-19 19:49:36 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-09-18 10:24:41 -05:00
2024-10-29 01:47:12 -05:00
2024-10-22 08:23:47 -05:00
2024-09-24 16:09:15 -05:00
2024-09-18 10:23:18 -05:00
2024-10-29 01:47:12 -05:00
2024-10-22 08:23:47 -05:00
2024-10-28 08:15:36 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-19 19:49:36 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-29 01:47:12 -05:00
2024-10-22 08:23:47 -05:00
2024-10-25 08:00:59 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-06 07:28:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00
2024-10-22 08:23:47 -05:00

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 ReadMe() *config.Rule {
	// define rule
	r := config.Rule{
		RuleID:      "readme-api-token",
		Description: "Detected a Readme API token, risking unauthorized documentation management and content exposure.",
		Regex:       utils.GenerateUniqueTokenRegex(`rdme_[a-z0-9]{70}`, false),
		Entropy:     2,
		Keywords: []string{
			"rdme_",
		},
	}

	// validate
	tps := []string{
		utils.GenerateSampleSecret("api-token", "rdme_"+secrets.NewSecret(utils.AlphaNumeric("70"))),
	}
	fps := []string{
		`const API_KEY = 'rdme_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';`,
	}
	return utils.Validate(r, tps, fps)
}