Files
gitleaks/cmd/generate/config/rules
Oscar BlancoandRichard Gomez 4181ad647a Add new jira api token pattern (#1601)
* add new jira api token pattern

* Apply suggestions from code review

Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com>

* apply comments from PR

* Apply suggestions from code review

Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com>

* apply comments from PR

---------

Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com>
2024-10-31 08:19:05 -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-06 07:28: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 := utils.GenerateSampleSecrets("api-token", "rdme_"+secrets.NewSecret(utils.AlphaNumeric("70")))

	fps := []string{
		`const API_KEY = 'rdme_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';`,
	}
	return utils.Validate(r, tps, fps)
}