mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 13:14:22 +01:00
fix(dir): skip opening file&dir if allowlist matches (#1653)
This commit is contained in:
1 parent
6018012b7e
commit
ed205a5f63
7 files changed
+82
-50
No files matched your search
+10
-1
@@ -45,6 +45,10 @@ func runDirectory(cmd *cobra.Command, args []string) {
|
||||
|
||||
detector := Detector(cmd, cfg, source)
|
||||
|
||||
// set follow symlinks flag
|
||||
if detector.FollowSymlinks, err = cmd.Flags().GetBool("follow-symlinks"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
// set exit code
|
||||
exitCode, err := cmd.Flags().GetInt("exit-code")
|
||||
if err != nil {
|
||||
@@ -52,7 +56,12 @@ func runDirectory(cmd *cobra.Command, args []string) {
|
||||
}
|
||||
|
||||
var paths <-chan sources.ScanTarget
|
||||
paths, err = sources.DirectoryTargets(source, detector.Sema, detector.FollowSymlinks)
|
||||
paths, err = sources.DirectoryTargets(
|
||||
source,
|
||||
detector.Sema,
|
||||
detector.FollowSymlinks,
|
||||
detector.Config.Allowlist.PathAllowed,
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal().Err(err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user