Skip to content

Find, verify, and analyze leaked credentials

Update AWS prefixes

Dustin Deckerb2a9d5b0a939
diff --git a/pkg/detectors/aws/aws.go b/pkg/detectors/aws/aws.go
index 703d72aca..55fa27942 100644
--- a/pkg/detectors/aws/aws.go
+++ b/pkg/detectors/aws/aws.go
@@ -19,15 +19,28 @@ type Scanner struct{}
var _ detectors.Detector = (*Scanner)(nil)
var (
- // TODO: Support other key types https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-unique-ids
- keyPat = regexp.MustCompile(`\b(AKIA[0-9A-Z]{16})\b`)
+ // Key types are from this list https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-unique-ids
+ keyPat = regexp.MustCompile(`\b((AKIA|ABIA|ACCA|AGPA|AIDA|AIPA|ANPA|ANVA|APKA|AROA|ASCA|ASIA)[0-9A-Z]{16})\b`)
secretPat = regexp.MustCompile(`\b([A-Za-z0-9+/]{40})\b`)
)
// Keywords are used for efficiently pre-filtering chunks.
// Use identifiers in the secret preferably, or the provider name.
func (s Scanner) Keywords() []string {
- return []string{"AKI"}
+ return []string{
+ "AKIA",
+ "ABIA",
+ "ACCA",
+ "AGPA",
+ "AIDA",
+ "AIPA",
+ "ANPA",
+ "ANVA",
+ "APKA",
+ "AROA",
+ "ASCA",
+ "ASIA",
+ }
}
func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) ([]detectors.Result, error) {