Skip to content

Find, verify, and analyze leaked credentials

hit em w/ a min (#3316)

Zachary Riceb78be6d935fd
diff --git a/pkg/detectors/openai/openai.go b/pkg/detectors/openai/openai.go
index e4b16c93d..9d81c8e2f 100644
--- a/pkg/detectors/openai/openai.go
+++ b/pkg/detectors/openai/openai.go
@@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
for token := range uniqueMatches {
s1 := detectors.Result{
DetectorType: detectorspb.DetectorType_OpenAI,
- Redacted: token[:3] + "..." + token[47:],
+ Redacted: token[:3] + "..." + token[min(len(token)-1, 47):],
Raw: []byte(token),
}