An AWS access key ID or secret access key is written in the source
What it finds
Long-term AWS keys in source code end up in repositories, logs and packages, where they are found and abused within minutes of a leak. Roles, instance profiles or the credential chain provide credentials without them. Checked are literals shaped like access key IDs, and literals given as aws_secret_access_key.
From the rule's source, hardcoded_aws_key.rs.
import boto3 KEY = "AKIAIOSFODNN7EXAMPLE"tx0 reports: an AWS access key ID is written in the sourceclient = boto3.client("s3", aws_secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY")tx0 reports: an AWS secret access keyother = boto3.client("s3", aws_secret_access_key=secret) Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:hardcoded-aws-key" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:hardcoded-aws-key] reason="..."tx0 explain tx0/python:hardcoded-aws-key shows the same in the terminal. Found a false positive? Report it.