-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extract AWS account number from ID without verification #2091
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this also work for short-lived AWS credentials (the kind that use session keys)? We recently added a separate detector for those.
It should. I'm going to move this function into the common lib, so that we can re-use it across that separate detector. |
@ahrav do you mind doing another quick review now that the code has been refactored and moved to utils? |
forgot to reply yesterday, but LGTM! Nice work. |
Description:
Research by Tal Be'ery documented how to extract AWS account numbers from AWS IDs (ex:
AKIASP2TPHJSQH3FJRUX
->171436882533
) without having to interact with the AWS API.I ported his python function to golang, added error handling, updated logic in the
aws.go
file and updated the aws integration tests.Note: if AWS secret verification is successful, the calculated AWS account number gets overwritten by the API's account number response. These values should always be the same.
Also, commented out is a suggestion that we log situations where the calculated account number does not match the API-verified account number. This should rarely (if ever) occur; however, if we can monitor this, that would be helpful to verify accuracy at scale.
Checklist:
make test-community
)?make lint
this requires golangci-lint)?