fixing incorrect acct num id for some aws keys (#2332)

This commit is contained in:
joeleonjr 2024-01-23 13:27:50 -05:00 committed by GitHub
parent 443ef98e41
commit 05d189c977
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -61,6 +61,9 @@ func GetAccountNumFromAWSID(AWSID string) (string, error) {
if len(AWSID) < 4 {
return "", fmt.Errorf("AWSID is too short")
}
if AWSID[4] == 'I' || AWSID[4] == 'J' {
return "", fmt.Errorf("Can't get account number from AKIAJ/ASIAJ or AKIAI/ASIAI keys")
}
trimmedAWSID := AWSID[4:]
decodedBytes, err := base32.StdEncoding.WithPadding(base32.NoPadding).DecodeString(strings.ToUpper(trimmedAWSID))
if err != nil {