mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 20:54:22 +01:00
Merge branch 'master' of github.com:gitleaks/gitleaks into archive-handling
This commit is contained in:
commit
56e409d9f1
85 files changed
+2603
-1239
No files matched your search
+12
-5
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/fatih/semgroup"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"github.com/zricethezav/gitleaks/v8/logging"
|
||||
)
|
||||
|
||||
@@ -29,7 +30,7 @@ type ScanTarget struct {
|
||||
|
||||
var isWindows = runtime.GOOS == "windows"
|
||||
|
||||
func DirectoryTargets(source string, s *semgroup.Group, followSymlinks bool, shouldSkip func(string) bool) (<-chan ScanTarget, error) {
|
||||
func DirectoryTargets(source string, s *semgroup.Group, followSymlinks bool, allowlists []*config.Allowlist) (<-chan ScanTarget, error) {
|
||||
paths := make(chan ScanTarget)
|
||||
s.Go(func() error {
|
||||
defer close(paths)
|
||||
@@ -77,10 +78,16 @@ func DirectoryTargets(source string, s *semgroup.Group, followSymlinks bool, sho
|
||||
}
|
||||
|
||||
// TODO: Also run this check against the resolved symlink?
|
||||
skip := shouldSkip(path) ||
|
||||
// TODO: Remove this in v9.
|
||||
// This is an awkward hack to mitigate https://github.com/gitleaks/gitleaks/issues/1641.
|
||||
(isWindows && shouldSkip(filepath.ToSlash(path)))
|
||||
var skip bool
|
||||
for _, a := range allowlists {
|
||||
skip = a.PathAllowed(path) ||
|
||||
// TODO: Remove this in v9.
|
||||
// This is an awkward hack to mitigate https://github.com/gitleaks/gitleaks/issues/1641.
|
||||
(isWindows && a.PathAllowed(filepath.ToSlash(path)))
|
||||
if skip {
|
||||
break
|
||||
}
|
||||
}
|
||||
if fInfo.IsDir() {
|
||||
// Directory
|
||||
if skip {
|
||||
|
||||
Reference in new issue
Block a user