Compare commits

..
3 Commits
Author SHA1 Message Date
Richard Gomez 128cd22f7c fix(rule): comment out errant validation case (#1509)
This should be re-enabled once a more suitable fix is implemented.
2024-09-16 06:17:26 -05:00
Zachary Rice 1a6d2b0a7a remove validate config test temporarily 2024-09-14 05:49:13 -05:00
Zachary Rice 0874ebcc3f Update README.md 2024-09-14 05:46:28 -05:00
4 changed files with 10 additions and 59 deletions

No files matched your search

-3
View File
@@ -24,6 +24,3 @@ jobs:
- name: Test
run: make test
- name: Validate Config
run: go generate ./... && git diff --exit-code
-48
View File
@@ -208,54 +208,6 @@ gitleaks git --baseline-path gitleaks-report.json --report-path findings.json
After running the detect command with the --baseline-path parameter, report output (findings.json) will only contain new issues.
### Verify Findings
You can verify a finding found by gitleaks using a `git log` command.
Example output:
```
Finding: aws_secret="AKIAIMNOJVGFDXXXE4OA"
RuleID: aws-access-token
Secret AKIAIMNOJVGFDXXXE4OA
Entropy: 3.65
File: checks_test.go
Line: 37
Commit: ec2fc9d6cb0954fb3b57201cf6133c48d8ca0d29
Author: Zachary Rice
Email: z@email.com
Date: 2018-01-28T17:39:00Z
Fingerprint: ec2fc9d6cb0954fb3b57201cf6133c48d8ca0d29:checks_test.go:aws-access-token:37
```
We can use the following format to verify the leak:
```
git log -L {StartLine,EndLine}:{File} {Commit}
```
So in this example it would look like:
```
git log -L 37,37:checks_test.go ec2fc9d6cb0954fb3b57201cf6133c48d8ca0d29
```
Which gives us:
```
commit ec2fc9d6cb0954fb3b57201cf6133c48d8ca0d29
Author: zricethezav <thisispublicanyways@gmail.com>
Date: Sun Jan 28 17:39:00 2018 -0500
[update] entropy check
diff --git a/checks_test.go b/checks_test.go
--- a/checks_test.go
+++ b/checks_test.go
@@ -28,0 +37,1 @@
+ "aws_secret= \"AKIAIMNOJVGFDXXXE4OA\"": true,
```
## Pre-Commit hook
You can run Gitleaks as a pre-commit hook by copying the example `pre-commit.py` script into
+5 -5
View File
@@ -91,11 +91,11 @@ func TestTranslate(t *testing.T) {
cfg: Config{},
wantError: fmt.Errorf("rule |id| is missing or empty, regex: (?i)(discord[a-z0-9_ .\\-,]{0,25})(=|>|:=|\\|\\|:|<=|=>|:).{0,5}['\\\"]([a-h0-9]{64})['\\\"]"),
},
{
cfgName: "no_regex_or_path",
cfg: Config{},
wantError: fmt.Errorf("discord-api-key: both |regex| and |path| are empty, this rule will have no effect"),
},
//{
// cfgName: "no_regex_or_path",
// cfg: Config{},
// wantError: fmt.Errorf("discord-api-key: both |regex| and |path| are empty, this rule will have no effect"),
//},
{
cfgName: "bad_entropy_group",
cfg: Config{},
+5 -3
View File
@@ -60,10 +60,12 @@ func (r Rule) Validate() error {
return fmt.Errorf("rule |id| is missing or empty" + context)
}
// TODO: uncomment this once it works with |extend|.
// See: https://github.com/gitleaks/gitleaks/issues/1507#issuecomment-2352559213
// Ensure the rule actually matches something.
if r.Regex == nil && r.Path == nil {
return fmt.Errorf("%s: both |regex| and |path| are empty, this rule will have no effect", r.RuleID)
}
//if r.Regex == nil && r.Path == nil {
// return fmt.Errorf("%s: both |regex| and |path| are empty, this rule will have no effect", r.RuleID)
//}
// Ensure |secretGroup| works.
if r.Regex != nil && r.SecretGroup > r.Regex.NumSubexp() {