Fix dotgit regex again (#507)

* fix dotgit regex again

* Revert accidentally modified files

Co-authored-by: Seb Elttam <seb@elttam.com>
This commit is contained in:
seb-elttamandSeb Elttam authored and GitHub committed 2021-01-21 15:31:21 -05:00
1 parent 8be91eea5d
commit c0a9580a65
6 files changed
+51 -2

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ import (
// used for ignoring .git directories when the --no-git flag is set // used for ignoring .git directories when the --no-git flag is set
// related issue: https://github.com/zricethezav/gitleaks/issues/486 // related issue: https://github.com/zricethezav/gitleaks/issues/486
const dotGit = `\.git/` const dotGit = `/\.git/`
// AllowList is struct containing items that if encountered will allowlist // AllowList is struct containing items that if encountered will allowlist
// a commit/line of code that would be considered a leak. // a commit/line of code that would be considered a leak.
@@ -46,5 +46,37 @@
"file": "../test_data/test_repos/test_repo_10/gitfile.txt", "file": "../test_data/test_repos/test_repo_10/gitfile.txt",
"date": "0001-01-01T00:00:00Z", "date": "0001-01-01T00:00:00Z",
"tags": "key, extensions" "tags": "key, extensions"
},
{
"line": "",
"lineNumber": 1,
"offender": "Filename or path offender: ../test_data/test_repos/test_repo_10/creds.git",
"commit": "",
"repo": "",
"repoURL": "",
"leakURL": "",
"rule": "Block dangerous filetypes",
"commitMessage": "",
"author": "",
"email": "",
"file": "../test_data/test_repos/test_repo_10/creds.git",
"date": "0001-01-01T00:00:00Z",
"tags": "key, extensions"
},
{
"line": "",
"lineNumber": 1,
"offender": "Filename or path offender: ../test_data/test_repos/test_repo_10/somedir.git/secret.key",
"commit": "",
"repo": "",
"repoURL": "",
"leakURL": "",
"rule": "Block dangerous filetypes",
"commitMessage": "",
"author": "",
"email": "",
"file": "../test_data/test_repos/test_repo_10/somedir.git/secret.key",
"date": "0001-01-01T00:00:00Z",
"tags": "key, extensions"
} }
] ]
@@ -1,4 +1,20 @@
[ [
{
"line": "",
"lineNumber": 1,
"offender": "Filename or path offender: ../test_data/test_repos/test_repo_10/somedir.git/secret.key",
"commit": "",
"repo": "",
"repoURL": "",
"leakURL": "",
"rule": "Block dangerous filetypes",
"commitMessage": "",
"author": "",
"email": "",
"file": "../test_data/test_repos/test_repo_10/somedir.git/secret.key",
"date": "0001-01-01T00:00:00Z",
"tags": "key, extensions"
},
{ {
"line": "", "line": "",
"lineNumber": 1, "lineNumber": 1,
+1 -1
View File
@@ -1,6 +1,6 @@
[[rules]] [[rules]]
description = "Block dangerous filetypes" description = "Block dangerous filetypes"
file = '''(.*?)(gitfile.txt|gitignore|pdf|doc|docx|zip|xls|tfplan|tfstate|tfvars|vault_pass|vagrant|pyc|key|cache)$''' file = '''(.*?)(creds.git|gitfile.txt|gitignore|pdf|doc|docx|zip|xls|tfplan|tfstate|tfvars|vault_pass|vagrant|pyc|key|cache)$'''
tags = ["key", "extensions"] tags = ["key", "extensions"]
[rules.allowlist] [rules.allowlist]
paths = ['''.docx'''] paths = ['''.docx''']
Whitespace-only changes.
@@ -0,0 +1 @@
hah