Skip to content

Commit 28614f3

Browse files
fix: change just githubApp to our side
1 parent 2e9dfd6 commit 28614f3

File tree

2 files changed

+3
-65
lines changed

2 files changed

+3
-65
lines changed

engine/rules/github.go

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,6 @@ import (
77
"github.com/zricethezav/gitleaks/v8/config"
88
)
99

10-
func GitHubPat() *config.Rule {
11-
// define rule
12-
r := config.Rule{
13-
Description: "Uncovered a GitHub Personal Access Token, potentially leading to unauthorized repository access and sensitive content exposure.",
14-
RuleID: "github-pat",
15-
Regex: regexp.MustCompile(`ghp_[0-9a-zA-Z]{36}`),
16-
Keywords: []string{"ghp_"},
17-
}
18-
19-
// validate
20-
tps := []string{
21-
generateSampleSecret("github", "ghp_"+secrets.NewSecret(alphaNumeric("36"))),
22-
}
23-
return validate(r, tps, nil)
24-
}
25-
26-
func GitHubFineGrainedPat() *config.Rule {
27-
// define rule
28-
r := config.Rule{
29-
Description: "Found a GitHub Fine-Grained Personal Access Token, risking unauthorized repository access and code manipulation.",
30-
RuleID: "github-fine-grained-pat",
31-
Regex: regexp.MustCompile(`github_pat_[0-9a-zA-Z_]{82}`),
32-
Keywords: []string{"github_pat_"},
33-
}
34-
35-
// validate
36-
tps := []string{
37-
generateSampleSecret("github", "github_pat_"+secrets.NewSecret(alphaNumeric("82"))),
38-
}
39-
return validate(r, tps, nil)
40-
}
41-
42-
func GitHubOauth() *config.Rule {
43-
// define rule
44-
r := config.Rule{
45-
Description: "Discovered a GitHub OAuth Access Token, posing a risk of compromised GitHub account integrations and data leaks.",
46-
RuleID: "github-oauth",
47-
Regex: regexp.MustCompile(`gho_[0-9a-zA-Z]{36}`),
48-
Keywords: []string{"gho_"},
49-
}
50-
51-
// validate
52-
tps := []string{
53-
generateSampleSecret("github", "gho_"+secrets.NewSecret(alphaNumeric("36"))),
54-
}
55-
return validate(r, tps, nil)
56-
}
57-
5810
func GitHubApp() *config.Rule {
5911
// define rule
6012
r := config.Rule{
@@ -71,19 +23,3 @@ func GitHubApp() *config.Rule {
7123
}
7224
return validate(r, tps, nil)
7325
}
74-
75-
func GitHubRefresh() *config.Rule {
76-
// define rule
77-
r := config.Rule{
78-
Description: "Detected a GitHub Refresh Token, which could allow prolonged unauthorized access to GitHub services.",
79-
RuleID: "github-refresh-token",
80-
Regex: regexp.MustCompile(`ghr_[0-9a-zA-Z]{36}`),
81-
Keywords: []string{"ghr_"},
82-
}
83-
84-
// validate
85-
tps := []string{
86-
generateSampleSecret("github", "ghr_"+secrets.NewSecret(alphaNumeric("36"))),
87-
}
88-
return validate(r, tps, nil)
89-
}

engine/rules/rule_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ func Test2msRules(t *testing.T) {
1515
validate func() *config.Rule
1616
}{
1717
{name: "AuthenticatedURL", validate: rules.AuthenticatedURL},
18+
{name: "Clojars", validate: rules.Clojars},
19+
{name: "GenericCredential", validate: rules.GenericCredential},
20+
{name: "GitHubApp", validate: rules.GitHubApp},
1821
{name: "HardcodedPassword", validate: rules.HardcodedPassword},
1922
{name: "PlaidAccessID", validate: rules.PlaidAccessID},
2023
{name: "PrivateKey", validate: rules.PrivateKey},
21-
{name: "VaultServiceToken", validate: rules.VaultServiceToken},
2224
}
2325

2426
for _, tRule := range testsRules {

0 commit comments

Comments
 (0)