mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 13:14:22 +01:00
feat(dir): continue on permission error (#1621)
This commit is contained in:
1 parent
202106a190
commit
c1add1d268
2 files changed
+12
-1
No files matched your search
+5
-1
@@ -15,9 +15,13 @@ func (d *Detector) DetectFiles(paths <-chan sources.ScanTarget) ([]report.Findin
|
||||
for pa := range paths {
|
||||
d.Sema.Go(func() error {
|
||||
logger := log.With().Str("path", pa.Path).Logger()
|
||||
log.Trace().Msgf("Scanning path: %s", pa)
|
||||
logger.Trace().Msg("Scanning path")
|
||||
f, err := os.Open(pa.Path)
|
||||
if err != nil {
|
||||
if os.IsPermission(err) {
|
||||
logger.Warn().Msg("Skipping file: permission denied")
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
Reference in new issue
Block a user