Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
Include the job ID in a chunk (#1652)
ahrav9ae72308bed9
diff --git a/pkg/sources/source_manager.go b/pkg/sources/source_manager.goindex c1c9c3a34..a890b64fd 100644--- a/pkg/sources/source_manager.go+++ b/pkg/sources/source_manager.go@@ -6,10 +6,11 @@ import ("sync/atomic""time"+ "golang.org/x/sync/errgroup"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/context""github.com/trufflesecurity/trufflehog/v3/pkg/pb/sourcespb"- "golang.org/x/sync/errgroup")// handle uniquely identifies a Source given to the manager to manage. If the@@ -255,6 +256,7 @@ func (s *SourceManager) runWithoutUnits(ctx context.Context, handle handle, sourgo func() {defer wg.Done()for chunk := range ch {+ chunk.JobID = source.JobID()report.ReportChunk(nil, chunk)s.outputChunks <- chunk}@@ -334,6 +336,9 @@ func (s *SourceManager) runWithUnits(ctx context.Context, handle handle, sourcedefer wg.Done()defer func() { report.EndUnitChunking(unit, time.Now()) }()for chunk := range chunkReporter.chunkCh {+ if src, ok := source.(Source); ok {+ chunk.JobID = src.JobID()+ }s.outputChunks <- chunk}}()diff --git a/pkg/sources/sources.go b/pkg/sources/sources.goindex 474de2434..07da7ccaf 100644--- a/pkg/sources/sources.go+++ b/pkg/sources/sources.go@@ -17,6 +17,8 @@ type Chunk struct {SourceName string// SourceID is the ID of the source that the Chunk originated from.SourceID int64+ // JobID is the ID of the job that the Chunk originated from.+ JobID int64// SourceType is the type of Source that produced the chunk.SourceType sourcespb.SourceType// SourceMetadata holds the context of where the Chunk was found.