mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 20:24:22 +01:00
* chore(generate): make utils public * chore(generate): change validate log messages * chore(generate): split functions into files * chore(config): add warning for public funcs
27 lines
695 B
Go
27 lines
695 B
Go
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}`, true),
|
|
|
|
Keywords: []string{
|
|
"rdme_",
|
|
},
|
|
}
|
|
|
|
// validate
|
|
tps := []string{
|
|
utils.GenerateSampleSecret("api-token", "rdme_"+secrets.NewSecret(utils.AlphaNumeric("70"))),
|
|
}
|
|
return utils.Validate(r, tps, nil)
|
|
}
|