From 5d9f79b0130977a984df8e4e31fdbd26f4d17de9 Mon Sep 17 00:00:00 2001 From: Taylor Date: Thu, 14 Nov 2024 22:06:53 -0800 Subject: [PATCH 1/4] context to artifactory --- detect_secrets/plugins/artifactory.py | 2 +- tests/plugins/artifactory_test.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/detect_secrets/plugins/artifactory.py b/detect_secrets/plugins/artifactory.py index d6c30eae1..f943ae34f 100644 --- a/detect_secrets/plugins/artifactory.py +++ b/detect_secrets/plugins/artifactory.py @@ -13,5 +13,5 @@ class ArtifactoryDetector(RegexBasedDetector): re.compile(r'(?:\s|=|:|"|^)AKC[a-zA-Z0-9]{10,200}(?:\s|"|$)'), # Artifactory encrypted passwords begin with AP[A-Z] # Password: - re.compile(r'(? Date: Thu, 14 Nov 2024 22:10:24 -0800 Subject: [PATCH 2/4] note --- detect_secrets/plugins/artifactory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detect_secrets/plugins/artifactory.py b/detect_secrets/plugins/artifactory.py index f943ae34f..e6eba4b62 100644 --- a/detect_secrets/plugins/artifactory.py +++ b/detect_secrets/plugins/artifactory.py @@ -12,6 +12,6 @@ class ArtifactoryDetector(RegexBasedDetector): # API token: re.compile(r'(?:\s|=|:|"|^)AKC[a-zA-Z0-9]{10,200}(?:\s|"|$)'), # Artifactory encrypted passwords begin with AP[A-Z] - # Password: + # Keyword with Password: re.compile(r'(?i:artif|jfrog|buildkit)(?:.{0,100}\n?){0,2}(?:\s|=|:|"|^)(AP[\dABCDEF][a-zA-Z0-9]{8,200})(?:\s|"|$)'), ] From 26448c926b2c1571239018f2be7b47dea10eaee1 Mon Sep 17 00:00:00 2001 From: Taylor Date: Thu, 14 Nov 2024 22:18:04 -0800 Subject: [PATCH 3/4] Add back negative --- detect_secrets/plugins/artifactory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detect_secrets/plugins/artifactory.py b/detect_secrets/plugins/artifactory.py index f943ae34f..21b591d92 100644 --- a/detect_secrets/plugins/artifactory.py +++ b/detect_secrets/plugins/artifactory.py @@ -13,5 +13,5 @@ class ArtifactoryDetector(RegexBasedDetector): re.compile(r'(?:\s|=|:|"|^)AKC[a-zA-Z0-9]{10,200}(?:\s|"|$)'), # Artifactory encrypted passwords begin with AP[A-Z] # Password: - re.compile(r'(?i:artif|jfrog|buildkit)(?:.{0,100}\n?){0,2}(?:\s|=|:|"|^)(AP[\dABCDEF][a-zA-Z0-9]{8,200})(?:\s|"|$)'), + re.compile(r'(? Date: Sun, 17 Nov 2024 23:17:09 -0800 Subject: [PATCH 4/4] Add another test --- tests/plugins/artifactory_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/plugins/artifactory_test.py b/tests/plugins/artifactory_test.py index 803e9436e..fea1b8184 100644 --- a/tests/plugins/artifactory_test.py +++ b/tests/plugins/artifactory_test.py @@ -9,6 +9,7 @@ class TestArtifactoryDetector: 'payload, should_flag', [ ('artifactory = AP6xxxxxxxxxx', True), + ('artifactory = ap6xxxxxxxxxx', False), ('artif \n key=AP2xxxxxxxxxx', True), ('jfrog AP3xxxxxxxxxx', True), ('jfrog AP5xxxxxxxxxx', True),