From 93d5a6746a73759feca6bbbdcec4ab9e64b0d433 Mon Sep 17 00:00:00 2001 From: Richard Gomez Date: Mon, 17 Jun 2024 19:45:04 -0400 Subject: [PATCH] custom(engine): dedupe results --- pkg/engine/engine.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index d4af8d5a2ffe..12799ee97792 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -1192,9 +1192,8 @@ func (e *Engine) notifierWorker(ctx context.Context) { // Duplicate results with the same decoder type SHOULD have their own entry in the // results list, this would happen if the same secret is found multiple times. // Note: If the source type is postman, we dedupe the results regardless of decoder type. - key := fmt.Sprintf("%s%s%s%+v", result.DetectorType.String(), result.Raw, result.RawV2, result.SourceMetadata) - if val, ok := e.dedupeCache.Get(key); ok && (val != result.DecoderType || - result.SourceType == sourcespb.SourceType_SOURCE_TYPE_POSTMAN) { + key := fmt.Sprintf("%s%s%s%t", result.DetectorName, result.Raw, result.RawV2, result.Verified) + if _, ok := e.dedupeCache.Get(key); ok { continue } e.dedupeCache.Add(key, result.DecoderType)