From e93a7c0d2604fd1bcc43ac9cac6144a62387a8a4 Mon Sep 17 00:00:00 2001 From: Dewan Ishtiaque Ahmed <30604461+dewan-ahmed@users.noreply.github.com> Date: Wed, 11 Sep 2024 21:48:12 -0300 Subject: [PATCH] Update Harness rules to add _ and - in the account ID part. (#1503) --- cmd/generate/config/rules/harness.go | 5 +++-- config/gitleaks.toml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/generate/config/rules/harness.go b/cmd/generate/config/rules/harness.go index 3e4f96c1..4994dfcc 100644 --- a/cmd/generate/config/rules/harness.go +++ b/cmd/generate/config/rules/harness.go @@ -1,9 +1,10 @@ package rules import ( - "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "regexp" + "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" + "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/config" ) @@ -13,7 +14,7 @@ func HarnessApiKey() *config.Rule { r := config.Rule{ Description: "Identified a Harness Access Token (PAT or SAT), risking unauthorized access to a Harness account.", RuleID: "harness-api-key", - Regex: regexp.MustCompile(`(?:pat|sat)\.[a-zA-Z0-9]{22}\.[a-zA-Z0-9]{24}\.[a-zA-Z0-9]{20}`), + Regex: regexp.MustCompile(`(?:pat|sat)\.[a-zA-Z0-9_-]{22}\.[a-zA-Z0-9]{24}\.[a-zA-Z0-9]{20}`), Keywords: []string{"pat.", "sat."}, } diff --git a/config/gitleaks.toml b/config/gitleaks.toml index 922d5c00..6c3e2fdc 100644 --- a/config/gitleaks.toml +++ b/config/gitleaks.toml @@ -2098,7 +2098,7 @@ keywords = [ [[rules]] id = "harness-api-key" description = "Identified a Harness Access Token (PAT or SAT), risking unauthorized access to a Harness account." -regex = '''(?:pat|sat)\.[a-zA-Z0-9]{22}\.[a-zA-Z0-9]{24}\.[a-zA-Z0-9]{20}''' +regex = '''(?:pat|sat)\.[a-zA-Z0-9_-]{22}\.[a-zA-Z0-9]{24}\.[a-zA-Z0-9]{20}''' keywords = [ "pat.","sat.", ]