From a0919f5bf3f873bf3551e35ee17feebb1301443b Mon Sep 17 00:00:00 2001 From: kashif khan Date: Tue, 28 Jan 2025 14:41:51 +0500 Subject: [PATCH] added rgmz suggested regex --- pkg/detectors/uri/uri.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/detectors/uri/uri.go b/pkg/detectors/uri/uri.go index 42b695d9f1e4..1a732222dbad 100644 --- a/pkg/detectors/uri/uri.go +++ b/pkg/detectors/uri/uri.go @@ -30,7 +30,7 @@ var _ interface { } = (*Scanner)(nil) var ( - keyPat = regexp.MustCompile(`\b(?:https?:\/\/)?[\w-\.$~!]{3,50}:([\w-\.%$^&#]{3,50})@[-.\w]+\b`) + keyPat = regexp.MustCompile(`\bhttps?:\/\/[\w!#$%&()*+,\-./;<=>?@[\\\]^_{|}~]{0,50}:([\w!#$%&()*+,\-./:;<=>?[\\\]^_{|}~]{3,50})@[a-zA-Z0-9.-]+(?:\.[a-zA-Z]{2,})?(?:[\d:]{1,5})?\b`) // TODO: make local addr opt-out defaultClient = detectors.DetectorHttpClientWithNoLocalAddresses