mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 12:14:22 +01:00
* 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
28 lines
624 B
Go
28 lines
624 B
Go
package rules
|
|
|
|
import (
|
|
"regexp"
|
|
|
|
"github.com/zricethezav/gitleaks/v8/config"
|
|
)
|
|
|
|
func AWS() *config.Rule {
|
|
// define rule
|
|
r := config.Rule{
|
|
Description: "Identified a pattern that may indicate AWS credentials, risking unauthorized cloud resource access and data breaches on AWS platforms.",
|
|
RuleID: "aws-access-token",
|
|
Regex: regexp.MustCompile(
|
|
"(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}"),
|
|
Keywords: []string{
|
|
"AKIA",
|
|
"ASIA",
|
|
"ABIA",
|
|
"ACCA",
|
|
},
|
|
}
|
|
|
|
// validate
|
|
tps := []string{generateSampleSecret("AWS", "AKIALALEMEL33243OLIB")} // gitleaks:allow
|
|
return validate(r, tps, nil)
|
|
}
|