fix(dir): skip opening file&dir if allowlist matches (#1653)

This commit is contained in:
Richard Gomez authored and GitHub committed 2024-12-05 08:35:42 -06:00
1 parent 6018012b7e
commit ed205a5f63
7 files changed
+82 -50

No files matched your search

+10 -1
View File
@@ -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)
}