Files
gitleaks/cmd/generate/config/rules
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
..
2023-11-29 17:03:11 -06:00
2024-02-19 09:26:41 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2024-06-01 18:55:04 -05:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2024-03-22 13:31:09 -05:00
2023-11-18 12:28:17 -06:00
2023-11-29 17:03:11 -06:00
2024-06-13 11:14:44 -04:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06:00
2023-11-29 17:03:11 -06: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: "Detected a Readme API token, risking unauthorized documentation management and content exposure.",
		Regex:       generateUniqueTokenRegex(`rdme_[a-z0-9]{70}`, true),

		Keywords: []string{
			"rdme_",
		},
	}

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