mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 20:24:22 +01:00
* Add support for GitLab routable tokens #1655 This commit adds support for GitLabs routable tokens. For the specification see: https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/cells/routable_tokens/#proposal Issue: https://github.com/gitleaks/gitleaks/issues/1655 * Add support for GitLab routable tokens #1655 This commit adds increases the entropy. For the specification see: https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/cells/routable_tokens/#proposal Issue: https://github.com/gitleaks/gitleaks/issues/1655 * add word boundary to regex Co-authored-by: Ben-grmbl <173737458+Ben-grmbl@users.noreply.github.com> * chore: re-generate gitleaks.toml Co-authored-by: Ben-grmbl <173737458+Ben-grmbl@users.noreply.github.com> --------- Co-authored-by: Nicholas Wittstruck <1283061+nwittstruck@users.noreply.github.com> Co-authored-by: Ben-grmbl <173737458+Ben-grmbl@users.noreply.github.com>
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)
}