Procházet zdrojové kódy

Simplify tests and continue on object not found errors (#633)

* adding files

* init better tests

* add basic .git

* more tests and test data

* nogit, unstaged tests

* removing unused testdata

* adding empty testdata

* rm gitmodules

* fixing tests

* remove with config

* adding with_config

* removing old test_data, updating config tests

* removing hooks in testdata repos
Zachary Rice před 4 roky
rodič
revize
6adc045580
100 změnil soubory, kde provedl 615 přidání a 3065 odebrání
  1. 31 27
      config/config_test.go
  2. 90 0
      scan/commit_test.go
  3. 6 3
      scan/commits.go
  4. 102 0
      scan/commits_test.go
  5. 81 0
      scan/filesatcommit_test.go
  6. 1 5
      scan/nogit.go
  7. 81 0
      scan/nogit_test.go
  8. 88 0
      scan/repo_test.go
  9. 24 736
      scan/scan_test.go
  10. 111 0
      scan/unstaged_test.go
  11. 0 19
      test_data/test_additional_config.json
  12. 0 87
      test_data/test_allow_list_docx_no_git.json
  13. 0 19
      test_data/test_allow_list_file.json
  14. 0 36
      test_data/test_allow_list_file_no_git.json
  15. 0 19
      test_data/test_append_repo.json
  16. 0 16
      test_data/test_entropy.json
  17. 0 19
      test_data/test_file1_aws_leak.json
  18. 0 393
      test_data/test_local_owner_aws_leak.json
  19. 0 376
      test_data/test_local_owner_aws_leak_allowlist_repo.json
  20. 0 121
      test_data/test_local_owner_aws_leak_depth_2.json
  21. 0 53
      test_data/test_local_repo_eight.json
  22. 0 18
      test_data/test_local_repo_five_at_latest_commit.json
  23. 0 18
      test_data/test_local_repo_five_commit.json
  24. 0 34
      test_data/test_local_repo_five_files_at_commit.json
  25. 0 34
      test_data/test_local_repo_five_files_at_latest_commit.json
  26. 0 36
      test_data/test_local_repo_four_alt_config_entropy.json
  27. 0 36
      test_data/test_local_repo_four_leaks_commit_timerange.json
  28. 0 18
      test_data/test_local_repo_nine_aws_leak.json
  29. 0 19
      test_data/test_local_repo_one_aws_leak.json
  30. 0 18
      test_data/test_local_repo_one_aws_leak_and_file_leak.json
  31. 0 18
      test_data/test_local_repo_one_aws_leak_commit.json
  32. 0 18
      test_data/test_local_repo_seven_aws_leak_uncommitted.json
  33. 0 47
      test_data/test_local_repo_six.json
  34. 0 34
      test_data/test_local_repo_six_filename.json
  35. 0 18
      test_data/test_local_repo_six_filepath.json
  36. 0 18
      test_data/test_local_repo_six_filepath_filename.json
  37. 0 18
      test_data/test_local_repo_six_leaks_since_date.json
  38. 0 18
      test_data/test_local_repo_six_leaks_until_date.json
  39. 0 18
      test_data/test_local_repo_six_path_globally_allowlisted.json
  40. 0 70
      test_data/test_local_repo_three_leaks.json
  41. 0 53
      test_data/test_local_repo_three_leaks_with_report_groups.json
  42. 0 19
      test_data/test_local_repo_two_allowlist_commits.json
  43. 0 53
      test_data/test_local_repo_two_leaks.json
  44. 0 36
      test_data/test_local_repo_two_leaks_commit_from.json
  45. 0 36
      test_data/test_local_repo_two_leaks_commit_range.json
  46. 0 19
      test_data/test_local_repo_two_leaks_commit_to.json
  47. 0 19
      test_data/test_local_repo_two_leaks_commit_to_from.json
  48. 0 98
      test_data/test_local_repo_two_leaks_deletion.json
  49. 0 36
      test_data/test_local_repo_two_leaks_file_commit_range.json
  50. 0 155
      test_data/test_only_files_no_git.json
  51. 0 5
      test_data/test_options/test_local_repo_commits.txt
  52. 0 1
      test_data/test_regex_allowlist.json
  53. 0 18
      test_data/test_regex_entropy.json
  54. 0 1
      test_data/test_repos/no_repo/tmp.tmp
  55. 0 9
      test_data/test_repos/test_dir_1/server.test.py
  56. 0 9
      test_data/test_repos/test_dir_1/server.test2.py
  57. 0 1
      test_data/test_repos/test_repo_1/dotGit/COMMIT_EDITMSG
  58. 0 7
      test_data/test_repos/test_repo_1/dotGit/config
  59. binární
      test_data/test_repos/test_repo_1/dotGit/index
  60. 0 6
      test_data/test_repos/test_repo_1/dotGit/info/exclude
  61. 0 2
      test_data/test_repos/test_repo_1/dotGit/logs/HEAD
  62. 0 2
      test_data/test_repos/test_repo_1/dotGit/logs/refs/heads/master
  63. binární
      test_data/test_repos/test_repo_1/dotGit/objects/10/fa14c5ab0134436e2ae435138bf921eb477c60
  64. binární
      test_data/test_repos/test_repo_1/dotGit/objects/3a/76f3781306faf5612017bf18a4b4bdb9f927bf
  65. binární
      test_data/test_repos/test_repo_1/dotGit/objects/41/42082bcb939bbc17985a69ba748491ac6b62a5
  66. binární
      test_data/test_repos/test_repo_1/dotGit/objects/49/8b267a8c7812490d6479839c5577eaaec79d62
  67. binární
      test_data/test_repos/test_repo_1/dotGit/objects/60/c9e47f150a6b713e247e6105b77f1b961f844f
  68. binární
      test_data/test_repos/test_repo_1/dotGit/objects/61/87dbf4390fc6e28445dd3d988aefb9d1111988
  69. binární
      test_data/test_repos/test_repo_1/dotGit/objects/65/57c92612d3b35979bd426d429255b3bf9fab74
  70. binární
      test_data/test_repos/test_repo_1/dotGit/objects/6a/756416384c210ada2631f17862f5c01fffa478
  71. binární
      test_data/test_repos/test_repo_1/dotGit/objects/6c/9406b7d9320db083eca69b3f8bee9a6c7b50d4
  72. binární
      test_data/test_repos/test_repo_1/dotGit/objects/6c/bef5c370d8c3486ca85423dd70440c5e0a2aa2
  73. binární
      test_data/test_repos/test_repo_1/dotGit/objects/80/8b12c5ca4b142367932e7045d555a639fc148c
  74. binární
      test_data/test_repos/test_repo_1/dotGit/objects/80/ba94135cc378364af9d3cb2450df48e51faf2c
  75. 0 3
      test_data/test_repos/test_repo_1/dotGit/objects/9e/523225b31add24e72f2feb0b2645cfb36542dc
  76. 0 3
      test_data/test_repos/test_repo_1/dotGit/objects/a1/fd29ec14823d8bc4a8d1a2cfe35451580f5118
  77. binární
      test_data/test_repos/test_repo_1/dotGit/objects/a4/fa2187727281aea78d7c3aaebdb4b924fc4e4d
  78. 0 1
      test_data/test_repos/test_repo_1/dotGit/objects/a5/196d1be8fb59edf8062bef36d3a602e0812139
  79. binární
      test_data/test_repos/test_repo_1/dotGit/objects/a5/d7b84a673458d14d9aab082183a1968c2c7492
  80. binární
      test_data/test_repos/test_repo_1/dotGit/objects/b5/8d1184a9d43a39c0d95f32453efc78581877d6
  81. binární
      test_data/test_repos/test_repo_1/dotGit/objects/c9/8e6c52cbd1f50de572ff12a3441271fccff705
  82. binární
      test_data/test_repos/test_repo_1/dotGit/objects/cb/089cd89a7d7686d284d8761201649346b5aa1c
  83. 0 2
      test_data/test_repos/test_repo_1/dotGit/objects/cb/19a50e8cdeb7011eccdb13f3b739f00d775bab
  84. binární
      test_data/test_repos/test_repo_1/dotGit/objects/d2/74003914c707212cbe84e3e466a00013ccb639
  85. binární
      test_data/test_repos/test_repo_1/dotGit/objects/e6/73bb3980f3c286291809e05f80873852bc3e9c
  86. binární
      test_data/test_repos/test_repo_1/dotGit/objects/e9/e5396f7e52aa48de485b4836ebb041cc7f7c46
  87. 0 2
      test_data/test_repos/test_repo_1/dotGit/objects/ec/17ec1939b7c3e86b7cb6c0c4de6b0818a7e75e
  88. binární
      test_data/test_repos/test_repo_1/dotGit/objects/fe/f3190e94723e78847ab9f0daaa15add4ffd4ef
  89. 0 1
      test_data/test_repos/test_repo_1/dotGit/refs/heads/master
  90. 0 9
      test_data/test_repos/test_repo_1/server.test.py
  91. 0 1
      test_data/test_repos/test_repo_10/.gitignore
  92. 0 11
      test_data/test_repos/test_repo_10/.gitleaks.toml
  93. 0 1
      test_data/test_repos/test_repo_10/README.md
  94. 0 1
      test_data/test_repos/test_repo_10/bad.zip
  95. 0 0
      test_data/test_repos/test_repo_10/creds.git
  96. 0 1
      test_data/test_repos/test_repo_10/dotGit/HEAD
  97. 0 0
      test_data/test_repos/test_repo_10/dotGit/bad.zip
  98. binární
      test_data/test_repos/test_repo_10/dotGit/index
  99. 0 6
      test_data/test_repos/test_repo_10/dotGit/info/exclude
  100. 0 1
      test_data/test_repos/test_repo_10/dotGit/logs/HEAD

+ 31 - 27
config/config_test.go

@@ -1,15 +1,19 @@
-package config
+package config_test
 
 import (
 	"fmt"
 	"io/ioutil"
 	"os"
+	"path/filepath"
 	"regexp"
 	"testing"
 
+	"github.com/zricethezav/gitleaks/v7/config"
 	"github.com/zricethezav/gitleaks/v7/options"
 )
 
+const configPath = "../testdata/configs/"
+
 func TestParse(t *testing.T) {
 	tests := []struct {
 		description   string
@@ -17,7 +21,7 @@ func TestParse(t *testing.T) {
 		wantErr       error
 		wantFileRegex *regexp.Regexp
 		wantMessages  *regexp.Regexp
-		wantAllowlist AllowList
+		wantAllowlist config.AllowList
 	}{
 		{
 			description: "default config",
@@ -26,102 +30,102 @@ func TestParse(t *testing.T) {
 		{
 			description: "test successful load",
 			opts: options.Options{
-				ConfigPath: "../test_data/test_configs/aws_key.toml",
+				ConfigPath: filepath.Join(configPath, "aws_key.toml"),
 			},
 		},
 		{
 			description: "test bad toml",
 			opts: options.Options{
-				ConfigPath: "../test_data/test_configs/bad_aws_key.toml",
+				ConfigPath: filepath.Join(configPath, "bad_aws_key.toml"),
 			},
 			wantErr: fmt.Errorf("Near line 7 (last key parsed 'rules.description'): expected value but found \"AWS\" instead"),
 		},
 		{
 			description: "test bad regex",
 			opts: options.Options{
-				ConfigPath: "../test_data/test_configs/bad_regex_aws_key.toml",
+				ConfigPath: filepath.Join(configPath, "bad_regex_aws_key.toml"),
 			},
 			wantErr: fmt.Errorf("problem loading config: error parsing regexp: invalid nested repetition operator: `???`"),
 		},
 		{
 			description: "test bad global allowlist file regex",
 			opts: options.Options{
-				ConfigPath: "../test_data/test_configs/bad_aws_key_global_allowlist_file.toml",
+				ConfigPath: filepath.Join(configPath, "bad_aws_key_global_allowlist_file.toml"),
 			},
 			wantErr: fmt.Errorf("problem loading config: error parsing regexp: missing argument to repetition operator: `??`"),
 		},
 		{
 			description: "test bad global file regex",
 			opts: options.Options{
-				ConfigPath: "../test_data/test_configs/bad_aws_key_file_regex.toml",
+				ConfigPath: filepath.Join(configPath, "bad_aws_key_file_regex.toml"),
 			},
 			wantErr: fmt.Errorf("problem loading config: error parsing regexp: missing argument to repetition operator: `??`"),
 		},
 		{
 			description: "test successful load big ol thing",
 			opts: options.Options{
-				ConfigPath: "../test_data/test_configs/large.toml",
+				ConfigPath: filepath.Join(configPath, "large.toml"),
 			},
 		},
 		{
 			description: "test load entropy",
 			opts: options.Options{
-				ConfigPath: "../test_data/test_configs/entropy.toml",
+				ConfigPath: filepath.Join(configPath, "entropy.toml"),
 			},
 		},
 		{
 			description: "test entropy bad range",
 			opts: options.Options{
-				ConfigPath: "../test_data/test_configs/bad_entropy_1.toml",
+				ConfigPath: filepath.Join(configPath, "bad_entropy_1.toml"),
 			},
 			wantErr: fmt.Errorf("problem loading config: entropy Min value cannot be higher than Max value"),
 		},
 		{
 			description: "test entropy value max",
 			opts: options.Options{
-				ConfigPath: "../test_data/test_configs/bad_entropy_2.toml",
+				ConfigPath: filepath.Join(configPath, "bad_entropy_2.toml"),
 			},
 			wantErr: fmt.Errorf("strconv.ParseFloat: parsing \"x\": invalid syntax"),
 		},
 		{
 			description: "test entropy value min",
 			opts: options.Options{
-				ConfigPath: "../test_data/test_configs/bad_entropy_3.toml",
+				ConfigPath: filepath.Join(configPath, "bad_entropy_3.toml"),
 			},
 			wantErr: fmt.Errorf("strconv.ParseFloat: parsing \"x\": invalid syntax"),
 		},
 		{
 			description: "test entropy value group",
 			opts: options.Options{
-				ConfigPath: "../test_data/test_configs/bad_entropy_4.toml",
+				ConfigPath: filepath.Join(configPath, "bad_entropy_4.toml"),
 			},
 			wantErr: fmt.Errorf("strconv.ParseInt: parsing \"x\": invalid syntax"),
 		},
 		{
 			description: "test entropy value group",
 			opts: options.Options{
-				ConfigPath: "../test_data/test_configs/bad_entropy_5.toml",
+				ConfigPath: filepath.Join(configPath, "bad_entropy_5.toml"),
 			},
 			wantErr: fmt.Errorf("problem loading config: group cannot be lower than 0"),
 		},
 		{
 			description: "test entropy value group",
 			opts: options.Options{
-				ConfigPath: "../test_data/test_configs/bad_entropy_6.toml",
+				ConfigPath: filepath.Join(configPath, "bad_entropy_6.toml"),
 			},
 			wantErr: fmt.Errorf("problem loading config: group cannot be higher than number of groups in regexp"),
 		},
 		{
 			description: "test entropy range limits",
 			opts: options.Options{
-				ConfigPath: "../test_data/test_configs/bad_entropy_7.toml",
+				ConfigPath: filepath.Join(configPath, "bad_entropy_7.toml"),
 			},
 			wantErr: fmt.Errorf("problem loading config: invalid entropy ranges, must be within 0.0-8.0"),
 		},
 	}
 
 	for _, test := range tests {
-		_, err := NewConfig(test.opts)
+		_, err := config.NewConfig(test.opts)
 		if err != nil {
 			if test.wantErr == nil {
 				t.Error(test.description, err)
@@ -151,7 +155,7 @@ func TestParseFields(t *testing.T) {
 		t.Fatal(err)
 	}
 
-	config, err := NewConfig(options.Options{ConfigPath: configPath})
+	config, err := config.NewConfig(options.Options{ConfigPath: configPath})
 	if err != nil {
 		t.Fatalf("Couldn't parse config: %v", err)
 	}
@@ -185,7 +189,7 @@ func TestParseFields(t *testing.T) {
 	}
 }
 
-func findRuleByDescription(rules []Rule, description string) (*Rule, error) {
+func findRuleByDescription(rules []config.Rule, description string) (*config.Rule, error) {
 	for _, rule := range rules {
 		if rule.Description == description {
 			return &rule, nil
@@ -216,7 +220,7 @@ func TestAppendingConfiguration(t *testing.T) {
 	testRegexA, _ := regexp.Compile("a")
 	testRegexB, _ := regexp.Compile("b")
 
-	allowListA := AllowList{
+	allowListA := config.AllowList{
 		Description: "Test Description",
 		Commits:     []string{"a"},
 		Files:       []*regexp.Regexp{testRegexA},
@@ -225,7 +229,7 @@ func TestAppendingConfiguration(t *testing.T) {
 		Repos:       []*regexp.Regexp{testRegexA},
 	}
 
-	allowListB := AllowList{
+	allowListB := config.AllowList{
 		Description: "Test Description",
 		Commits:     []string{"b"},
 		Files:       []*regexp.Regexp{testRegexB},
@@ -234,18 +238,18 @@ func TestAppendingConfiguration(t *testing.T) {
 		Repos:       []*regexp.Regexp{testRegexB},
 	}
 
-	ruleA := Rule{Description: "a"}
-	ruleB := Rule{Description: "b"}
+	ruleA := config.Rule{Description: "a"}
+	ruleB := config.Rule{Description: "b"}
 
-	rulesA := []Rule{ruleA}
-	rulesB := []Rule{ruleB}
+	rulesA := []config.Rule{ruleA}
+	rulesB := []config.Rule{ruleB}
 
-	cfgA := Config{
+	cfgA := config.Config{
 		Rules:     rulesA,
 		Allowlist: allowListA,
 	}
 
-	cfgB := Config{
+	cfgB := config.Config{
 		Rules:     rulesB,
 		Allowlist: allowListB,
 	}

+ 90 - 0
scan/commit_test.go

@@ -0,0 +1,90 @@
+package scan_test
+
+import (
+	"path/filepath"
+	"testing"
+
+	"github.com/zricethezav/gitleaks/v7/config"
+	"github.com/zricethezav/gitleaks/v7/options"
+	"github.com/zricethezav/gitleaks/v7/scan"
+)
+
+func TestCommitScan(t *testing.T) {
+	err := moveDotGit("dotGit", ".git")
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer moveDotGit(".git", "dotGit")
+	tests := []struct {
+		description string
+		opts        options.Options
+		wantPath    string
+		empty       bool
+	}{
+		{
+			description: "empty repo",
+			opts: options.Options{
+				Path:   filepath.Join(repoBasePath, "empty"),
+				Report: filepath.Join(expectPath, "empty", "empty_report.json.got"),
+			},
+			empty: true,
+		},
+		{
+			description: "basic repo with default config at specific commit",
+			opts: options.Options{
+				Path:         filepath.Join(repoBasePath, "basic"),
+				Report:       filepath.Join(expectPath, "basic", "results_208ae46.json.got"),
+				ReportFormat: "json",
+				Commit:       "208ae4669ade2563fcaf9f12922fa2c0a5b37c63",
+			},
+			wantPath: filepath.Join(expectPath, "basic", "results_208ae46.json"),
+		},
+		{
+			description: "basic repo with custom config at specific commit",
+			opts: options.Options{
+				Path:           filepath.Join(repoBasePath, "with_config"),
+				Report:         filepath.Join(expectPath, "with_config", "results_e7c0aff3.json.got"),
+				ReportFormat:   "json",
+				RepoConfigPath: "gitleaks.toml",
+				Commit:         "e7c0aff3e8a60b50a85432fdf933f8beff013743",
+			},
+			wantPath: filepath.Join(expectPath, "with_config", "results_e7c0aff3.json"),
+		},
+	}
+
+	for _, test := range tests {
+		cfg, err := config.NewConfig(test.opts)
+		if err != nil {
+			t.Error(err)
+		}
+
+		scanner, err := scan.NewScanner(test.opts, cfg)
+		if err != nil {
+			t.Error(test.description, err)
+		}
+
+		scannerReport, err := scanner.Scan()
+		if err != nil {
+			t.Fatal(test.description, err)
+		}
+
+		err = scan.WriteReport(scannerReport, test.opts, cfg)
+		if err != nil {
+			t.Error(test.description, err)
+		}
+
+		if test.empty {
+			if len(scannerReport.Leaks) != 0 {
+				t.Errorf("%s wanted no leaks but got some instead: %+v", test.description, scannerReport.Leaks)
+			}
+			continue
+		}
+
+		if test.wantPath != "" {
+			err := fileCheck(test.wantPath, test.opts.Report)
+			if err != nil {
+				t.Error(test.description, err)
+			}
+		}
+	}
+}

+ 6 - 3
scan/commits.go

@@ -2,6 +2,8 @@ package scan
 
 import (
 	"github.com/go-git/go-git/v5"
+	log "github.com/sirupsen/logrus"
+
 	"github.com/zricethezav/gitleaks/v7/config"
 	"github.com/zricethezav/gitleaks/v7/options"
 )
@@ -30,10 +32,11 @@ func NewCommitsScanner(opts options.Options, cfg config.Config, repo *git.Reposi
 // Scan kicks off a CommitsScanner Scan
 func (css *CommitsScanner) Scan() (Report, error) {
 	var scannerReport Report
-	for _, c := range css.commits {
-		c, err := obtainCommit(css.repo, c)
+	for _, commitHash := range css.commits {
+		c, err := obtainCommit(css.repo, commitHash)
 		if err != nil {
-			return scannerReport, nil
+			log.Errorf("skipping %s, err: %v", commitHash, err)
+			continue
 		}
 		cs := NewCommitScanner(css.opts, css.cfg, css.repo, c)
 		commitReport, err := cs.Scan()

+ 102 - 0
scan/commits_test.go

@@ -0,0 +1,102 @@
+package scan_test
+
+import (
+	"path/filepath"
+	"testing"
+
+	"github.com/zricethezav/gitleaks/v7/config"
+	"github.com/zricethezav/gitleaks/v7/options"
+	"github.com/zricethezav/gitleaks/v7/scan"
+)
+
+func TestCommitsScan(t *testing.T) {
+	err := moveDotGit("dotGit", ".git")
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer moveDotGit(".git", "dotGit")
+	tests := []struct {
+		description string
+		opts        options.Options
+		wantPath    string
+		empty       bool
+	}{
+		{
+			description: "basic repo with default config ranging first and third commit",
+			opts: options.Options{
+				Path:         filepath.Join(repoBasePath, "basic"),
+				Report:       filepath.Join(expectPath, "basic", "results_ae8db4a2_208ae46.json.got"),
+				ReportFormat: "json",
+				Commits:      "ae8db4a2306798fcb3a5b9cbe8c486027fc1931f,208ae4669ade2563fcaf9f12922fa2c0a5b37c63",
+			},
+			wantPath: filepath.Join(expectPath, "basic", "results_ae8db4a2_208ae46.json"),
+		},
+		{
+			description: "repo with config first two commits",
+			opts: options.Options{
+				Path:           filepath.Join(repoBasePath, "with_config"),
+				Report:         filepath.Join(expectPath, "with_config", "results_ae8db4a_e7c0aff.json.got"),
+				ReportFormat:   "json",
+				RepoConfigPath: "gitleaks.toml",
+				Commits:        "ae8db4a2306798fcb3a5b9cbe8c486027fc1931f,e7c0aff3e8a60b50a85432fdf933f8beff013743",
+			},
+			wantPath: filepath.Join(expectPath, "with_config", "results_ae8db4a_e7c0aff.json"),
+		},
+		{
+			description: "basic repo with depth=1",
+			opts: options.Options{
+				Path:         filepath.Join(repoBasePath, "basic"),
+				Report:       filepath.Join(expectPath, "basic", "results_depth_1.json.got"),
+				ReportFormat: "json",
+				Depth:        1,
+			},
+			wantPath: filepath.Join(expectPath, "basic", "results_depth_1.json"),
+		},
+		{
+			description: "basic repo with default config ranging first and third commit with a non-existent commit in middle",
+			opts: options.Options{
+				Path:         filepath.Join(repoBasePath, "basic"),
+				Report:       filepath.Join(expectPath, "basic", "results_ae8db4a2_208ae46.json.got"),
+				ReportFormat: "json",
+				Commits:      "ae8db4a2306798fcb3a5b9cbe8c486027fc1931f,nocommithere,208ae4669ade2563fcaf9f12922fa2c0a5b37c63",
+			},
+			wantPath: filepath.Join(expectPath, "basic", "results_ae8db4a2_208ae46.json"),
+		},
+	}
+
+	for _, test := range tests {
+		cfg, err := config.NewConfig(test.opts)
+		if err != nil {
+			t.Error(err)
+		}
+
+		scanner, err := scan.NewScanner(test.opts, cfg)
+		if err != nil {
+			t.Error(test.description, err)
+		}
+
+		scannerReport, err := scanner.Scan()
+		if err != nil {
+			t.Fatal(test.description, err)
+		}
+
+		err = scan.WriteReport(scannerReport, test.opts, cfg)
+		if err != nil {
+			t.Error(test.description, err)
+		}
+
+		if test.empty {
+			if len(scannerReport.Leaks) != 0 {
+				t.Errorf("%s wanted no leaks but got some instead: %+v", test.description, scannerReport.Leaks)
+			}
+			continue
+		}
+
+		if test.wantPath != "" {
+			err := fileCheck(test.wantPath, test.opts.Report)
+			if err != nil {
+				t.Error(test.description, err)
+			}
+		}
+	}
+}

+ 81 - 0
scan/filesatcommit_test.go

@@ -0,0 +1,81 @@
+package scan_test
+
+import (
+	"path/filepath"
+	"testing"
+
+	"github.com/zricethezav/gitleaks/v7/config"
+	"github.com/zricethezav/gitleaks/v7/options"
+	"github.com/zricethezav/gitleaks/v7/scan"
+)
+
+func TestFilesAtCommitScan(t *testing.T) {
+	err := moveDotGit("dotGit", ".git")
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer moveDotGit(".git", "dotGit")
+	tests := []struct {
+		description string
+		opts        options.Options
+		wantPath    string
+		empty       bool
+	}{
+		{
+			description: "basic repo with no secrets present in files at first commit",
+			opts: options.Options{
+				Path:          filepath.Join(repoBasePath, "basic"),
+				Report:        filepath.Join(expectPath, "basic", "results_files_at_ae8db4a2.json.got"),
+				ReportFormat:  "json",
+				FilesAtCommit: "ae8db4a2306798fcb3a5b9cbe8c486027fc1931f",
+			},
+			empty: true,
+		},
+		{
+			description: "basic repo with secrets present in files at third commit",
+			opts: options.Options{
+				Path:          filepath.Join(repoBasePath, "basic"),
+				Report:        filepath.Join(expectPath, "basic", "results_files_at_208ae46.json.got"),
+				ReportFormat:  "json",
+				FilesAtCommit: "208ae4669ade2563fcaf9f12922fa2c0a5b37c63",
+			},
+			wantPath: filepath.Join(expectPath, "basic", "results_files_at_208ae46.json"),
+		},
+	}
+
+	for _, test := range tests {
+		cfg, err := config.NewConfig(test.opts)
+		if err != nil {
+			t.Error(err)
+		}
+
+		scanner, err := scan.NewScanner(test.opts, cfg)
+		if err != nil {
+			t.Error(test.description, err)
+		}
+
+		scannerReport, err := scanner.Scan()
+		if err != nil {
+			t.Fatal(test.description, err)
+		}
+
+		err = scan.WriteReport(scannerReport, test.opts, cfg)
+		if err != nil {
+			t.Error(test.description, err)
+		}
+
+		if test.empty {
+			if len(scannerReport.Leaks) != 0 {
+				t.Errorf("%s wanted no leaks but got some instead: %+v", test.description, scannerReport.Leaks)
+			}
+			continue
+		}
+
+		if test.wantPath != "" {
+			err := fileCheck(test.wantPath, test.opts.Report)
+			if err != nil {
+				t.Error(test.description, err)
+			}
+		}
+	}
+}

+ 1 - 5
scan/nogit.go

@@ -9,11 +9,10 @@ import (
 	"sync"
 
 	log "github.com/sirupsen/logrus"
+	"golang.org/x/sync/errgroup"
 
 	"github.com/zricethezav/gitleaks/v7/config"
 	"github.com/zricethezav/gitleaks/v7/options"
-
-	"golang.org/x/sync/errgroup"
 )
 
 // NoGitScanner is a scanner that absolutely despises git
@@ -47,11 +46,8 @@ func NewNoGitScanner(opts options.Options, cfg config.Config) *NoGitScanner {
 // Scan kicks off a NoGitScanner Scan
 func (ngs *NoGitScanner) Scan() (Report, error) {
 	var scannerReport Report
-
 	g, _ := errgroup.WithContext(context.Background())
-
 	paths := make(chan string)
-
 	g.Go(func() error {
 		defer close(paths)
 		return filepath.Walk(ngs.opts.Path,

+ 81 - 0
scan/nogit_test.go

@@ -0,0 +1,81 @@
+package scan_test
+
+import (
+	"path/filepath"
+	"testing"
+
+	"github.com/zricethezav/gitleaks/v7/config"
+	"github.com/zricethezav/gitleaks/v7/options"
+	"github.com/zricethezav/gitleaks/v7/scan"
+)
+
+func TestNoGit(t *testing.T) {
+	err := moveDotGit("dotGit", ".git")
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer moveDotGit(".git", "dotGit")
+	tests := []struct {
+		description string
+		opts        options.Options
+		wantPath    string
+		empty       bool
+	}{
+		{
+			description: "[nogit] basic repo",
+			opts: options.Options{
+				Path:         filepath.Join(repoBasePath, "basic"),
+				Report:       filepath.Join(expectPath, "basic", "results_no_git.json.got"),
+				ReportFormat: "json",
+				NoGit:        true,
+			},
+			wantPath: filepath.Join(expectPath, "basic", "results_no_git.json"),
+		},
+		{
+			description: "[nogit] empty",
+			opts: options.Options{
+				Path:         filepath.Join(repoBasePath, "empty"),
+				Report:       filepath.Join(expectPath, "empty", "results_no_git_empty.json.got"),
+				ReportFormat: "json",
+				NoGit:        true,
+			},
+			empty: true,
+		},
+	}
+
+	for _, test := range tests {
+		cfg, err := config.NewConfig(test.opts)
+		if err != nil {
+			t.Error(err)
+		}
+
+		scanner, err := scan.NewScanner(test.opts, cfg)
+		if err != nil {
+			t.Error(test.description, err)
+		}
+
+		scannerReport, err := scanner.Scan()
+		if err != nil {
+			t.Fatal(test.description, err)
+		}
+
+		err = scan.WriteReport(scannerReport, test.opts, cfg)
+		if err != nil {
+			t.Error(test.description, err)
+		}
+
+		if test.empty {
+			if len(scannerReport.Leaks) != 0 {
+				t.Errorf("%s wanted no leaks but got some instead: %+v", test.description, scannerReport.Leaks)
+			}
+			continue
+		}
+
+		if test.wantPath != "" {
+			err := fileCheck(test.wantPath, test.opts.Report)
+			if err != nil {
+				t.Error(test.description, err)
+			}
+		}
+	}
+}

+ 88 - 0
scan/repo_test.go

@@ -0,0 +1,88 @@
+package scan_test
+
+import (
+	"path/filepath"
+	"testing"
+
+	"github.com/zricethezav/gitleaks/v7/config"
+	"github.com/zricethezav/gitleaks/v7/options"
+	"github.com/zricethezav/gitleaks/v7/scan"
+)
+
+func TestRepoScan(t *testing.T) {
+	err := moveDotGit("dotGit", ".git")
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer moveDotGit(".git", "dotGit")
+	tests := []struct {
+		description string
+		opts        options.Options
+		wantPath    string
+		empty       bool
+	}{
+		{
+			description: "empty repo",
+			opts: options.Options{
+				Path:   filepath.Join(repoBasePath, "empty"),
+				Report: filepath.Join(expectPath, "empty", "empty_report.json.got"),
+			},
+			empty: true,
+		},
+		{
+			description: "basic repo with default config",
+			opts: options.Options{
+				Path:         filepath.Join(repoBasePath, "basic"),
+				Report:       filepath.Join(expectPath, "basic", "results.json.got"),
+				ReportFormat: "json",
+			},
+			wantPath: filepath.Join(expectPath, "basic", "results.json"),
+		},
+		{
+			description: "with_config repo",
+			opts: options.Options{
+				Path:           filepath.Join(repoBasePath, "with_config"),
+				Report:         filepath.Join(expectPath, "with_config", "results.json.got"),
+				RepoConfigPath: "gitleaks.toml",
+				ReportFormat:   "json",
+			},
+			wantPath: filepath.Join(expectPath, "with_config", "results.json"),
+		},
+	}
+
+	for _, test := range tests {
+		cfg, err := config.NewConfig(test.opts)
+		if err != nil {
+			t.Error(err)
+		}
+
+		scanner, err := scan.NewScanner(test.opts, cfg)
+		if err != nil {
+			t.Error(test.description, err)
+		}
+
+		scannerReport, err := scanner.Scan()
+		if err != nil {
+			t.Fatal(test.description, err)
+		}
+
+		err = scan.WriteReport(scannerReport, test.opts, cfg)
+		if err != nil {
+			t.Error(test.description, err)
+		}
+
+		if test.empty {
+			if len(scannerReport.Leaks) != 0 {
+				t.Errorf("%s wanted no leaks but got some instead: %+v", test.description, scannerReport.Leaks)
+			}
+			continue
+		}
+
+		if test.wantPath != "" {
+			err := fileCheck(test.wantPath, test.opts.Report)
+			if err != nil {
+				t.Error(test.description, err)
+			}
+		}
+	}
+}

+ 24 - 736
scan/scan_test.go

@@ -1,732 +1,52 @@
-package scan
+package scan_test
 
 import (
 	"encoding/json"
 	"fmt"
 	"io/ioutil"
 	"os"
-	"runtime"
-	"testing"
 
-	"github.com/zricethezav/gitleaks/v7/config"
-	"github.com/zricethezav/gitleaks/v7/options"
+	"github.com/zricethezav/gitleaks/v7/scan"
 )
 
-const testRepoBase = "../test_data/test_repos/"
+const repoBasePath = "../testdata/repos/"
+const expectPath = "../testdata/expect/"
 
-func TestScan(t *testing.T) {
-	err := moveDotGit("dotGit", ".git")
+func moveDotGit(from, to string) error {
+	repoDirs, err := ioutil.ReadDir("../testdata/repos")
 	if err != nil {
-		t.Fatal(err)
-	}
-	defer moveDotGit(".git", "dotGit")
-	tests := []struct {
-		description string
-		opts        options.Options
-		wantPath    string
-		wantErr     error
-		wantScanErr error
-		emptyRepo   bool
-		wantEmpty   bool
-	}{
-		{
-			description: "test local repo one aws leak",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_1",
-				Report:       "../test_data/test_local_repo_one_aws_leak.json.got",
-				ReportFormat: "json",
-				Threads:      runtime.GOMAXPROCS(0),
-			},
-			wantPath: "../test_data/test_local_repo_one_aws_leak.json",
-		},
-		{
-			description: "test local repo one aws leak threaded",
-			opts: options.Options{
-				Threads:      runtime.GOMAXPROCS(0),
-				Path:         "../test_data/test_repos/test_repo_1",
-				Report:       "../test_data/test_local_repo_one_aws_leak.json.got",
-				ReportFormat: "json",
-			},
-			wantPath: "../test_data/test_local_repo_one_aws_leak.json",
-		},
-		{
-			description: "test non existent repo",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/no_repo_here",
-				ReportFormat: "json",
-			},
-			wantErr:   fmt.Errorf("stat ../test_data/test_repos/no_repo_here: no such file or directory"),
-			emptyRepo: true,
-		},
-		{
-			description: "test local repo one aws leak allowlisted",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_1",
-				ReportFormat: "json",
-				ConfigPath:   "../test_data/test_configs/aws_key_allowlist_python_files.toml",
-			},
-			wantEmpty: true,
-		},
-		{
-			description: "test local repo two leaks",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_2",
-				Report:       "../test_data/test_local_repo_two_leaks.json.got",
-				ReportFormat: "json",
-			},
-			wantPath: "../test_data/test_local_repo_two_leaks.json",
-		},
-		{
-			description: "test local repo two leaks from Commit",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_2",
-				Report:       "../test_data/test_local_repo_two_leaks_commit_from.json.got",
-				ReportFormat: "json",
-				CommitFrom:   "996865bb912f3bc45898a370a13aadb315014b55",
-			},
-			wantPath: "../test_data/test_local_repo_two_leaks_commit_from.json",
-		},
-		{
-			description: "test local repo two leaks to Commit",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_2",
-				Report:       "../test_data/test_local_repo_two_leaks_commit_to.json.got",
-				ReportFormat: "json",
-				CommitTo:     "996865bb912f3bc45898a370a13aadb315014b55",
-			},
-			wantPath: "../test_data/test_local_repo_two_leaks_commit_to.json",
-		},
-		{
-			description: "test local repo two leaks to from Commit",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_2",
-				Report:       "../test_data/test_local_repo_two_leaks_commit_to_from.json.got",
-				ReportFormat: "json",
-				CommitFrom:   "d8ac0b73aeeb45843319cdc5ce506516eb49bf7a",
-				CommitTo:     "51f6dcf6b89b93f4075ba92c400b075631a6cc93",
-			},
-			wantPath: "../test_data/test_local_repo_two_leaks_commit_to_from.json",
-		},
-		{
-			description: "test local repo two leaks list Commits",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_2",
-				Report:       "../test_data/test_local_repo_two_leaks_commit_range.json.got",
-				ReportFormat: "json",
-				Commits:      "d8ac0b73aeeb45843319cdc5ce506516eb49bf7a,996865bb912f3bc45898a370a13aadb315014b55,17471a5fda722a9e423f1a0d3f0d267ea009d41c,51f6dcf6b89b93f4075ba92c400b075631a6cc93,b10b3e2cb320a8c211fda94c4567299d37de7776",
-			},
-			wantPath: "../test_data/test_local_repo_two_leaks_commit_range.json",
-		},
-		{
-			description: "test local repo two leaks file list commits",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_2",
-				Report:       "../test_data/test_local_repo_two_leaks_file_commit_range.json.got",
-				ReportFormat: "json",
-				CommitsFile:  "../test_data/test_options/test_local_repo_commits.txt",
-				Threads:      runtime.GOMAXPROCS(0),
-			},
-			wantPath: "../test_data/test_local_repo_two_leaks_file_commit_range.json",
-		},
-		{
-			description: "test local repo two leaks globally allowlisted",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_2",
-				ConfigPath:   "../test_data/test_configs/aws_key_global_allowlist_file.toml",
-				ReportFormat: "json",
-			},
-			wantEmpty: true,
-		},
-		{
-			description: "test local repo two leaks allowlisted",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_2",
-				ConfigPath:   "../test_data/test_configs/aws_key_allowlist_files.toml",
-				ReportFormat: "json",
-			},
-			wantEmpty: true,
-		},
-		{
-			description: "test local repo three leaks dev branch with reportGroup set",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_3",
-				Report:       "../test_data/test_local_repo_three_leaks_with_report_groups.json.got",
-				ConfigPath:   "../test_data/test_configs/aws_key_with_report_groups.toml",
-				Branch:       "dev",
-				ReportFormat: "json",
-			},
-			wantPath: "../test_data/test_local_repo_three_leaks_with_report_groups.json",
-		},
-		{
-			description: "test local repo three leaks dev branch",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_3",
-				Report:       "../test_data/test_local_repo_three_leaks.json.got",
-				ConfigPath:   "../test_data/test_configs/aws_key.toml",
-				Branch:       "dev",
-				ReportFormat: "json",
-			},
-			wantPath: "../test_data/test_local_repo_three_leaks.json",
-		},
-		{
-			description: "test local repo branch does not exist",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_3",
-				Branch:       "nobranch",
-				ReportFormat: "json",
-			},
-			wantScanErr: fmt.Errorf("could not find branch nobranch"),
-		},
-		{
-			description: "test local repo one aws leak single Commit",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_1",
-				Report:       "../test_data/test_local_repo_one_aws_leak_commit.json.got",
-				Commit:       "6557c92612d3b35979bd426d429255b3bf9fab74",
-				ReportFormat: "json",
-			},
-			wantPath: "../test_data/test_local_repo_one_aws_leak_commit.json",
-		},
-		{
-			description: "test local repo one aws leak AND leak on python files",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_1",
-				Report:       "../test_data/test_local_repo_one_aws_leak_and_file_leak.json.got",
-				ConfigPath:   "../test_data/test_configs/aws_key_file_regex.toml",
-				ReportFormat: "json",
-			},
-			wantPath: "../test_data/test_local_repo_one_aws_leak_and_file_leak.json",
-		},
-		{
-			description: "test owner path",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/",
-				Report:       "../test_data/test_local_owner_aws_leak.json.got",
-				ReportFormat: "json",
-				Threads:      runtime.GOMAXPROCS(0),
-			},
-			wantPath: "../test_data/test_local_owner_aws_leak.json",
-		},
-		{
-			description: "test owner path allowlist repo",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/",
-				Report:       "../test_data/test_local_owner_aws_leak_allowlist_repo.json.got",
-				ReportFormat: "json",
-				ConfigPath:   "../test_data/test_configs/aws_key_local_owner_allowlist_repo.toml",
-			},
-			wantPath: "../test_data/test_local_owner_aws_leak_allowlist_repo.json",
-		},
-		{
-			description: "test entropy and regex",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_1",
-				Report:       "../test_data/test_regex_entropy.json.got",
-				ConfigPath:   "../test_data/test_configs/regex_entropy.toml",
-				ReportFormat: "json",
-				Threads:      runtime.GOMAXPROCS(0),
-			},
-			wantPath: "../test_data/test_regex_entropy.json",
-		},
-		{
-			description: "test local repo four entropy alternative config",
-			opts: options.Options{
-				Path:           "../test_data/test_repos/test_repo_4",
-				Report:         "../test_data/test_local_repo_four_alt_config_entropy.json.got",
-				RepoConfigPath: "gitleaks.toml",
-				ReportFormat:   "json",
-			},
-			wantPath: "../test_data/test_local_repo_four_alt_config_entropy.json",
-		},
-		{
-			description: "test local repo four entropy alternative config",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_1",
-				Report:       "../test_data/test_regex_allowlist.json.got",
-				ConfigPath:   "../test_data/test_configs/aws_key_aws_allowlisted.toml",
-				ReportFormat: "json",
-			},
-			wantEmpty: true,
-		},
-		{
-			description: "test owner path depth=2",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/",
-				Report:       "../test_data/test_local_owner_aws_leak_depth_2.json.got",
-				ReportFormat: "json",
-				Depth:        2,
-			},
-			wantPath: "../test_data/test_local_owner_aws_leak_depth_2.json",
-		},
-		{
-			description: "test local repo five files at Commit",
-			opts: options.Options{
-				Path:          "../test_data/test_repos/test_repo_5",
-				Report:        "../test_data/test_local_repo_five_files_at_commit.json.got",
-				FilesAtCommit: "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
-				ReportFormat:  "json",
-			},
-			wantPath: "../test_data/test_local_repo_five_files_at_commit.json",
-		},
-		{
-			description: "test local repo five files at latest Commit",
-			opts: options.Options{
-				Path:          "../test_data/test_repos/test_repo_5",
-				Report:        "../test_data/test_local_repo_five_files_at_latest_commit.json.got",
-				FilesAtCommit: "latest",
-				ReportFormat:  "json",
-			},
-			wantPath: "../test_data/test_local_repo_five_files_at_commit.json",
-		},
-		{
-			description: "test local repo five at Commit",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_5",
-				Report:       "../test_data/test_local_repo_five_commit.json.got",
-				Commit:       "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
-				ReportFormat: "json",
-				ConfigPath:   "../test_data/test_configs/generic.toml",
-			},
-			wantPath: "../test_data/test_local_repo_five_commit.json",
-		},
-		{
-			description: "test local repo five at latest Commit",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_5",
-				Report:       "../test_data/test_local_repo_five_at_latest_commit.json.got",
-				Commit:       "latest",
-				ReportFormat: "json",
-				ConfigPath:   "../test_data/test_configs/generic.toml",
-			},
-			wantPath: "../test_data/test_local_repo_five_at_latest_commit.json",
-		},
-		{
-			description: "test local repo six filename",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_6",
-				Report:       "../test_data/test_local_repo_six_filename.json.got",
-				ConfigPath:   "../test_data/test_configs/regex_filename.toml",
-				ReportFormat: "json",
-			},
-			wantPath: "../test_data/test_local_repo_six_filename.json",
-		},
-		{
-			description: "test local repo six filepath",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_6",
-				Report:       "../test_data/test_local_repo_six_filepath.json.got",
-				ConfigPath:   "../test_data/test_configs/regex_filepath.toml",
-				ReportFormat: "json",
-			},
-			wantPath: "../test_data/test_local_repo_six_filepath.json",
-		},
-		{
-			description: "test local repo six filename and filepath",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_6",
-				Report:       "../test_data/test_local_repo_six_filepath_filename.json.got",
-				ConfigPath:   "../test_data/test_configs/regex_filepath_filename.toml",
-				ReportFormat: "json",
-			},
-			wantPath: "../test_data/test_local_repo_six_filepath_filename.json",
-		},
-		{
-			description: "test local repo six path globally allowlisted",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_6",
-				Report:       "../test_data/test_local_repo_six_path_globally_allowlisted.json.got",
-				ConfigPath:   "../test_data/test_configs/aws_key_global_allowlist_path.toml",
-				ReportFormat: "json",
-			},
-			wantPath: "../test_data/test_local_repo_six_path_globally_allowlisted.json",
-		},
-		{
-			description: "test local repo six leaks since date",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_6",
-				Report:       "../test_data/test_local_repo_six_leaks_since_date.json.got",
-				ReportFormat: "json",
-				CommitSince:  "2019-10-25",
-			},
-			wantPath: "../test_data/test_local_repo_six_leaks_since_date.json",
-		},
-		{
-			description: "test local repo two leaks until date",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_6",
-				Report:       "../test_data/test_local_repo_six_leaks_until_date.json.got",
-				ReportFormat: "json",
-				CommitUntil:  "2019-10-25",
-			},
-			wantPath: "../test_data/test_local_repo_six_leaks_until_date.json",
-		},
-		{
-			description: "test local repo four leaks timerange Commit",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_4",
-				Report:       "../test_data/test_local_repo_four_leaks_commit_timerange.json.got",
-				ReportFormat: "json",
-				CommitSince:  "2019-10-25T13:01:27-0400",
-				CommitUntil:  "2019-10-25T13:12:32-0400",
-			},
-			wantPath: "../test_data/test_local_repo_four_leaks_commit_timerange.json",
-		},
-		{
-			description: "test local repo two allowlist Commit config",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_2",
-				Report:       "../test_data/test_local_repo_two_allowlist_commits.json.got",
-				ConfigPath:   "../test_data/test_configs/allowlist_commit.toml",
-				ReportFormat: "json",
-			},
-			wantPath: "../test_data/test_local_repo_two_allowlist_commits.json",
-		},
-		{
-			description: "test local repo eight (merges)",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_8",
-				Report:       "../test_data/test_local_repo_eight.json.got",
-				ReportFormat: "json",
-			},
-			wantPath: "../test_data/test_local_repo_eight.json",
-		},
-		{
-			description: "test local repo nine",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_9",
-				Report:       "../test_data/test_local_repo_nine_aws_leak.json.got",
-				ConfigPath:   "../test_data/test_configs/large_with_global_allowlist_regex.toml",
-				ReportFormat: "json",
-			},
-			wantPath: "../test_data/test_local_repo_nine_aws_leak.json",
-		},
-		{
-			description: "test dir one no git",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_dir_1",
-				Report:       "../test_data/test_dir1_aws_leak.json.got",
-				ReportFormat: "json",
-				NoGit:        true,
-			},
-			wantPath: "../test_data/test_dir1_aws_leak.json",
-		},
-		{
-			description: "test file with leak no git",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_dir_1/server.test.py",
-				Report:       "../test_data/test_file1_aws_leak.json.got",
-				ReportFormat: "json",
-				NoGit:        true,
-			},
-			wantPath: "../test_data/test_file1_aws_leak.json",
-		},
-		{
-			description: "test only md files no git",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/",
-				Report:       "../test_data/test_only_files_no_git.json.got",
-				ReportFormat: "json",
-				ConfigPath:   "../test_data/test_configs/onlyFiles.toml",
-				NoGit:        true,
-			},
-			wantPath: "../test_data/test_only_files_no_git.json",
-		},
-		{
-			description: "test allowlist files",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_10",
-				Report:       "../test_data/test_allow_list_file.json.got",
-				ReportFormat: "json",
-				ConfigPath:   "../test_data/test_configs/allowlist_files.toml",
-			},
-			wantPath: "../test_data/test_allow_list_file.json",
-		},
-		{
-			description: "test allowlist files",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_10",
-				Report:       "../test_data/test_allow_list_file.json.got",
-				ReportFormat: "json",
-				ConfigPath:   "../test_data/test_configs/allowlist_files.toml",
-			},
-			wantPath: "../test_data/test_allow_list_file.json",
-		},
-		{
-			description: "test allowlist files no-git",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_10",
-				Report:       "../test_data/test_allow_list_file_no_git.json.got",
-				ReportFormat: "json",
-				ConfigPath:   "../test_data/test_configs/allowlist_files.toml",
-				NoGit:        true,
-			},
-			wantPath: "../test_data/test_allow_list_file_no_git.json",
-		},
-		{
-			description: "test allowlist docx no-git",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_10",
-				Report:       "../test_data/test_allow_list_docx_no_git.json.got",
-				ReportFormat: "json",
-				ConfigPath:   "../test_data/test_configs/allowlist_docx.toml",
-				NoGit:        true,
-			},
-			wantPath: "../test_data/test_allow_list_docx_no_git.json",
-		},
-		{
-			description: "test append repo config",
-			opts: options.Options{
-				Path:             "../test_data/test_repos/test_repo_10",
-				Report:           "../test_data/test_append_repo.json.got",
-				ReportFormat:     "json",
-				ConfigPath:       "../test_data/test_configs/nozips.toml",
-				RepoConfigPath:   ".gitleaks.toml",
-				AppendRepoConfig: true,
-			},
-			wantPath: "../test_data/test_append_repo.json",
-		},
-		{
-			description: "test additional config",
-			opts: options.Options{
-				Path:             "../test_data/test_repos/test_repo_10",
-				Report:           "../test_data/test_additional_config.json.got",
-				ReportFormat:     "json",
-				ConfigPath:       "../test_data/test_configs/nozips.toml",
-				AdditionalConfig: "../test_data/test_repos/test_repo_10/.gitleaks.toml",
-			},
-			wantPath: "../test_data/test_additional_config.json",
-		},
-		{
-			description: "test append repo config with additional config",
-			opts: options.Options{
-				Path:             "../test_data/test_repos/test_repo_10",
-				Report:           "../test_data/test_append_repo_additional_config.json.got",
-				ReportFormat:     "json",
-				ConfigPath:       "../test_data/test_configs/nozips.toml",
-				RepoConfigPath:   ".gitleaks.toml",
-				AppendRepoConfig: true,
-				AdditionalConfig: "../test_data/test_configs/allowlist_bad_docx_10.toml",
-			},
-			wantEmpty: true,
-		},
-		{
-			description: "test append repo config with additional config",
-			opts: options.Options{
-				Path:             "../test_data/test_repos/test_repo_10",
-				Report:           "../test_data/test_append_repo_additional_config.json.got",
-				ReportFormat:     "json",
-				ConfigPath:       "../test_data/test_configs/nozips.toml",
-				RepoConfigPath:   ".gitleaks.toml",
-				AppendRepoConfig: true,
-				AdditionalConfig: "../test_data/test_configs/allowlist_bad_docx_10.toml",
-			},
-			wantEmpty: true,
-		},
-		{
-			description: "test file with no leak due to additional config no git",
-			opts: options.Options{
-				Path:             "../test_data/test_repos/test_dir_1",
-				Report:           "../test_data/fail.json.got",
-				ReportFormat:     "json",
-				NoGit:            false,
-				AdditionalConfig: "../test_data/test_configs/allowlist_allow_all_repo_1.toml",
-			},
-			wantEmpty: true,
-		},
-	}
-
-	for _, test := range tests {
-		fmt.Println(test.description)
-		cfg, err := config.NewConfig(test.opts)
-		if err != nil {
-			t.Error(err)
-		}
-
-		scanner, err := NewScanner(test.opts, cfg)
-		if test.wantErr != nil {
-			if err == nil {
-				t.Fatalf("did not receive wantErr: %v", test.wantErr)
-			}
-			if err.Error() != test.wantErr.Error() {
-				t.Fatalf("wantErr does not equal err received: %v", err.Error())
-			}
-			continue
-		}
-		if err != nil {
-			t.Fatal(err)
-		}
-
-		scannerReport, err := scanner.Scan()
-
-		if test.wantScanErr != nil {
-			if err == nil {
-				t.Fatalf("did not receive wantErr: %v", test.wantScanErr)
-			}
-			if err.Error() != test.wantScanErr.Error() {
-				t.Fatalf("wantErr does not equal err received: %v", err.Error())
-			}
-			continue
-		}
-		if err != nil {
-			t.Fatal(err)
-		}
-
-		err = WriteReport(scannerReport, test.opts, cfg)
-		if err != nil {
-			t.Error(err)
-		}
-
-		if test.wantEmpty {
-			if len(scannerReport.Leaks) != 0 {
-				t.Errorf("wanted no leaks but got some instead: %+v", scannerReport.Leaks)
-			}
-			continue
-		}
-
-		if test.wantPath != "" {
-			err := fileCheck(test.wantPath, test.opts.Report)
-			if err != nil {
-				t.Error(err)
-			}
-		}
-	}
-}
-
-//
-func TestScanUncommited(t *testing.T) {
-	moveDotGit("dotGit", ".git")
-	defer moveDotGit(".git", "dotGit")
-	tests := []struct {
-		description  string
-		opts         options.Options
-		wantPath     string
-		wantErr      error
-		wantScanErr  error
-		emptyRepo    bool
-		wantEmpty    bool
-		fileToChange string
-		addition     string
-	}{
-		{
-			description: "test scan local one leak",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_1",
-				Report:       "../test_data/test_local_repo_one_aws_leak_uncommitted.json.got",
-				Unstaged:     true,
-				ReportFormat: "json",
-			},
-			wantPath:     "../test_data/test_local_repo_one_aws_leak_uncommitted.json",
-			fileToChange: "server.test.py",
-			addition:     " aws_access_key_id='AKIAIO5FODNN7DXAMPLE'\n\n",
-		},
-		{
-			description: "test scan local no leak",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_1",
-				Unstaged:     true,
-				ReportFormat: "json",
-			},
-			wantEmpty:    true,
-			fileToChange: "server.test.py",
-			addition:     "nothing bad",
-		},
-		{
-			description: "test scan repo with no commits",
-			opts: options.Options{
-				Path:         "../test_data/test_repos/test_repo_7",
-				Report:       "../test_data/test_local_repo_seven_aws_leak_uncommitted.json.got",
-				Unstaged:     true,
-				ReportFormat: "json",
-			},
-			wantPath: "../test_data/test_local_repo_seven_aws_leak_uncommitted.json",
-		},
+		return err
 	}
-	for _, test := range tests {
-		var (
-			old []byte
-			err error
-		)
-		fmt.Println(test.description)
-		if test.fileToChange != "" {
-			old, err = ioutil.ReadFile(fmt.Sprintf("%s/%s", test.opts.Path, test.fileToChange))
-			if err != nil {
-				t.Error(err)
-			}
-			altered, err := os.OpenFile(fmt.Sprintf("%s/%s", test.opts.Path, test.fileToChange),
-				os.O_WRONLY|os.O_APPEND, 0644)
-			if err != nil {
-				t.Error(err)
-			}
-
-			_, err = altered.WriteString(test.addition)
-			if err != nil {
-				t.Error(err)
+	for _, dir := range repoDirs {
+		if to == ".git" {
+			_, err := os.Stat(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), "dotGit"))
+			if os.IsNotExist(err) {
+				// dont want to delete the only copy of .git accidentally
+				continue
 			}
-
-		}
-
-		cfg, err := config.NewConfig(test.opts)
-		if err != nil {
-			t.Error(err)
+			os.RemoveAll(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), ".git"))
 		}
-		scanner, err := NewScanner(test.opts, cfg)
-		if test.wantErr != nil {
-			if err == nil {
-				t.Fatalf("did not receive wantErr: %v", test.wantErr)
-			}
-			if err.Error() != test.wantErr.Error() {
-				t.Fatalf("wantErr does not equal err received: %v", err.Error())
-			}
+		if !dir.IsDir() {
 			continue
 		}
-		if err != nil {
-			t.Fatal(err)
-		}
-
-		scannerReport, err := scanner.Scan()
-
-		if test.wantScanErr != nil {
-			if err == nil {
-				t.Fatalf("did not receive wantErr: %v", test.wantScanErr)
-			}
-			if err.Error() != test.wantScanErr.Error() {
-				t.Fatalf("wantErr does not equal err received: %v", err.Error())
-			}
+		_, err := os.Stat(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), from))
+		if os.IsNotExist(err) {
 			continue
 		}
-		if err != nil {
-			t.Fatal(err)
-		}
 
-		err = WriteReport(scannerReport, test.opts, cfg)
+		err = os.Rename(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), from),
+			fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), to))
 		if err != nil {
-			t.Error(err)
-		}
-
-		if test.fileToChange != "" {
-			err = ioutil.WriteFile(fmt.Sprintf("%s/%s", test.opts.Path, test.fileToChange), old, 0)
-			if err != nil {
-				t.Error(err)
-			}
-		}
-
-		if test.wantEmpty {
-			continue
-		}
-
-		if test.wantPath != "" {
-			err := fileCheck(test.wantPath, test.opts.Report)
-			if err != nil {
-				t.Error(err)
-			}
+			return err
 		}
 	}
+	return nil
 }
 
 func fileCheck(wantPath, gotPath string) error {
 	var (
-		gotLeaks  []Leak
-		wantLeaks []Leak
+		gotLeaks  []scan.Leak
+		wantLeaks []scan.Leak
 	)
 	want, err := ioutil.ReadFile(wantPath)
 	if err != nil {
@@ -770,7 +90,7 @@ func fileCheck(wantPath, gotPath string) error {
 	return nil
 }
 
-func same(l1, l2 Leak) bool {
+func same(l1, l2 scan.Leak) bool {
 	if l1.Commit != l2.Commit {
 		return false
 	}
@@ -813,35 +133,3 @@ func same(l1, l2 Leak) bool {
 	return true
 
 }
-
-func moveDotGit(from, to string) error {
-	repoDirs, err := ioutil.ReadDir("../test_data/test_repos")
-	if err != nil {
-		return err
-	}
-	for _, dir := range repoDirs {
-		if to == ".git" {
-			_, err := os.Stat(fmt.Sprintf("%s/%s/%s", testRepoBase, dir.Name(), "dotGit"))
-			if os.IsNotExist(err) {
-				// dont want to delete the only copy of .git accidentally
-				continue
-			}
-			os.RemoveAll(fmt.Sprintf("%s/%s/%s", testRepoBase, dir.Name(), ".git"))
-		}
-		if !dir.IsDir() {
-			continue
-		}
-		_, err := os.Stat(fmt.Sprintf("%s/%s/%s", testRepoBase, dir.Name(), from))
-		if os.IsNotExist(err) {
-			continue
-		}
-
-		err = os.Rename(fmt.Sprintf("%s/%s/%s", testRepoBase, dir.Name(), from),
-			fmt.Sprintf("%s/%s/%s", testRepoBase, dir.Name(), to))
-		if err != nil {
-			return err
-		}
-		// fmt.Println("RENAMED")
-	}
-	return nil
-}

+ 111 - 0
scan/unstaged_test.go

@@ -0,0 +1,111 @@
+package scan_test
+
+import (
+	"io/ioutil"
+	"os"
+	"path/filepath"
+	"testing"
+
+	"github.com/zricethezav/gitleaks/v7/config"
+	"github.com/zricethezav/gitleaks/v7/options"
+	"github.com/zricethezav/gitleaks/v7/scan"
+)
+
+func TestUnstaged(t *testing.T) {
+	err := moveDotGit("dotGit", ".git")
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer moveDotGit(".git", "dotGit")
+	tests := []struct {
+		description  string
+		opts         options.Options
+		wantPath     string
+		fileToChange string
+		change       string
+		empty        bool
+	}{
+		{
+			description: "basic repo with unstagged change containing a secret",
+			opts: options.Options{
+				Path:         filepath.Join(repoBasePath, "basic"),
+				Report:       filepath.Join(expectPath, "basic", "results_unstaged.json.got"),
+				ReportFormat: "json",
+				Unstaged:     true,
+			},
+			wantPath:     filepath.Join(expectPath, "basic", "results_unstaged.json"),
+			fileToChange: filepath.Join(repoBasePath, "basic", "secrets.py"),
+			change:       "\nadded_aws_access_key_id='AKIAIO5FODNN7DXAMPLE'\n",
+		},
+		{
+			description: "basic repo with unstagged change not containing a secret",
+			opts: options.Options{
+				Path:         filepath.Join(repoBasePath, "basic"),
+				Report:       filepath.Join(expectPath, "basic", "results_unstaged.json.got"),
+				ReportFormat: "json",
+				Unstaged:     true,
+			},
+			empty:        true,
+			fileToChange: filepath.Join(repoBasePath, "basic", "secrets.py"),
+			change:       "\nnice_variable='is_nice''\n",
+		},
+	}
+
+	for _, test := range tests {
+		var old []byte
+		if test.fileToChange != "" {
+			old, err = ioutil.ReadFile(test.fileToChange)
+			if err != nil {
+				t.Error(err)
+			}
+			altered, err := os.OpenFile(test.fileToChange,
+				os.O_WRONLY|os.O_APPEND, 0644)
+			if err != nil {
+				t.Error(err)
+			}
+
+			_, err = altered.WriteString(test.change)
+			if err != nil {
+				t.Error(err)
+			}
+		}
+
+		cfg, err := config.NewConfig(test.opts)
+		if err != nil {
+			t.Error(err)
+		}
+
+		scanner, err := scan.NewScanner(test.opts, cfg)
+		if err != nil {
+			t.Fatal(test.description, err)
+		}
+
+		scannerReport, err := scanner.Scan()
+		if err != nil {
+			t.Fatal(test.description, err)
+		}
+
+		err = scan.WriteReport(scannerReport, test.opts, cfg)
+		if err != nil {
+			t.Error(test.description, err)
+		}
+
+		if test.empty {
+			if len(scannerReport.Leaks) != 0 {
+				t.Errorf("%s wanted no leaks but got some instead: %+v", test.description, scannerReport.Leaks)
+			}
+		}
+
+		if test.wantPath != "" {
+			err := fileCheck(test.wantPath, test.opts.Report)
+			if err != nil {
+				t.Error(test.description, err)
+			}
+		}
+		err = ioutil.WriteFile(test.fileToChange, old, 0)
+		if err != nil {
+			t.Error(err)
+		}
+
+	}
+}

+ 0 - 19
test_data/test_additional_config.json

@@ -1,19 +0,0 @@
-[
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: tmp/bad.docx",
-  "offenderEntropy": -1,
-  "commit": "b0f9b62dfe12e4e10de180359c6b9276472494f8",
-  "repo": "test_repo_10",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "Block dangerous filetypes",
-  "commitMessage": "Create bad.docx",
-  "author": "Zachary Rice",
-  "email": "zricer@protonmail.com",
-  "file": "tmp/bad.docx",
-  "date": "2020-12-09T11:02:10-05:00",
-  "tags": "key, extensions"
- }
-]

+ 0 - 87
test_data/test_allow_list_docx_no_git.json

@@ -1,87 +0,0 @@
-[
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_10/.gitignore",
-  "offenderEntropy": -1,
-  "commit": "",
-  "repo": "",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "Block dangerous filetypes",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "../test_data/test_repos/test_repo_10/.gitignore",
-  "date": "0001-01-01T00:00:00Z",
-  "tags": "key, extensions"
- },
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_10/bad.zip",
-  "offenderEntropy": -1,
-  "commit": "",
-  "repo": "",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "Block dangerous filetypes",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "../test_data/test_repos/test_repo_10/bad.zip",
-  "date": "0001-01-01T00:00:00Z",
-  "tags": "key, extensions"
- },
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_10/gitfile.txt",
-  "offenderEntropy": -1,
-  "commit": "",
-  "repo": "",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "Block dangerous filetypes",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "../test_data/test_repos/test_repo_10/gitfile.txt",
-  "date": "0001-01-01T00:00:00Z",
-  "tags": "key, extensions"
- },
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_10/creds.git",
-  "offenderEntropy": -1,
-  "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",
-  "offenderEntropy": -1,
-  "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"
- }
-]

+ 0 - 19
test_data/test_allow_list_file.json

@@ -1,19 +0,0 @@
-[
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: tmp/bad.docx",
-  "offenderEntropy": -1,
-  "commit": "b0f9b62dfe12e4e10de180359c6b9276472494f8",
-  "repo": "test_repo_10",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "Block dangerous filetypes",
-  "commitMessage": "Create bad.docx",
-  "author": "Zachary Rice",
-  "email": "zricer@protonmail.com",
-  "file": "tmp/bad.docx",
-  "date": "2020-12-09T11:02:10-05:00",
-  "tags": "key, extensions"
- }
-]

+ 0 - 36
test_data/test_allow_list_file_no_git.json

@@ -1,36 +0,0 @@
-[
-{
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_10/somedir.git/secret.key",
-  "offenderEntropy": -1,
-  "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": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_10/tmp/bad.docx",
-  "offenderEntropy": -1,
-  "commit": "",
-  "repo": "",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "Block dangerous filetypes",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "../test_data/test_repos/test_repo_10/tmp/bad.docx",
-  "date": "0001-01-01T00:00:00Z",
-  "tags": "key, extensions"
- }
-]

+ 0 - 19
test_data/test_append_repo.json

@@ -1,19 +0,0 @@
-[
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: tmp/bad.docx",
-  "offenderEntropy": -1,
-  "commit": "b0f9b62dfe12e4e10de180359c6b9276472494f8",
-  "repo": "test_repo_10",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "Block dangerous filetypes",
-  "commitMessage": "Create bad.docx",
-  "author": "Zachary Rice",
-  "email": "zricer@protonmail.com",
-  "file": "tmp/bad.docx",
-  "date": "2020-12-09T11:02:10-05:00",
-  "tags": "key, extensions"
- }
-]

+ 0 - 16
test_data/test_entropy.json

@@ -1,16 +0,0 @@
-[
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "offender": "Entropy range [{P1:4.5 P2:4.7} {P1:5.5 P2:6.3}]",
-  "offenderEntropy": -1,
-  "commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
-  "repo": "test_repo_1",
-  "rule": "entropy",
-  "commitMessage": "commit 1 with secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "server.test.py",
-  "date": "2019-10-24T09:29:27-04:00",
-  "tags": "entropy"
- }
-]

+ 0 - 19
test_data/test_file1_aws_leak.json

@@ -1,19 +0,0 @@
-[
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "",
-  "repo": "",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "../test_data/test_repos/test_dir_1/server.test.py",
-  "date": "0001-01-01T00:00:00Z",
-  "tags": "key, AWS"
- }
-]

+ 0 - 393
test_data/test_local_owner_aws_leak.json

@@ -1,393 +0,0 @@
-[
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
-  "repo": "test_repos",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "commit 1 with secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "server.test.py",
-  "date": "2019-10-24T09:29:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "    const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
-  "lineNumber": 4,
-  "offender": "AKIALALEMEL33243OLIB",
-  "offenderEntropy": -1,
-  "commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding another one\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding aws key\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T12:58:39-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 5,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "deea550dd6c7acaf0e59432600593533984a2125",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "dev branch\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:35:03-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "84ac4e80d4dbf2c968b64e9d4005f5079795bb81",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "more secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:54:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding aws key\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T12:58:39-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "    const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
-  "lineNumber": 4,
-  "offender": "AKIALALEMEL33243OLIB",
-  "offenderEntropy": -1,
-  "commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding another one\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 5,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "deea550dd6c7acaf0e59432600593533984a2125",
-  "repo": "test_repo_4",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "dev branch\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:35:03-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "84ac4e80d4dbf2c968b64e9d4005f5079795bb81",
-  "repo": "test_repo_4",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "more secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:54:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
-  "repo": "test_repo_4",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding aws key\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T12:58:39-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "    const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
-  "lineNumber": 4,
-  "offender": "AKIALALEMEL33243OLIB",
-  "offenderEntropy": -1,
-  "commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
-  "repo": "test_repo_4",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding another one\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_4",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE'",
-  "lineNumber": 1,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "1f2a4abc47dabf991e6af6f9770867ce0ac1f360",
-  "repo": "test_repo_5",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "introduce secrets\n",
-  "author": "Zach Rice",
-  "email": "zrice@gitlab.com",
-  "file": "secrets.py",
-  "date": "2020-02-01T10:07:34-05:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPL2'",
-  "lineNumber": 4,
-  "offender": "AKIAIO5FODNN7EXAMPL2",
-  "offenderEntropy": -1,
-  "commit": "ca71fcdeda15f25f0cc661d90e8785c255925c27",
-  "repo": "test_repo_5",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "introduce more secrets\n",
-  "author": "Zach Rice",
-  "email": "zrice@gitlab.com",
-  "file": "secrets.py",
-  "date": "2020-02-01T10:08:04-05:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
-  "repo": "test_repos",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "commit 1 with secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "server.test.py",
-  "date": "2019-10-24T09:29:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id=AKIAIO5FODNN7EXAMPLE",
-  "lineNumber": 3,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
-  "repo": "test_repo_6",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "Adding some secrets in config folder\n\n",
-  "author": "Noel Algora",
-  "email": "noealgigu@gmail.com",
-  "file": "config/application.properties",
-  "date": "2020-02-24T14:13:15-05:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 2,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "ce7e8177bbf8a172c06b6a1e370a374d5c19f660",
-  "repo": "test_repo_8",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "dummy.txt w/ text",
-  "author": "Zachary Rice",
-  "email": "zricer@protonmail.com",
-  "file": "dummy.txt",
-  "date": "2020-07-25T14:39:11-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 6,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "9267bc86ec1497471cbc6f3308f3527f7ef34b9d",
-  "repo": "test_repo_8",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "Update dummy.txt",
-  "author": "Zachary Rice",
-  "email": "zricer@protonmail.com",
-  "file": "dummy.txt",
-  "date": "2020-07-25T14:41:11-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 6,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "748f11eaf2c38c3cf0ac6a22e44208777e79fa6f",
-  "repo": "test_repo_8",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "Merge pull request #1 from zricethezav/additional-secret-branch\n\nUpdate dummy.txt",
-  "author": "Zachary Rice",
-  "email": "zricer@protonmail.com",
-  "file": "dummy.txt",
-  "date": "2020-07-25T14:44:48-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE', #gitleaks:allow",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "8d1fb60d2d80f0590f191ed5ace1e45ef780909a",
-  "repo": "test_repo_9",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "gitleaks allow secret\n",
-  "author": "Zach Rice",
-  "email": "zrice@gitlab.com",
-  "file": "server.test.py",
-  "date": "2020-08-12T13:36:20-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
-  "repo": "test_repos",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "commit 1 with secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "server.test.py",
-  "date": "2019-10-24T09:29:27-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 376
test_data/test_local_owner_aws_leak_allowlist_repo.json

@@ -1,376 +0,0 @@
-[
- {
-  "line": "    const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
-  "lineNumber": 4,
-  "offender": "AKIALALEMEL33243OLIB",
-  "offenderEntropy": -1,
-  "commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding another one\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding aws key\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T12:58:39-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "84ac4e80d4dbf2c968b64e9d4005f5079795bb81",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "more secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:54:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 5,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "deea550dd6c7acaf0e59432600593533984a2125",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "dev branch\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:35:03-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "    const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
-  "lineNumber": 4,
-  "offender": "AKIALALEMEL33243OLIB",
-  "offenderEntropy": -1,
-  "commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding another one\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding aws key\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T12:58:39-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "84ac4e80d4dbf2c968b64e9d4005f5079795bb81",
-  "repo": "test_repo_4",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "more secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:54:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 5,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "deea550dd6c7acaf0e59432600593533984a2125",
-  "repo": "test_repo_4",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "dev branch\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:35:03-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "    const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
-  "lineNumber": 4,
-  "offender": "AKIALALEMEL33243OLIB",
-  "offenderEntropy": -1,
-  "commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
-  "repo": "test_repo_4",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding another one\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_4",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
-  "repo": "test_repo_4",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding aws key\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T12:58:39-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPL2'",
-  "lineNumber": 4,
-  "offender": "AKIAIO5FODNN7EXAMPL2",
-  "offenderEntropy": -1,
-  "commit": "ca71fcdeda15f25f0cc661d90e8785c255925c27",
-  "repo": "test_repo_5",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "introduce more secrets\n",
-  "author": "Zach Rice",
-  "email": "zrice@gitlab.com",
-  "file": "secrets.py",
-  "date": "2020-02-01T10:08:04-05:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE'",
-  "lineNumber": 1,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "1f2a4abc47dabf991e6af6f9770867ce0ac1f360",
-  "repo": "test_repo_5",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "introduce secrets\n",
-  "author": "Zach Rice",
-  "email": "zrice@gitlab.com",
-  "file": "secrets.py",
-  "date": "2020-02-01T10:07:34-05:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id=AKIAIO5FODNN7EXAMPLE",
-  "lineNumber": 3,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
-  "repo": "test_repo_6",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "Adding some secrets in config folder\n\n",
-  "author": "Noel Algora",
-  "email": "noealgigu@gmail.com",
-  "file": "config/application.properties",
-  "date": "2020-02-24T14:13:15-05:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
-  "repo": "test_repos",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "commit 1 with secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "server.test.py",
-  "date": "2019-10-24T09:29:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 6,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "748f11eaf2c38c3cf0ac6a22e44208777e79fa6f",
-  "repo": "test_repo_8",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "Merge pull request #1 from zricethezav/additional-secret-branch\n\nUpdate dummy.txt",
-  "author": "Zachary Rice",
-  "email": "zricer@protonmail.com",
-  "file": "dummy.txt",
-  "date": "2020-07-25T14:44:48-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 2,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "ce7e8177bbf8a172c06b6a1e370a374d5c19f660",
-  "repo": "test_repo_8",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "dummy.txt w/ text",
-  "author": "Zachary Rice",
-  "email": "zricer@protonmail.com",
-  "file": "dummy.txt",
-  "date": "2020-07-25T14:39:11-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 6,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "9267bc86ec1497471cbc6f3308f3527f7ef34b9d",
-  "repo": "test_repo_8",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "Update dummy.txt",
-  "author": "Zachary Rice",
-  "email": "zricer@protonmail.com",
-  "file": "dummy.txt",
-  "date": "2020-07-25T14:41:11-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE', #gitleaks:allow",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "8d1fb60d2d80f0590f191ed5ace1e45ef780909a",
-  "repo": "test_repo_9",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "gitleaks allow secret\n",
-  "author": "Zach Rice",
-  "email": "zrice@gitlab.com",
-  "file": "server.test.py",
-  "date": "2020-08-12T13:36:20-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
-  "repo": "test_repos",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "commit 1 with secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "server.test.py",
-  "date": "2019-10-24T09:29:27-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 121
test_data/test_local_owner_aws_leak_depth_2.json

@@ -1,121 +0,0 @@
-[
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
-  "repo": "test_repos",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "commit 1 with secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "server.test.py",
-  "date": "2019-10-24T09:29:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "    const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
-  "lineNumber": 4,
-  "offender": "AKIALALEMEL33243OLIB",
-  "offenderEntropy": -1,
-  "commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding another one\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "const AWSKEY = \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "84ac4e80d4dbf2c968b64e9d4005f5079795bb81",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "more secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:54:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPL2'",
-  "lineNumber": 4,
-  "offender": "AKIAIO5FODNN7EXAMPL2",
-  "offenderEntropy": -1,
-  "commit": "ca71fcdeda15f25f0cc661d90e8785c255925c27",
-  "repo": "test_repo_5",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "introduce more secrets\n",
-  "author": "Zach Rice",
-  "email": "zrice@gitlab.com",
-  "file": "secrets.py",
-  "date": "2020-02-01T10:08:04-05:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id=AKIAIO5FODNN7EXAMPLE",
-  "lineNumber": 3,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
-  "repo": "test_repo_6",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "Adding some secrets in config folder\n\n",
-  "author": "Noel Algora",
-  "email": "noealgigu@gmail.com",
-  "file": "config/application.properties",
-  "date": "2020-02-24T14:13:15-05:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 6,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "748f11eaf2c38c3cf0ac6a22e44208777e79fa6f",
-  "repo": "test_repo_8",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "Merge pull request #1 from zricethezav/additional-secret-branch\n\nUpdate dummy.txt",
-  "author": "Zachary Rice",
-  "email": "zricer@protonmail.com",
-  "file": "dummy.txt",
-  "date": "2020-07-25T14:44:48-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE', #gitleaks:allow",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "8d1fb60d2d80f0590f191ed5ace1e45ef780909a",
-  "repo": "test_repo_9",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "gitleaks allow secret\n",
-  "author": "Zach Rice",
-  "email": "zrice@gitlab.com",
-  "file": "server.test.py",
-  "date": "2020-08-12T13:36:20-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 53
test_data/test_local_repo_eight.json

@@ -1,53 +0,0 @@
-[
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 6,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "748f11eaf2c38c3cf0ac6a22e44208777e79fa6f",
-  "repo": "test_repo_8",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "Merge pull request #1 from zricethezav/additional-secret-branch\n\nUpdate dummy.txt",
-  "author": "Zachary Rice",
-  "email": "zricer@protonmail.com",
-  "file": "dummy.txt",
-  "date": "2020-07-25T14:44:48-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 2,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "ce7e8177bbf8a172c06b6a1e370a374d5c19f660",
-  "repo": "test_repo_8",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "dummy.txt w/ text",
-  "author": "Zachary Rice",
-  "email": "zricer@protonmail.com",
-  "file": "dummy.txt",
-  "date": "2020-07-25T14:39:11-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 6,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "9267bc86ec1497471cbc6f3308f3527f7ef34b9d",
-  "repo": "test_repo_8",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "Update dummy.txt",
-  "author": "Zachary Rice",
-  "email": "zricer@protonmail.com",
-  "file": "dummy.txt",
-  "date": "2020-07-25T14:41:11-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 18
test_data/test_local_repo_five_at_latest_commit.json

@@ -1,18 +0,0 @@
-[
- {
-  "line": "more_secrets = '99432bfewaf823ec3294e231'",
-  "lineNumber": 7,
-  "offender": "secrets = '99432bfewaf823ec3294e231",
-  "offenderEntropy": -1,
-  "commit": "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
-  "repo": "test_repo_5",
-  "rule": "Generic Credential",
-  "commitMessage": "even more secrets\n",
-  "author": "Zach Rice",
-  "email": "zrice@gitlab.com",
-  "file": "secrets.py",
-  "date": "2020-02-01T10:30:22-05:00",
-  "tags": "key, API, generic",
-  "operation": "addition"
- }
-]

+ 0 - 18
test_data/test_local_repo_five_commit.json

@@ -1,18 +0,0 @@
-[
- {
-  "line": "more_secrets = '99432bfewaf823ec3294e231'",
-  "lineNumber": 7,
-  "offender": "secrets = '99432bfewaf823ec3294e231",
-  "offenderEntropy": -1,
-  "commit": "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
-  "repo": "test_repo_5",
-  "rule": "Generic Credential",
-  "commitMessage": "even more secrets\n",
-  "author": "Zach Rice",
-  "email": "zrice@gitlab.com",
-  "file": "secrets.py",
-  "date": "2020-02-01T10:30:22-05:00",
-  "tags": "key, API, generic",
-  "operation": "addition"
- }
-]

+ 0 - 34
test_data/test_local_repo_five_files_at_commit.json

@@ -1,34 +0,0 @@
-[
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE'",
-  "lineNumber": 1,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
-  "repo": "test_repo_5",
-  "rule": "AWS Access Key",
-  "commitMessage": "even more secrets\n",
-  "author": "Zach Rice",
-  "email": "zrice@gitlab.com",
-  "file": "secrets.py",
-  "date": "2020-02-01T10:30:22-05:00",
-  "tags": "key, AWS",
-  "operation": "addition"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPL2'",
-  "lineNumber": 4,
-  "offender": "AKIAIO5FODNN7EXAMPL2",
-  "offenderEntropy": -1,
-  "commit": "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
-  "repo": "test_repo_5",
-  "rule": "AWS Access Key",
-  "commitMessage": "even more secrets\n",
-  "author": "Zach Rice",
-  "email": "zrice@gitlab.com",
-  "file": "secrets.py",
-  "date": "2020-02-01T10:30:22-05:00",
-  "tags": "key, AWS",
-  "operation": "addition"
- }
-]

+ 0 - 34
test_data/test_local_repo_five_files_at_latest_commit.json

@@ -1,34 +0,0 @@
-[
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPLE'",
-  "lineNumber": 1,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
-  "repo": "test_repo_5",
-  "rule": "AWS Access Key",
-  "commitMessage": "even more secrets\n",
-  "author": "Zach Rice",
-  "email": "zrice@gitlab.com",
-  "file": "secrets.py",
-  "date": "2020-02-01T10:30:22-05:00",
-  "tags": "key, AWS",
-  "operation": "addition"
- },
- {
-  "line": "aws_access_key_id='AKIAIO5FODNN7EXAMPL2'",
-  "lineNumber": 4,
-  "offender": "AKIAIO5FODNN7EXAMPL2",
-  "offenderEntropy": -1,
-  "commit": "a4c9fb737d5552fd96fce5cc7eedb23353ba9ed0",
-  "repo": "test_repo_5",
-  "rule": "AWS Access Key",
-  "commitMessage": "even more secrets\n",
-  "author": "Zach Rice",
-  "email": "zrice@gitlab.com",
-  "file": "secrets.py",
-  "date": "2020-02-01T10:30:22-05:00",
-  "tags": "key, AWS",
-  "operation": "addition"
- }
-]

+ 0 - 36
test_data/test_local_repo_four_alt_config_entropy.json

@@ -1,36 +0,0 @@
-[
- {
-  "line": "const AWSSECRET = \"99432bfewaf823ec3294e231\"",
-  "lineNumber": 4,
-  "offender": "\"99432bfewaf823ec3294e231\"",
-  "offenderEntropy": 3.355,
-  "commit": "84ac4e80d4dbf2c968b64e9d4005f5079795bb81",
-  "repo": "test_repo_4",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "entropy",
-  "commitMessage": "more secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:54:08-04:00",
-  "tags": "entropy"
- },
- {
-  "line": "    const AWSSECRET = \"99432bfewaf823ec3294e231\"",
-  "lineNumber": 5,
-  "offender": "\"99432bfewaf823ec3294e231\"",
-  "offenderEntropy": 3.355,
-  "commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
-  "repo": "test_repo_4",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "entropy",
-  "commitMessage": "adding another one\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:08-04:00",
-  "tags": "entropy"
- }
-]

+ 0 - 36
test_data/test_local_repo_four_leaks_commit_timerange.json

@@ -1,36 +0,0 @@
-[
- {
-  "line": "    const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
-  "lineNumber": 4,
-  "offender": "AKIALALEMEL33243OLIB",
-  "offenderEntropy": -1,
-  "commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
-  "repo": "test_repo_4",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding another one\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_4",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 18
test_data/test_local_repo_nine_aws_leak.json

@@ -1,18 +0,0 @@
-[
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
-  "repo": "test_repo_9",
-  "rule": "AWS Access Key",
-  "commitMessage": "commit 1 with secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "server.test.py",
-  "date": "2019-10-24T09:29:27-04:00",
-  "tags": "key, AWS",
-  "operation": "addition"
- }
-]

+ 0 - 19
test_data/test_local_repo_one_aws_leak.json

@@ -1,19 +0,0 @@
-[
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
-  "repo": "test_repo_1",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "commit 1 with secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "server.test.py",
-  "date": "2019-10-24T09:29:27-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 18
test_data/test_local_repo_one_aws_leak_and_file_leak.json

@@ -1,18 +0,0 @@
-[
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
-  "repo": "test_repo_1",
-  "rule": "AWS Access Key",
-  "commitMessage": "commit 1 with secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "server.test.py",
-  "date": "2019-10-24T09:29:27-04:00",
-  "tags": "key, AWS",
-  "operation": "addition"
- }
-]

+ 0 - 18
test_data/test_local_repo_one_aws_leak_commit.json

@@ -1,18 +0,0 @@
-[
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
-  "repo": "test_repo_1",
-  "rule": "AWS Access Key",
-  "commitMessage": "commit 1 with secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "server.test.py",
-  "date": "2019-10-24T09:29:27-04:00",
-  "tags": "key, AWS",
-  "operation": "addition"
- }
-]

+ 0 - 18
test_data/test_local_repo_seven_aws_leak_uncommitted.json

@@ -1,18 +0,0 @@
-[
- {
-  "line": "AKIAIO5FODNN7EXAMPLE",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "0000000000000000000000000000000000000000",
-  "repo": "test_repo_7",
-  "rule": "AWS Access Key",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "file",
-  "date": "1970-01-01T00:00:00Z",
-  "tags": "key, AWS",
-  "operation": "equal"
- }
-]

+ 0 - 47
test_data/test_local_repo_six.json

@@ -1,47 +0,0 @@
-[
- {
-  "line": "api_token: exampleSecretPassword",
-  "lineNumber": 3,
-  "offender": "token: exampleSecretPassword",
-  "offenderEntropy": -1,
-  "commit": "e7bf376f855ae9bc6e3bb27b5f9d65c57eba799d",
-  "repo": "test_repo_6",
-  "rule": "Generic password",
-  "commitMessage": "More secrets\n\n",
-  "author": "Noel Algora",
-  "email": "noealgigu@gmail.com",
-  "file": "config/config.yaml",
-  "date": "2020-02-19T04:08:26-05:00",
-  "tags": "key, Yml, Yaml"
- },
- {
-  "line": "db_password_token: exampleSecretPassword",
-  "lineNumber": 3,
-  "offender": "password_token: exampleSecretPassword",
-  "offenderEntropy": -1,
-  "commit": "e7bf376f855ae9bc6e3bb27b5f9d65c57eba799d",
-  "repo": "test_repo_6",
-  "rule": "Generic password",
-  "commitMessage": "More secrets\n\n",
-  "author": "Noel Algora",
-  "email": "noealgigu@gmail.com",
-  "file": "config/config.yaml",
-  "date": "2020-02-19T04:08:26-05:00",
-  "tags": "key, Yml, Yaml"
- },
- {
-  "line": "aws_access_key_id=AKIAIO5FODNN7EXAMPLE",
-  "lineNumber": 1,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "95cf0237f8cdfc0686a29df08260d8635f46c9b0",
-  "repo": "test_repo_6",
-  "rule": "AWS Access Key",
-  "commitMessage": "AWS Key in properties\n\n",
-  "author": "Noel Algora",
-  "email": "noealgigu@gmail.com",
-  "file": "config/application.properties",
-  "date": "2020-02-19T04:04:15-05:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 34
test_data/test_local_repo_six_filename.json

@@ -1,34 +0,0 @@
-[
- {
-  "line": "api_token: exampleSecretPassword",
-  "lineNumber": 2,
-  "offender": "token: exampleSecretPassword",
-  "offenderEntropy": -1,
-  "commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
-  "repo": "test_repo_6",
-  "rule": "Generic password",
-  "commitMessage": "Adding some secrets in config folder\n\n",
-  "author": "Noel Algora",
-  "email": "noealgigu@gmail.com",
-  "file": "application.yaml",
-  "date": "2020-02-24T14:13:15-05:00",
-  "tags": "key, Yml, Yaml",
-  "operation": "addition"
- },
- {
-  "line": "db_password: verySecretProductionPassword",
-  "lineNumber": 3,
-  "offender": "password: verySecretProductionPassword",
-  "offenderEntropy": -1,
-  "commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
-  "repo": "test_repo_6",
-  "rule": "Generic password",
-  "commitMessage": "Adding some secrets in config folder\n\n",
-  "author": "Noel Algora",
-  "email": "noealgigu@gmail.com",
-  "file": "application.yaml",
-  "date": "2020-02-24T14:13:15-05:00",
-  "tags": "key, Yml, Yaml",
-  "operation": "addition"
- }
-]

+ 0 - 18
test_data/test_local_repo_six_filepath.json

@@ -1,18 +0,0 @@
-[
- {
-  "line": "aws_access_key_id=AKIAIO5FODNN7EXAMPLE",
-  "lineNumber": 3,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
-  "repo": "test_repo_6",
-  "rule": "AWS Access Key",
-  "commitMessage": "Adding some secrets in config folder\n\n",
-  "author": "Noel Algora",
-  "email": "noealgigu@gmail.com",
-  "file": "config/application.properties",
-  "date": "2020-02-24T14:13:15-05:00",
-  "tags": "key, AWS",
-  "operation": "addition"
- }
-]

+ 0 - 18
test_data/test_local_repo_six_filepath_filename.json

@@ -1,18 +0,0 @@
-[
- {
-  "line": "apiToken=d41d8cd98f00b204e9800998ecf8427e",
-  "lineNumber": 2,
-  "offender": "Token=d41d8cd98f00b204e9800998ecf8427e",
-  "offenderEntropy": -1,
-  "commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
-  "repo": "test_repo_6",
-  "rule": "Generic password",
-  "commitMessage": "Adding some secrets in config folder\n\n",
-  "author": "Noel Algora",
-  "email": "noealgigu@gmail.com",
-  "file": "config/application.properties",
-  "date": "2020-02-24T14:13:15-05:00",
-  "tags": "key, Yml, Yaml",
-  "operation": "addition"
- }
-]

+ 0 - 18
test_data/test_local_repo_six_leaks_since_date.json

@@ -1,18 +0,0 @@
-[
- {
-  "line": "aws_access_key_id=AKIAIO5FODNN7EXAMPLE",
-  "lineNumber": 3,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "98b6c7cb3fb29a5993c4c95c56a2dc53050b9247",
-  "repo": "test_repo_6",
-  "rule": "AWS Access Key",
-  "commitMessage": "Adding some secrets in config folder\n\n",
-  "author": "Noel Algora",
-  "email": "noealgigu@gmail.com",
-  "file": "config/application.properties",
-  "date": "2020-02-24T14:13:15-05:00",
-  "tags": "key, AWS",
-  "operation": "addition"
- }
-]

+ 0 - 18
test_data/test_local_repo_six_leaks_until_date.json

@@ -1,18 +0,0 @@
-[
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
-  "repo": "test_repo_6",
-  "rule": "AWS Access Key",
-  "commitMessage": "commit 1 with secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "server.test.py",
-  "date": "2019-10-24T09:29:27-04:00",
-  "tags": "key, AWS",
-  "operation": "addition"
- }
-]

+ 0 - 18
test_data/test_local_repo_six_path_globally_allowlisted.json

@@ -1,18 +0,0 @@
-[
- {
-  "line": "    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',",
-  "lineNumber": 5,
-  "offender": "AKIAIO5FODNN7EXAMPLE",
-  "offenderEntropy": -1,
-  "commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
-  "repo": "test_repo_6",
-  "rule": "AWS Access Key",
-  "commitMessage": "commit 1 with secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "server.test.py",
-  "date": "2019-10-24T09:29:27-04:00",
-  "tags": "key, AWS",
-  "operation": "addition"
- }
-]

+ 0 - 70
test_data/test_local_repo_three_leaks.json

@@ -1,70 +0,0 @@
-[
- {
-  "line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 5,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "deea550dd6c7acaf0e59432600593533984a2125",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "dev branch\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:35:03-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "    const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
-  "lineNumber": 4,
-  "offender": "AKIALALEMEL33243OLIB",
-  "offenderEntropy": -1,
-  "commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding another one\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding aws key\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T12:58:39-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 53
test_data/test_local_repo_three_leaks_with_report_groups.json

@@ -1,53 +0,0 @@
-[
- {
-  "line": "AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 5,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "deea550dd6c7acaf0e59432600593533984a2125",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "dev branch\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:35:03-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
-  "repo": "test_repo_3",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding aws key\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T12:58:39-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 19
test_data/test_local_repo_two_allowlist_commits.json

@@ -1,19 +0,0 @@
-[
- {
-  "line": "    const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
-  "lineNumber": 4,
-  "offender": "AKIALALEMEL33243OLIB",
-  "offenderEntropy": -1,
-  "commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding another one\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:08-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 53
test_data/test_local_repo_two_leaks.json

@@ -1,53 +0,0 @@
-[
- {
-  "line": "    const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
-  "lineNumber": 4,
-  "offender": "AKIALALEMEL33243OLIB",
-  "offenderEntropy": -1,
-  "commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding another one\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:08-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding aws key\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T12:58:39-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 36
test_data/test_local_repo_two_leaks_commit_from.json

@@ -1,36 +0,0 @@
-[
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding aws key\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T12:58:39-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 36
test_data/test_local_repo_two_leaks_commit_range.json

@@ -1,36 +0,0 @@
-[
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding aws key\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T12:58:39-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 19
test_data/test_local_repo_two_leaks_commit_to.json

@@ -1,19 +0,0 @@
-[
- {
-  "line": "    const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
-  "lineNumber": 4,
-  "offender": "AKIALALEMEL33243OLIB",
-  "offenderEntropy": -1,
-  "commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding another one\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:08-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 19
test_data/test_local_repo_two_leaks_commit_to_from.json

@@ -1,19 +0,0 @@
-[
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 98
test_data/test_local_repo_two_leaks_deletion.json

@@ -1,98 +0,0 @@
-[
- {
-  "line": "    const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
-  "lineNumber": -1,
-  "offender": "AKIALALEMEL33243OLIB",
-  "offenderEntropy": -1,
-  "commit": "f61cd8587b7ac1d75a89a0c9af870a2f24c60263",
-  "repo": "test_repo_2",
-  "rule": "AWS Access Key",
-  "commitMessage": "rm secrets again\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:32-04:00",
-  "tags": "key, AWS",
-  "operation": "deletion"
- },
- {
-  "line": "    const AWSKEY = \"AKIALALEMEL33243OLIBE\"",
-  "lineNumber": 5,
-  "offender": "AKIALALEMEL33243OLIB",
-  "offenderEntropy": -1,
-  "commit": "b2eb34a61c988afd9b4aaa9dd58c8dd7d5f14dba",
-  "repo": "test_repo_2",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding another one\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:12:08-04:00",
-  "tags": "key, AWS",
-  "operation": "addition"
- },
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": -1,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "996865bb912f3bc45898a370a13aadb315014b55",
-  "repo": "test_repo_2",
-  "rule": "AWS Access Key",
-  "commitMessage": "committing pem\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:07:41-04:00",
-  "tags": "key, AWS",
-  "operation": "deletion"
- },
- {
-  "line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
-  "lineNumber": -1,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_2",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS",
-  "operation": "deletion"
- },
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 5,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_2",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS",
-  "operation": "addition"
- },
- {
-  "line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
-  "repo": "test_repo_2",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding aws key\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T12:58:39-04:00",
-  "tags": "key, AWS",
-  "operation": "addition"
- }
-]

+ 0 - 36
test_data/test_local_repo_two_leaks_file_commit_range.json

@@ -1,36 +0,0 @@
-[
- {
-  "line": "Here's an AWS secret: \"AKIALALEMEL33243OLIAE\"",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "wait this is actually adding an aws secret\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T13:01:27-04:00",
-  "tags": "key, AWS"
- },
- {
-  "line": "Here's an AWS secret: AKIALALEMEL33243OLIAE",
-  "lineNumber": 3,
-  "offender": "AKIALALEMEL33243OLIA",
-  "offenderEntropy": -1,
-  "commit": "b10b3e2cb320a8c211fda94c4567299d37de7776",
-  "repo": "test_repo_2",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "AWS Access Key",
-  "commitMessage": "adding aws key\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "secrets.md",
-  "date": "2019-10-25T12:58:39-04:00",
-  "tags": "key, AWS"
- }
-]

+ 0 - 155
test_data/test_only_files_no_git.json

@@ -1,155 +0,0 @@
-[
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_10/README.md",
-  "offenderEntropy": -1,
-  "commit": "",
-  "repo": "",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "flag go",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "../test_data/test_repos/test_repo_10/README.md",
-  "date": "0001-01-01T00:00:00Z",
-  "tags": "key, extensions"
- },
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_2/secrets.md",
-  "offenderEntropy": -1,
-  "commit": "",
-  "repo": "",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "flag go",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "../test_data/test_repos/test_repo_2/secrets.md",
-  "date": "0001-01-01T00:00:00Z",
-  "tags": "key, extensions"
- },
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_2/no_secrets.md",
-  "offenderEntropy": -1,
-  "commit": "",
-  "repo": "",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "flag go",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "../test_data/test_repos/test_repo_2/no_secrets.md",
-  "date": "0001-01-01T00:00:00Z",
-  "tags": "key, extensions"
- },
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_3/no_secrets.md",
-  "offenderEntropy": -1,
-  "commit": "",
-  "repo": "",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "flag go",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "../test_data/test_repos/test_repo_3/no_secrets.md",
-  "date": "0001-01-01T00:00:00Z",
-  "tags": "key, extensions"
- },
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_3/secrets.md",
-  "offenderEntropy": -1,
-  "commit": "",
-  "repo": "",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "flag go",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "../test_data/test_repos/test_repo_3/secrets.md",
-  "date": "0001-01-01T00:00:00Z",
-  "tags": "key, extensions"
- },
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_4/secrets.md",
-  "offenderEntropy": -1,
-  "commit": "",
-  "repo": "",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "flag go",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "../test_data/test_repos/test_repo_4/secrets.md",
-  "date": "0001-01-01T00:00:00Z",
-  "tags": "key, extensions"
- },
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_4/no_secrets.md",
-  "offenderEntropy": -1,
-  "commit": "",
-  "repo": "",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "flag go",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "../test_data/test_repos/test_repo_4/no_secrets.md",
-  "date": "0001-01-01T00:00:00Z",
-  "tags": "key, extensions"
- },
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_5/notes.md",
-  "offenderEntropy": -1,
-  "commit": "",
-  "repo": "",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "flag go",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "../test_data/test_repos/test_repo_5/notes.md",
-  "date": "0001-01-01T00:00:00Z",
-  "tags": "key, extensions"
- },
- {
-  "line": "",
-  "lineNumber": 1,
-  "offender": "Filename or path offender: ../test_data/test_repos/test_repo_8/README.md",
-  "offenderEntropy": -1,
-  "commit": "",
-  "repo": "",
-  "repoURL": "",
-  "leakURL": "",
-  "rule": "flag go",
-  "commitMessage": "",
-  "author": "",
-  "email": "",
-  "file": "../test_data/test_repos/test_repo_8/README.md",
-  "date": "0001-01-01T00:00:00Z",
-  "tags": "key, extensions"
- }
-]

+ 0 - 5
test_data/test_options/test_local_repo_commits.txt

@@ -1,5 +0,0 @@
-d8ac0b73aeeb45843319cdc5ce506516eb49bf7a
-996865bb912f3bc45898a370a13aadb315014b55
-17471a5fda722a9e423f1a0d3f0d267ea009d41c
-51f6dcf6b89b93f4075ba92c400b075631a6cc93
-b10b3e2cb320a8c211fda94c4567299d37de7776

+ 0 - 1
test_data/test_regex_allowlist.json

@@ -1 +0,0 @@
-null

+ 0 - 18
test_data/test_regex_entropy.json

@@ -1,18 +0,0 @@
-[
- {
-  "line": "    aws_secret_access_key='ABCDEF+c2L7yXeGvUyrPgYsDnWRRC1AYEXAMPLE'",
-  "lineNumber": 6,
-  "offender": "'ABCDEF+c2L7yXeGvUyrPgYsDnWRRC1AYEXAMPLE'",
-  "offenderEntropy": 4.631,
-  "commit": "6557c92612d3b35979bd426d429255b3bf9fab74",
-  "repo": "test_repo_1",
-  "rule": "entropy and regex",
-  "commitMessage": "commit 1 with secrets\n",
-  "author": "zach rice",
-  "email": "zricer@protonmail.com",
-  "file": "server.test.py",
-  "date": "2019-10-24T09:29:27-04:00",
-  "tags": "entropy",
-  "operation": "addition"
- }
-]

+ 0 - 1
test_data/test_repos/no_repo/tmp.tmp

@@ -1 +0,0 @@
-tmp

+ 0 - 9
test_data/test_repos/test_dir_1/server.test.py

@@ -1,9 +0,0 @@
-# Do not hard code credentials
-client = boto3.client(
-    's3',
-    # Hard coded strings as credentials, not recommended.
-    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',
-    aws_secret_access_key='ABCDEF+c2L7yXeGvUyrPgYsDnWRRC1AYEXAMPLE'
-)
-
-# adding another line

+ 0 - 9
test_data/test_repos/test_dir_1/server.test2.py

@@ -1,9 +0,0 @@
-# Do not hard code credentials
-client = boto3.client(
-    's3',
-    # Hard coded strings as credentials, not recommended.
-    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',
-    aws_secret_access_key='ABCDEF+c2L7yXeGvUyrPgYsDnWRRC1AYEXAMPLE'
-)
-
-# adding another line

+ 0 - 1
test_data/test_repos/test_repo_1/dotGit/COMMIT_EDITMSG

@@ -1 +0,0 @@
-comment

+ 0 - 7
test_data/test_repos/test_repo_1/dotGit/config

@@ -1,7 +0,0 @@
-[core]
-	repositoryformatversion = 0
-	filemode = true
-	bare = false
-	logallrefupdates = true
-	ignorecase = true
-	precomposeunicode = true

binární
test_data/test_repos/test_repo_1/dotGit/index


+ 0 - 6
test_data/test_repos/test_repo_1/dotGit/info/exclude

@@ -1,6 +0,0 @@
-# git ls-files --others --exclude-from=.git/info/exclude
-# Lines that start with '#' are comments.
-# For a project mostly in C, the following would be a good set of
-# exclude patterns (uncomment them if you want to use them):
-# *.[oa]
-# *~

+ 0 - 2
test_data/test_repos/test_repo_1/dotGit/logs/HEAD

@@ -1,2 +0,0 @@
-0000000000000000000000000000000000000000 6557c92612d3b35979bd426d429255b3bf9fab74 zach rice <zricer@protonmail.com> 1571923767 -0400	commit (initial): commit 1 with secrets
-6557c92612d3b35979bd426d429255b3bf9fab74 d274003914c707212cbe84e3e466a00013ccb639 zach rice <zricer@protonmail.com> 1571925818 -0400	commit: comment

+ 0 - 2
test_data/test_repos/test_repo_1/dotGit/logs/refs/heads/master

@@ -1,2 +0,0 @@
-0000000000000000000000000000000000000000 6557c92612d3b35979bd426d429255b3bf9fab74 zach rice <zricer@protonmail.com> 1571923767 -0400	commit (initial): commit 1 with secrets
-6557c92612d3b35979bd426d429255b3bf9fab74 d274003914c707212cbe84e3e466a00013ccb639 zach rice <zricer@protonmail.com> 1571925818 -0400	commit: comment

binární
test_data/test_repos/test_repo_1/dotGit/objects/10/fa14c5ab0134436e2ae435138bf921eb477c60


binární
test_data/test_repos/test_repo_1/dotGit/objects/3a/76f3781306faf5612017bf18a4b4bdb9f927bf


binární
test_data/test_repos/test_repo_1/dotGit/objects/41/42082bcb939bbc17985a69ba748491ac6b62a5


binární
test_data/test_repos/test_repo_1/dotGit/objects/49/8b267a8c7812490d6479839c5577eaaec79d62


binární
test_data/test_repos/test_repo_1/dotGit/objects/60/c9e47f150a6b713e247e6105b77f1b961f844f


binární
test_data/test_repos/test_repo_1/dotGit/objects/61/87dbf4390fc6e28445dd3d988aefb9d1111988


binární
test_data/test_repos/test_repo_1/dotGit/objects/65/57c92612d3b35979bd426d429255b3bf9fab74


binární
test_data/test_repos/test_repo_1/dotGit/objects/6a/756416384c210ada2631f17862f5c01fffa478


binární
test_data/test_repos/test_repo_1/dotGit/objects/6c/9406b7d9320db083eca69b3f8bee9a6c7b50d4


binární
test_data/test_repos/test_repo_1/dotGit/objects/6c/bef5c370d8c3486ca85423dd70440c5e0a2aa2


binární
test_data/test_repos/test_repo_1/dotGit/objects/80/8b12c5ca4b142367932e7045d555a639fc148c


binární
test_data/test_repos/test_repo_1/dotGit/objects/80/ba94135cc378364af9d3cb2450df48e51faf2c


+ 0 - 3
test_data/test_repos/test_repo_1/dotGit/objects/9e/523225b31add24e72f2feb0b2645cfb36542dc

@@ -1,3 +0,0 @@
-xMŽO‚@Ĺ;ď§č`‘%:XjE	˘<Éş;�¤»°ł~űĚ
-z§÷`~ďMVęFţ´Ó…P�ŇnÜHZ"�•-xIL”Eca™¶Ú÷>±Ç ‘Cľă¶®«,�¬)TNŔéżČm7
-]U¨$JŻ%ů“R.Ąw¬ÓBÎś`łÖ‡q|÷űIt
vÇmôÝy_6ďŮ?¨!ć‹0Šb´ťÔW\>ε9ć	…ęr:-†Aň+a}Ć^K§N$

+ 0 - 3
test_data/test_repos/test_repo_1/dotGit/objects/a1/fd29ec14823d8bc4a8d1a2cfe35451580f5118

@@ -1,3 +0,0 @@
-xuPMOÃ0åÚüŠGV1lc.LEB`†Ä¸!Miç*a]R5!þ;N‡øââÄö{ÏÏÎ+—ãìôt§³;Ì�z-:¢ƒKzQ«º"hç–ðEcê€à°RKÂÚ\‰zí5\Œ³~À¬™¦/š7Ì~Ú‘‡ªª_h­|PMÀÆ�næªXf]Rv�†ž¨ßTVÙh²Ì$ÈmSþÔ„ñÑׂ�D+dUÎþƒæF\âˆ%­Z}VJ{²n¨ßPAæ™ä@S"�è[Èôz2›ß=Üß̧w³Éôv~5}¸�IÁ¬HLv,’�nu"C¦F¢_ÅÏ?¼dáD’гª 9¬){üeÆŠ/,Ó$axZòu ƒgm
-‹(·jÏòc•~Üøé[+Ñ9ÈÞ%.öN"s<æ¸=àVéÅŒâ¯
-~L–îïbÔãþÂY¥eMª$

binární
test_data/test_repos/test_repo_1/dotGit/objects/a4/fa2187727281aea78d7c3aaebdb4b924fc4e4d


+ 0 - 1
test_data/test_repos/test_repo_1/dotGit/objects/a5/196d1be8fb59edf8062bef36d3a602e0812139

@@ -1 +0,0 @@
-x-�±jÃ0„;ç)<¤
µSJ§B¦@¦¾Aé Û¿lI¤_¸Yú쑃·ãø¾»Þ³ÇûÇÛSƒÉ)|n­ó’ѶÔYÒäoðe”Ö&†SW©£‹–Ç­Þ5ør±:EV“‹Óûf“C�¨¹«ä…	×Ä_�Yý
.âüZu�¥÷\\œ°°ø½Tz"GdQÐÖ…íW£*)f<—¸=¬ÎâÆ‚ÅD…%Ë£ù¬ò¡û¦ùYÃÿîá›SC

binární
test_data/test_repos/test_repo_1/dotGit/objects/a5/d7b84a673458d14d9aab082183a1968c2c7492


binární
test_data/test_repos/test_repo_1/dotGit/objects/b5/8d1184a9d43a39c0d95f32453efc78581877d6


binární
test_data/test_repos/test_repo_1/dotGit/objects/c9/8e6c52cbd1f50de572ff12a3441271fccff705


binární
test_data/test_repos/test_repo_1/dotGit/objects/cb/089cd89a7d7686d284d8761201649346b5aa1c


+ 0 - 2
test_data/test_repos/test_repo_1/dotGit/objects/cb/19a50e8cdeb7011eccdb13f3b739f00d775bab

@@ -1,2 +0,0 @@
-x��Í
-1„½êS䨥MÚf+"¾J“­XØY‚OïŠ^¼íÀ00‡áéFB\™…‚à=kÄ`±%!9Jë0ÌŽè½�\ã5	;x%½ÁT4Ãéõ‰érŸÆ:}*ÝAÇþÖ³�HöƳžÛ¾TØ–¡Ô’ºÝ~�…g©7xd�r}l3´Èó.Eë”
£E•ܸLÙ…�æÇ–T%P\ëÛüÁ~óP7oq,\é

binární
test_data/test_repos/test_repo_1/dotGit/objects/d2/74003914c707212cbe84e3e466a00013ccb639


binární
test_data/test_repos/test_repo_1/dotGit/objects/e6/73bb3980f3c286291809e05f80873852bc3e9c


binární
test_data/test_repos/test_repo_1/dotGit/objects/e9/e5396f7e52aa48de485b4836ebb041cc7f7c46


+ 0 - 2
test_data/test_repos/test_repo_1/dotGit/objects/ec/17ec1939b7c3e86b7cb6c0c4de6b0818a7e75e

@@ -1,2 +0,0 @@
-x-ÍK‚0P×9E[�r§Kïà&0H
-Ȥ&ƒ…·7~–Ý]õÚ/âq¾\õ±ó!vyrµ«q‹à�Ö´0&‘¹×�&Hʉ”AHÔÏ< dÉÁD_E±e†<Y2l«‡)ÅœD-·_ù.àH¾À6…üÕOň´þ›1|6AUXk¶4�qÕ:Ç;÷xïj2k¹iBŽvÐBü

binární
test_data/test_repos/test_repo_1/dotGit/objects/fe/f3190e94723e78847ab9f0daaa15add4ffd4ef


+ 0 - 1
test_data/test_repos/test_repo_1/dotGit/refs/heads/master

@@ -1 +0,0 @@
-d274003914c707212cbe84e3e466a00013ccb639

+ 0 - 9
test_data/test_repos/test_repo_1/server.test.py

@@ -1,9 +0,0 @@
-# Do not hard code credentials
-client = boto3.client(
-    's3',
-    # Hard coded strings as credentials, not recommended.
-    aws_access_key_id='AKIAIO5FODNN7EXAMPLE',
-    aws_secret_access_key='ABCDEF+c2L7yXeGvUyrPgYsDnWRRC1AYEXAMPLE'
-)
-
-# adding another line

+ 0 - 1
test_data/test_repos/test_repo_10/.gitignore

@@ -1 +0,0 @@
-a dot git ignore file

+ 0 - 11
test_data/test_repos/test_repo_10/.gitleaks.toml

@@ -1,11 +0,0 @@
-[[rules]]
-	description = "Block dangerous filetypes"
-	file = '''(.*?)(pdf|doc|docx|zip|xls|tfplan|tfstate|tfvars|vault_pass|vagrant|pyc|key|cache)$'''
-	tags = ["key", "extensions"]
-	[rules.allowlist]
-		paths = ['''.git''', '''.zip''']
-		description = "ignore known locations and files"
-
-[allowlist]
-	description = "Allowlisted files"
-	paths = ['''.zip''']

+ 0 - 1
test_data/test_repos/test_repo_10/README.md

@@ -1 +0,0 @@
-# test_repo_paths

+ 0 - 1
test_data/test_repos/test_repo_10/bad.zip

@@ -1 +0,0 @@
-this is a bad .zip

+ 0 - 0
test_data/test_repos/test_repo_10/creds.git


+ 0 - 1
test_data/test_repos/test_repo_10/dotGit/HEAD

@@ -1 +0,0 @@
-ref: refs/heads/main

+ 0 - 0
test_data/test_repos/test_repo_10/dotGit/bad.zip


binární
test_data/test_repos/test_repo_10/dotGit/index


+ 0 - 6
test_data/test_repos/test_repo_10/dotGit/info/exclude

@@ -1,6 +0,0 @@
-# git ls-files --others --exclude-from=.git/info/exclude
-# Lines that start with '#' are comments.
-# For a project mostly in C, the following would be a good set of
-# exclude patterns (uncomment them if you want to use them):
-# *.[oa]
-# *~

+ 0 - 1
test_data/test_repos/test_repo_10/dotGit/logs/HEAD

@@ -1 +0,0 @@
-0000000000000000000000000000000000000000 5cd9652a24771400b4ce76beadbb2496a73341b8 Zach Rice <zrice@gitlab.com> 1607529853 -0500	clone: from github.com:zricethezav/test_repo_paths.git

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů