فهرست منبع

fix(aws-access-token): only match if correct length (#1584)

Previously, the rule matched for any long string
containing e.g. ASIA, ACCA somewhere,
as long as the next 16 chars were also uppercase letters.

This change checks for word boundaries before and after the secret.

Also the prefix (AKIA|ASIA|...) was moved from the non-capturing group
into the secret matching group,
since it is part of the token

fix(aws-access-token): non-capture for prefix

Review findings https://github.com/gitleaks/gitleaks/pull/1584/files#r1807793907
Ben-grmbl 1 سال پیش
والد
کامیت
a158e4fc15
2فایلهای تغییر یافته به همراه18 افزوده شده و 11 حذف شده
  1. 17 10
      cmd/generate/config/rules/aws.go
  2. 1 1
      config/gitleaks.toml

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 17 - 10
cmd/generate/config/rules/aws.go


+ 1 - 1
config/gitleaks.toml

@@ -153,7 +153,7 @@ keywords = [
 [[rules]]
 [[rules]]
 id = "aws-access-token"
 id = "aws-access-token"
 description = "Identified a pattern that may indicate AWS credentials, risking unauthorized cloud resource access and data breaches on AWS platforms."
 description = "Identified a pattern that may indicate AWS credentials, risking unauthorized cloud resource access and data breaches on AWS platforms."
-regex = '''(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}'''
+regex = '''\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
 entropy = 3
 entropy = 3
 keywords = [
 keywords = [
     "a3t",
     "a3t",

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است