Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
[fixup] - skip files in the archive handler (#2195)
ahrav331336dc0a60
diff --git a/pkg/handlers/archive.go b/pkg/handlers/archive.goindex 6052f53c7..e8a4a9fe5 100644--- a/pkg/handlers/archive.go+++ b/pkg/handlers/archive.go@@ -109,6 +109,7 @@ func (a *Archive) openArchive(ctx context.Context, depth int, reader io.Reader,switch archive := format.(type) {case archiver.Decompressor:info := decompressorInfo{depth: depth, reader: arReader, archiveChan: archiveChan, archiver: archive}+return a.handleDecompressor(ctx, info)case archiver.Extractor:return archive.Extract(context.WithValue(ctx, depthKey, depth+1), reader, nil, a.extractorHandler(archiveChan))@@ -142,8 +143,7 @@ func (a *Archive) handleDecompressor(ctx context.Context, info decompressorInfo)if err != nil {return err}- newReader := bytes.NewReader(fileBytes)- return a.openArchive(ctx, info.depth+1, newReader, info.archiveChan)+ return a.openArchive(ctx, info.depth+1, bytes.NewReader(fileBytes), info.archiveChan)}// IsFiletype returns true if the provided reader is an archive.@@ -176,13 +176,17 @@ func (a *Archive) extractorHandler(archiveChan chan []byte) func(context.Contextif err != nil {return err}+ if common.SkipFile(f.Name()) {+ logger.V(5).Info("skipping file", "filename", f.Name())+ return nil+ }+fileBytes, err := a.ReadToMax(ctx, fReader)if err != nil {return err}- fileContent := bytes.NewReader(fileBytes)- err = a.openArchive(ctx, depth, fileContent, archiveChan)+ err = a.openArchive(ctx, depth, bytes.NewReader(fileBytes), archiveChan)if err != nil {return err}