Skip to content

AAK-SECRET-003: AWS credentials exposed

Severity
CRITICAL
Category
Secret Exposure (secret-exposure)
Scanner
agent_audit_kit/scanners/secret_exposure.py
Auto-fixable
No.
SARIF name
AwsCredentialsExposed

What it detects

AWS access key ID or secret access key found in a project file.

How to fix

Delete the access key from the file and deactivate or rotate it in IAM, since it is exposed once committed. Then use an IAM role, AWS SSO or a secrets manager so that no static key is needed.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-SECRET-003

Limitations

Looks for an AKIA access key ID and for a secret key written as the lower-case assignment aws_secret_access_key = <40 characters>. The same secret as the upper-case environment variable, AWS_SECRET_ACCESS_KEY=<40 characters>, is not reported, so a file that holds the secret without its key ID is missed. In Markdown, a key shaped like a documentation stand-in (one repeated character after the prefix, a run of x, REPLACE, YOUR, EXAMPLE, PLACEHOLDER or CHANGEME in it, or the AWS IAM User Guide's example key) is skipped. A file over 1,000,000 bytes is not read.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-SECRET-003.md: the page then shows that text, with the registry reference appended under it.