Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
Add ScanChunk to allow injecting Chunks into the SourceManager's channel (#1634)
Miccahfae54c7ffa90
diff --git a/pkg/engine/engine.go b/pkg/engine/engine.goindex 04938cd51..3489d980d 100644--- a/pkg/engine/engine.go+++ b/pkg/engine/engine.go@@ -415,6 +415,13 @@ func (e *Engine) ResultsChan() chan detectors.ResultWithMetadata {return e.results}+// ScanChunk injects a chunk into the output stream of chunks to be scanned.+// This method should rarely be used. TODO: Remove when dependencies no longer+// rely on this functionality.+func (e *Engine) ScanChunk(chunk *sources.Chunk) {+ e.sourceManager.ScanChunk(chunk)+}+// detectableChunk is a decoded chunk that is ready to be scanned by its detector.type detectableChunk struct {detector detectors.Detectordiff --git a/pkg/sources/source_manager.go b/pkg/sources/source_manager.goindex 0528e9b04..923f04648 100644--- a/pkg/sources/source_manager.go+++ b/pkg/sources/source_manager.go@@ -191,6 +191,13 @@ func (s *SourceManager) Wait() error {return s.pool.Wait()}+// ScanChunk injects a chunk into the output stream of chunks to be scanned.+// This method should rarely be used. TODO: Remove when dependencies no longer+// rely on this functionality.+func (s *SourceManager) ScanChunk(chunk *Chunk) {+ s.outputChunks <- chunk+}+// preflightChecks is a helper method to check the Manager or the context isn't// done and that the handle is valid.func (s *SourceManager) preflightChecks(ctx context.Context, handle handle) error {