Compare commits

..
11 Commits
Author SHA1 Message Date
Zachary Rice 70028079b4 Update generate (#892)
* maintain parity with recent changes... need to create rule contributing guidelines

* missed on, ensure uniqueness in rule-id
2022-06-20 14:57:48 -05:00
Zachary Rice c14af5ffdf maintain parity with recent changes... need to create rule contributing guidelines (#891) 2022-06-20 14:14:14 -05:00
Craig SmithandCraig Smith 06b1396a2a Fix duplicate TOML Rules and IDs (#889)
* Remove duplicate rule

* Fix duplicate rule IDs

Co-authored-by: Craig Smith <5344211-craigmsmith@users.noreply.gitlab.com>
2022-06-20 08:49:47 -05:00
Zachary Rice 5d3f247d7d Update README.md 2022-06-16 08:11:20 -05:00
Zachary Rice 404dd8e0c0 Update gitleaks.yml 2022-06-15 17:20:08 -05:00
Zachary Rice 3a1ab48818 Update README.md 2022-06-12 13:25:03 -05:00
Zachary Rice f5c2b636f3 user accounts don't need gitleaks license 2022-06-07 11:48:43 -05:00
Zachary Rice b5ed7ff1b2 Update README.md 2022-06-02 17:47:36 -05:00
Zachary Rice 09007da395 Add gitleaks badge 2022-06-02 17:46:47 -05:00
Zachary Rice d51ce47d86 Create gitleaks.yml (#884) 2022-06-02 17:40:57 -05:00
Zachary Rice 6919447094 add link to gitleaks.io 2022-06-02 17:21:08 -05:00
6 changed files with 57 additions and 13 deletions

No files matched your search

+13
View File
@@ -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 }}
+22
View File
@@ -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:
+11 -2
View File
@@ -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")
} }
+1 -1
View File
@@ -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"},
+4 -4
View File
@@ -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"},
} }
+6 -6
View File
@@ -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",
] ]