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
This commit is contained in:
Nicholas Wittstruck committed 2024-11-24 18:52:00 +01:00
1 parent 61d2713fb4
commit 86fecfb2da
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -120,14 +120,14 @@ func GitlabPatRoutable() *config.Rule {
RuleID: "gitlab-pat-routable",
Description: "Identified a GitLab Personal Access Token (routable), risking unauthorized access to GitLab repositories and codebase exposure.",
Regex: regexp.MustCompile(`glpat-[0-9a-zA-Z_-]{27,300}\.[0-9a-z]{2}[0-9a-z]{7}`),
Entropy: 3,
Entropy: 4,
Keywords: []string{"glpat-"},
}
// validate
tps := utils.GenerateSampleSecrets("gitlab", "glpat-"+secrets.NewSecret(utils.AlphaNumeric("27"))+"."+secrets.NewSecret(utils.AlphaNumeric("2"))+secrets.NewSecret(utils.AlphaNumeric("7")))
fps := []string{
"glpat-XXXXXXXXXXXXXXXXXXX",
"glpat-xxxxxxxx-xxxxxxxxxxxxxxxxxx.xxxxxxxxx",
}
return utils.Validate(r, tps, fps)
}
+1 -1
View File
@@ -2141,7 +2141,7 @@ keywords = ["glpat-"]
id = "gitlab-pat-routable"
description = "Identified a GitLab Personal Access Token (routable), risking unauthorized access to GitLab repositories and codebase exposure."
regex = '''glpat-[0-9a-zA-Z_-]{27,300}\.[0-9a-z]{2}[0-9a-z]{7}'''
entropy = 3
entropy = 4
keywords = ["glpat-"]
[[rules]]