|
|
@@ -441,6 +441,16 @@ func TestScan(t *testing.T) {
|
|
|
},
|
|
|
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{
|
|
|
@@ -464,27 +474,63 @@ func TestScan(t *testing.T) {
|
|
|
wantPath: "../test_data/test_allow_list_docx_no_git.json",
|
|
|
},
|
|
|
{
|
|
|
- description: "test local repo two allowlist Commit config",
|
|
|
+ description: "test append repo config",
|
|
|
opts: options.Options{
|
|
|
- Path: "../test_data/test_repos/test_repo_2",
|
|
|
- Report: "../test_data/test_local_repo_two_allowlist_commits_files_at_commit.json.got",
|
|
|
- ConfigPath: "../test_data/test_configs/allowlist_commit.toml",
|
|
|
- ReportFormat: "json",
|
|
|
- FilesAtCommit: "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
|
|
+ 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",
|
|
|
},
|
|
|
- wantPath: "../test_data/test_local_repo_two_allowlist_commits_files_at_commit.json",
|
|
|
wantEmpty: true,
|
|
|
},
|
|
|
{
|
|
|
- description: "test local repo two global allowlist commit config",
|
|
|
+ description: "test append repo config with additional config",
|
|
|
opts: options.Options{
|
|
|
- Path: "../test_data/test_repos/test_repo_2",
|
|
|
- Report: "../test_data/test_local_repo_two_global_allowlist_files_at_commit.json.got",
|
|
|
- ConfigPath: "../test_data/test_configs/allowlist_global_files.toml",
|
|
|
- ReportFormat: "json",
|
|
|
- FilesAtCommit: "17471a5fda722a9e423f1a0d3f0d267ea009d41c",
|
|
|
+ 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",
|
|
|
},
|
|
|
- wantPath: "../test_data/test_local_repo_two_global_allowlist_files_at_commit.json",
|
|
|
wantEmpty: true,
|
|
|
},
|
|
|
}
|