mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-27 11:44:23 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70028079b4 | ||
|
|
c14af5ffdf | ||
|
|
06b1396a2a | ||
|
|
5d3f247d7d | ||
|
|
404dd8e0c0 | ||
|
|
3a1ab48818 | ||
|
|
f5c2b636f3 | ||
|
|
b5ed7ff1b2 | ||
|
|
09007da395 | ||
|
|
d51ce47d86 | ||
|
|
6919447094 |
No files matched your search
@@ -0,0 +1,13 @@
|
||||
name: gitleaks
|
||||
on: [pull_request, push, workflow_dispatch]
|
||||
jobs:
|
||||
scan:
|
||||
name: gitleaks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: gitleaks/gitleaks-action@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -19,6 +19,9 @@
|
||||
<a href="https://www.jit.io/jit-open-source-gitleaks?utm_source=github&utm_medium=badge&utm_campaign=GitleaksReadme&utm_id=oss&items=item-secret-detection">
|
||||
<img src="https://img.shields.io/badge/Secured%20by-Jit-B8287F?style=?style=plastic" />
|
||||
</a>
|
||||
<a href="https://github.com/zricethezav/gitleaks-action">
|
||||
<img alt="gitleaks badge" src="https://img.shields.io/badge/protected%20by-gitleaks-blue">
|
||||
</a>
|
||||
<a href="https://twitter.com/intent/follow?screen_name=zricethezav">
|
||||
<img src="https://img.shields.io/twitter/follow/zricethezav?label=Follow%20zricethezav&style=social&color=blue" alt="Follow @zricethezav" />
|
||||
</a>
|
||||
@@ -62,6 +65,25 @@ cd gitleaks
|
||||
make build
|
||||
```
|
||||
|
||||
### Github Action
|
||||
Check out the official [Gitleaks GitHub Action](https://github.com/gitleaks/gitleaks-action)
|
||||
```
|
||||
name: gitleaks
|
||||
on: [pull_request, push, workflow_dispatch]
|
||||
jobs:
|
||||
scan:
|
||||
name: gitleaks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: gitleaks/gitleaks-action@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}} # Only required for Organizations, not personal accounts.
|
||||
```
|
||||
|
||||
### Pre-Commit
|
||||
1. Install pre-commit from https://pre-commit.com/#install
|
||||
2. Create a `.pre-commit-config.yaml` file at the root of your repository with the following content:
|
||||
|
||||
@@ -49,7 +49,7 @@ func main() {
|
||||
configRules = append(configRules, rules.FinicityAPIToken())
|
||||
configRules = append(configRules, rules.FlutterwavePublicKey())
|
||||
configRules = append(configRules, rules.FlutterwaveSecretKey())
|
||||
configRules = append(configRules, rules.FlutterwaveSecretKey())
|
||||
configRules = append(configRules, rules.FlutterwaveEncKey())
|
||||
configRules = append(configRules, rules.FrameIO())
|
||||
configRules = append(configRules, rules.GoCardless())
|
||||
// TODO figure out what makes sense for GCP
|
||||
@@ -104,6 +104,15 @@ func main() {
|
||||
configRules = append(configRules, rules.Typeform())
|
||||
configRules = append(configRules, rules.GenericCredential())
|
||||
|
||||
// ensure rules have unique ids
|
||||
ruleLookUp := make(map[string]bool)
|
||||
for _, rule := range configRules {
|
||||
// check if rule is in ruleLookUp
|
||||
if _, ok := ruleLookUp[rule.RuleID]; ok {
|
||||
log.Fatal().Msgf("rule id %s is not unique", rule.RuleID)
|
||||
}
|
||||
ruleLookUp[rule.RuleID] = true
|
||||
}
|
||||
config := config.Config{
|
||||
Rules: configRules,
|
||||
}
|
||||
@@ -112,7 +121,7 @@ func main() {
|
||||
log.Fatal().Err(err).Msg("Failed to parse template")
|
||||
}
|
||||
|
||||
f, err := os.Create("gitleaks.toml")
|
||||
f, err := os.Create("../../../config/gitleaks.toml")
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to create rules.toml")
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ func DropBoxAPISecret() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Dropbox API secret",
|
||||
RuleID: "doppler-api-token",
|
||||
RuleID: "dropbox-api-token",
|
||||
Regex: generateSemiGenericRegex([]string{"dropbox"}, alphaNumeric("15")),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"dropbox"},
|
||||
|
||||
@@ -26,8 +26,8 @@ func FlutterwavePublicKey() *config.Rule {
|
||||
func FlutterwaveSecretKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Finicity Secret Key",
|
||||
RuleID: "flutterwave-public-key",
|
||||
Description: "Flutterwave Secret Key",
|
||||
RuleID: "flutterwave-secret-key",
|
||||
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{32}-X`),
|
||||
Keywords: []string{"FLWSECK_TEST"},
|
||||
}
|
||||
@@ -42,8 +42,8 @@ func FlutterwaveSecretKey() *config.Rule {
|
||||
func FlutterwaveEncKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Finicity Secret Key",
|
||||
RuleID: "flutterwave-public-key",
|
||||
Description: "Flutterwave Encryption Key",
|
||||
RuleID: "flutterwave-encryption-key",
|
||||
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{12}`),
|
||||
Keywords: []string{"FLWSECK_TEST"},
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ keywords = [
|
||||
|
||||
[[rules]]
|
||||
description = "Dropbox API secret"
|
||||
id = "doppler-api-token"
|
||||
id = "dropbox-api-token"
|
||||
regex = '''(?i)(?:dropbox)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{15})(?:['|\"|\n|\r|\s|\x60]|$)'''
|
||||
secretGroup = 1
|
||||
keywords = [
|
||||
@@ -291,17 +291,17 @@ keywords = [
|
||||
]
|
||||
|
||||
[[rules]]
|
||||
description = "Finicity Secret Key"
|
||||
id = "flutterwave-public-key"
|
||||
description = "Flutterwave Secret Key"
|
||||
id = "flutterwave-secret-key"
|
||||
regex = '''FLWSECK_TEST-(?i)[a-h0-9]{32}-X'''
|
||||
keywords = [
|
||||
"flwseck_test",
|
||||
]
|
||||
|
||||
[[rules]]
|
||||
description = "Finicity Secret Key"
|
||||
id = "flutterwave-public-key"
|
||||
regex = '''FLWSECK_TEST-(?i)[a-h0-9]{32}-X'''
|
||||
description = "Flutterwave Encryption Key"
|
||||
id = "flutterwave-encryption-key"
|
||||
regex = '''FLWSECK_TEST-(?i)[a-h0-9]{12}'''
|
||||
keywords = [
|
||||
"flwseck_test",
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user