forked from gitleaks/gitleaks
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add JFrog API and Identity keys (gitleaks#1233)
* first commit * feat: add JFrog API and Identity key
- Loading branch information
Showing
3 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package rules | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" | ||
"github.com/zricethezav/gitleaks/v8/config" | ||
) | ||
|
||
func JFrogAPIKey() *config.Rule { | ||
keywords := []string{"jfrog", "artifactory", "bintray", "xray"} | ||
|
||
// Define Rule | ||
r := config.Rule{ | ||
// Human readable description of the rule | ||
Description: "JFrog API Key", | ||
|
||
// Unique ID for the rule | ||
RuleID: "jfrog-api-key", | ||
|
||
// Regex capture group for the actual secret | ||
SecretGroup: 1, | ||
|
||
// Regex used for detecting secrets. See regex section below for more details | ||
Regex: generateSemiGenericRegex(keywords, alphaNumeric("73")), | ||
|
||
// Keywords used for string matching on fragments (think of this as a prefilter) | ||
Keywords: keywords, | ||
} | ||
|
||
// validate | ||
tps := []string{ | ||
fmt.Sprintf("--set imagePullSecretJfrog.password=%s", secrets.NewSecret(alphaNumeric("73"))), | ||
} | ||
return validate(r, tps, nil) | ||
} | ||
|
||
func JFrogIdentityToken() *config.Rule { | ||
keywords := []string{"jfrog", "artifactory", "bintray", "xray"} | ||
|
||
// Define Rule | ||
r := config.Rule{ | ||
// Human readable description of the rule | ||
Description: "JFrog Identity Token", | ||
|
||
// Unique ID for the rule | ||
RuleID: "jfrog-identity-token", | ||
|
||
// Regex capture group for the actual secret | ||
SecretGroup: 1, | ||
|
||
// Regex used for detecting secrets. See regex section below for more details | ||
Regex: generateSemiGenericRegex(keywords, alphaNumeric("64")), | ||
|
||
// Keywords used for string matching on fragments (think of this as a prefilter) | ||
Keywords: keywords, | ||
} | ||
|
||
// validate | ||
tps := []string{ | ||
generateSampleSecret("jfrog", secrets.NewSecret(alphaNumeric("64"))), | ||
generateSampleSecret("artifactory", secrets.NewSecret(alphaNumeric("64"))), | ||
generateSampleSecret("bintray", secrets.NewSecret(alphaNumeric("64"))), | ||
generateSampleSecret("xray", secrets.NewSecret(alphaNumeric("64"))), | ||
} | ||
return validate(r, tps, nil) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters