mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 05:04:22 +01:00
Add rule for fine-grained GitHub PAT (#1026)
This commit is contained in:
1 parent
6ef704f28f
commit
d0733f96f3
3 files changed
+25
No files matched your search
@@ -73,6 +73,7 @@ func main() {
|
|||||||
// configRules = append(configRules, rules.GCPServiceAccount())
|
// configRules = append(configRules, rules.GCPServiceAccount())
|
||||||
configRules = append(configRules, rules.GCPAPIKey())
|
configRules = append(configRules, rules.GCPAPIKey())
|
||||||
configRules = append(configRules, rules.GitHubPat())
|
configRules = append(configRules, rules.GitHubPat())
|
||||||
|
configRules = append(configRules, rules.GitHubFineGrainedPat())
|
||||||
configRules = append(configRules, rules.GitHubOauth())
|
configRules = append(configRules, rules.GitHubOauth())
|
||||||
configRules = append(configRules, rules.GitHubApp())
|
configRules = append(configRules, rules.GitHubApp())
|
||||||
configRules = append(configRules, rules.GitHubRefresh())
|
configRules = append(configRules, rules.GitHubRefresh())
|
||||||
|
|||||||
@@ -23,6 +23,22 @@ func GitHubPat() *config.Rule {
|
|||||||
return validate(r, tps, nil)
|
return validate(r, tps, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GitHubFineGrainedPat() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "GitHub Fine-Grained Personal Access Token",
|
||||||
|
RuleID: "github-fine-grained-pat",
|
||||||
|
Regex: regexp.MustCompile(`github_pat_[0-9a-zA-Z_]{82}`),
|
||||||
|
Keywords: []string{"github_pat_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("github", "github_pat_"+secrets.NewSecret(alphaNumeric("82"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
func GitHubOauth() *config.Rule {
|
func GitHubOauth() *config.Rule {
|
||||||
// define rule
|
// define rule
|
||||||
r := config.Rule{
|
r := config.Rule{
|
||||||
|
|||||||
@@ -1976,6 +1976,14 @@ keywords = [
|
|||||||
"ghu_","ghs_",
|
"ghu_","ghs_",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[rules]]
|
||||||
|
description = "GitHub Fine-Grained Personal Access Token"
|
||||||
|
id = "github-fine-grained-pat"
|
||||||
|
regex = '''github_pat_[0-9a-zA-Z_]{82}'''
|
||||||
|
keywords = [
|
||||||
|
"github_pat_",
|
||||||
|
]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "GitHub OAuth Access Token"
|
description = "GitHub OAuth Access Token"
|
||||||
id = "github-oauth"
|
id = "github-oauth"
|
||||||
|
|||||||
Reference in new issue
Block a user