mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 05:24:22 +01:00
Remove IAM identifiers for non-credential resources in the aws-access-token rule (#1307)
* Remove IAM identifiers for non-credential resources Only detects: AWS STS service bearer token Context-specific credential Access key Temporary (AWS STS) access key IDs use this prefix, but are unique only in combination with the secret access key and the session token. * Update gitleaks.toml * Update testdata * Update tests
This commit is contained in:
1 parent
afe046b3b4
commit
76c9e3175b
10 files changed
+16
-20
No files matched your search
@@ -12,16 +12,12 @@ func AWS() *config.Rule {
|
|||||||
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.",
|
||||||
RuleID: "aws-access-token",
|
RuleID: "aws-access-token",
|
||||||
Regex: regexp.MustCompile(
|
Regex: regexp.MustCompile(
|
||||||
"(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
"(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}"),
|
||||||
Keywords: []string{
|
Keywords: []string{
|
||||||
"AKIA",
|
"AKIA",
|
||||||
"AGPA",
|
|
||||||
"AIDA",
|
|
||||||
"AROA",
|
|
||||||
"AIPA",
|
|
||||||
"ANPA",
|
|
||||||
"ANVA",
|
|
||||||
"ASIA",
|
"ASIA",
|
||||||
|
"ABIA",
|
||||||
|
"ACCA",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ func TestTranslate(t *testing.T) {
|
|||||||
cfg: Config{
|
cfg: Config{
|
||||||
Rules: map[string]Rule{"aws-access-key": {
|
Rules: map[string]Rule{"aws-access-key": {
|
||||||
Description: "AWS Access Key",
|
Description: "AWS Access Key",
|
||||||
Regex: regexp.MustCompile("(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
Regex: regexp.MustCompile("(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}"),
|
||||||
Tags: []string{"key", "AWS"},
|
Tags: []string{"key", "AWS"},
|
||||||
Keywords: []string{},
|
Keywords: []string{},
|
||||||
RuleID: "aws-access-key",
|
RuleID: "aws-access-key",
|
||||||
@@ -41,7 +41,7 @@ func TestTranslate(t *testing.T) {
|
|||||||
cfg: Config{
|
cfg: Config{
|
||||||
Rules: map[string]Rule{"aws-access-key": {
|
Rules: map[string]Rule{"aws-access-key": {
|
||||||
Description: "AWS Access Key",
|
Description: "AWS Access Key",
|
||||||
Regex: regexp.MustCompile("(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
Regex: regexp.MustCompile("(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}"),
|
||||||
Tags: []string{"key", "AWS"},
|
Tags: []string{"key", "AWS"},
|
||||||
Keywords: []string{},
|
Keywords: []string{},
|
||||||
RuleID: "aws-access-key",
|
RuleID: "aws-access-key",
|
||||||
@@ -57,7 +57,7 @@ func TestTranslate(t *testing.T) {
|
|||||||
cfg: Config{
|
cfg: Config{
|
||||||
Rules: map[string]Rule{"aws-access-key": {
|
Rules: map[string]Rule{"aws-access-key": {
|
||||||
Description: "AWS Access Key",
|
Description: "AWS Access Key",
|
||||||
Regex: regexp.MustCompile("(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
Regex: regexp.MustCompile("(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}"),
|
||||||
Tags: []string{"key", "AWS"},
|
Tags: []string{"key", "AWS"},
|
||||||
Keywords: []string{},
|
Keywords: []string{},
|
||||||
RuleID: "aws-access-key",
|
RuleID: "aws-access-key",
|
||||||
@@ -97,7 +97,7 @@ func TestTranslate(t *testing.T) {
|
|||||||
Rules: map[string]Rule{
|
Rules: map[string]Rule{
|
||||||
"aws-access-key": {
|
"aws-access-key": {
|
||||||
Description: "AWS Access Key",
|
Description: "AWS Access Key",
|
||||||
Regex: regexp.MustCompile("(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
Regex: regexp.MustCompile("(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}"),
|
||||||
Tags: []string{"key", "AWS"},
|
Tags: []string{"key", "AWS"},
|
||||||
Keywords: []string{},
|
Keywords: []string{},
|
||||||
RuleID: "aws-access-key",
|
RuleID: "aws-access-key",
|
||||||
|
|||||||
@@ -124,9 +124,9 @@ 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|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
regex = '''(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}'''
|
||||||
keywords = [
|
keywords = [
|
||||||
"akia","agpa","aida","aroa","aipa","anpa","anva","asia",
|
"akia","asia","abia","acca",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
|||||||
Vendored
+1
-1
@@ -3,7 +3,7 @@ title = "simple config with allowlist for aws"
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
description = "AWS Access Key"
|
description = "AWS Access Key"
|
||||||
id = "aws-access-key"
|
id = "aws-access-key"
|
||||||
regex = '''(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
regex = '''(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}'''
|
||||||
tags = ["key", "AWS"]
|
tags = ["key", "AWS"]
|
||||||
[rules.allowlist]
|
[rules.allowlist]
|
||||||
regexes = ['''AKIALALEMEL33243OLIA''']
|
regexes = ['''AKIALALEMEL33243OLIA''']
|
||||||
Vendored
+1
-1
@@ -3,7 +3,7 @@ title = "simple config with allowlist for a specific commit"
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
description = "AWS Access Key"
|
description = "AWS Access Key"
|
||||||
id = "aws-access-key"
|
id = "aws-access-key"
|
||||||
regex = '''(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
regex = '''(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}'''
|
||||||
tags = ["key", "AWS"]
|
tags = ["key", "AWS"]
|
||||||
[rules.allowlist]
|
[rules.allowlist]
|
||||||
commits = ['''allowthiscommit''']
|
commits = ['''allowthiscommit''']
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
description = "AWS Access Key"
|
description = "AWS Access Key"
|
||||||
id = "aws-access-key"
|
id = "aws-access-key"
|
||||||
regex = '''(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
regex = '''(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}'''
|
||||||
tags = ["key", "AWS"]
|
tags = ["key", "AWS"]
|
||||||
|
|
||||||
[allowlist]
|
[allowlist]
|
||||||
|
|||||||
Vendored
+1
-1
@@ -3,7 +3,7 @@ title = "simple config with allowlist for .go files"
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
description = "AWS Access Key"
|
description = "AWS Access Key"
|
||||||
id = "aws-access-key"
|
id = "aws-access-key"
|
||||||
regex = '''(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
regex = '''(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}'''
|
||||||
tags = ["key", "AWS"]
|
tags = ["key", "AWS"]
|
||||||
[rules.allowlist]
|
[rules.allowlist]
|
||||||
paths = ['''.go''']
|
paths = ['''.go''']
|
||||||
Vendored
+1
-1
@@ -6,5 +6,5 @@ path="../testdata/config/extend_2.toml"
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
description = "AWS Access Key"
|
description = "AWS Access Key"
|
||||||
id = "aws-access-key"
|
id = "aws-access-key"
|
||||||
regex = '''(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
regex = '''(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}'''
|
||||||
tags = ["key", "AWS"]
|
tags = ["key", "AWS"]
|
||||||
Vendored
+1
-1
@@ -4,7 +4,7 @@ title = "gitleaks config"
|
|||||||
[[rules]]
|
[[rules]]
|
||||||
description = "AWS Access Key"
|
description = "AWS Access Key"
|
||||||
id = "aws-access-key"
|
id = "aws-access-key"
|
||||||
regex = '''(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
regex = '''(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}'''
|
||||||
tags = ["key", "AWS"]
|
tags = ["key", "AWS"]
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
"id": "aws-access-key",
|
"id": "aws-access-key",
|
||||||
"name": "AWS Access Key",
|
"name": "AWS Access Key",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"
|
"text": "(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user