mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 04:34:46 +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">
|
<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" />
|
<img src="https://img.shields.io/badge/Secured%20by-Jit-B8287F?style=?style=plastic" />
|
||||||
</a>
|
</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">
|
<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" />
|
<img src="https://img.shields.io/twitter/follow/zricethezav?label=Follow%20zricethezav&style=social&color=blue" alt="Follow @zricethezav" />
|
||||||
</a>
|
</a>
|
||||||
@@ -62,6 +65,25 @@ cd gitleaks
|
|||||||
make build
|
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
|
### Pre-Commit
|
||||||
1. Install pre-commit from https://pre-commit.com/#install
|
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:
|
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.FinicityAPIToken())
|
||||||
configRules = append(configRules, rules.FlutterwavePublicKey())
|
configRules = append(configRules, rules.FlutterwavePublicKey())
|
||||||
configRules = append(configRules, rules.FlutterwaveSecretKey())
|
configRules = append(configRules, rules.FlutterwaveSecretKey())
|
||||||
configRules = append(configRules, rules.FlutterwaveSecretKey())
|
configRules = append(configRules, rules.FlutterwaveEncKey())
|
||||||
configRules = append(configRules, rules.FrameIO())
|
configRules = append(configRules, rules.FrameIO())
|
||||||
configRules = append(configRules, rules.GoCardless())
|
configRules = append(configRules, rules.GoCardless())
|
||||||
// TODO figure out what makes sense for GCP
|
// TODO figure out what makes sense for GCP
|
||||||
@@ -104,6 +104,15 @@ func main() {
|
|||||||
configRules = append(configRules, rules.Typeform())
|
configRules = append(configRules, rules.Typeform())
|
||||||
configRules = append(configRules, rules.GenericCredential())
|
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{
|
config := config.Config{
|
||||||
Rules: configRules,
|
Rules: configRules,
|
||||||
}
|
}
|
||||||
@@ -112,7 +121,7 @@ func main() {
|
|||||||
log.Fatal().Err(err).Msg("Failed to parse template")
|
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 {
|
if err != nil {
|
||||||
log.Fatal().Err(err).Msg("Failed to create rules.toml")
|
log.Fatal().Err(err).Msg("Failed to create rules.toml")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ func DropBoxAPISecret() *config.Rule {
|
|||||||
// define rule
|
// define rule
|
||||||
r := config.Rule{
|
r := config.Rule{
|
||||||
Description: "Dropbox API secret",
|
Description: "Dropbox API secret",
|
||||||
RuleID: "doppler-api-token",
|
RuleID: "dropbox-api-token",
|
||||||
Regex: generateSemiGenericRegex([]string{"dropbox"}, alphaNumeric("15")),
|
Regex: generateSemiGenericRegex([]string{"dropbox"}, alphaNumeric("15")),
|
||||||
SecretGroup: 1,
|
SecretGroup: 1,
|
||||||
Keywords: []string{"dropbox"},
|
Keywords: []string{"dropbox"},
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ func FlutterwavePublicKey() *config.Rule {
|
|||||||
func FlutterwaveSecretKey() *config.Rule {
|
func FlutterwaveSecretKey() *config.Rule {
|
||||||
// define rule
|
// define rule
|
||||||
r := config.Rule{
|
r := config.Rule{
|
||||||
Description: "Finicity Secret Key",
|
Description: "Flutterwave Secret Key",
|
||||||
RuleID: "flutterwave-public-key",
|
RuleID: "flutterwave-secret-key",
|
||||||
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{32}-X`),
|
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{32}-X`),
|
||||||
Keywords: []string{"FLWSECK_TEST"},
|
Keywords: []string{"FLWSECK_TEST"},
|
||||||
}
|
}
|
||||||
@@ -42,8 +42,8 @@ func FlutterwaveSecretKey() *config.Rule {
|
|||||||
func FlutterwaveEncKey() *config.Rule {
|
func FlutterwaveEncKey() *config.Rule {
|
||||||
// define rule
|
// define rule
|
||||||
r := config.Rule{
|
r := config.Rule{
|
||||||
Description: "Finicity Secret Key",
|
Description: "Flutterwave Encryption Key",
|
||||||
RuleID: "flutterwave-public-key",
|
RuleID: "flutterwave-encryption-key",
|
||||||
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{12}`),
|
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{12}`),
|
||||||
Keywords: []string{"FLWSECK_TEST"},
|
Keywords: []string{"FLWSECK_TEST"},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ keywords = [
|
|||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Dropbox API secret"
|
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]|$)'''
|
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
|
secretGroup = 1
|
||||||
keywords = [
|
keywords = [
|
||||||
@@ -291,17 +291,17 @@ keywords = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Finicity Secret Key"
|
description = "Flutterwave Secret Key"
|
||||||
id = "flutterwave-public-key"
|
id = "flutterwave-secret-key"
|
||||||
regex = '''FLWSECK_TEST-(?i)[a-h0-9]{32}-X'''
|
regex = '''FLWSECK_TEST-(?i)[a-h0-9]{32}-X'''
|
||||||
keywords = [
|
keywords = [
|
||||||
"flwseck_test",
|
"flwseck_test",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
description = "Finicity Secret Key"
|
description = "Flutterwave Encryption Key"
|
||||||
id = "flutterwave-public-key"
|
id = "flutterwave-encryption-key"
|
||||||
regex = '''FLWSECK_TEST-(?i)[a-h0-9]{32}-X'''
|
regex = '''FLWSECK_TEST-(?i)[a-h0-9]{12}'''
|
||||||
keywords = [
|
keywords = [
|
||||||
"flwseck_test",
|
"flwseck_test",
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in new issue
Block a user