AWS credentials are built from a fixed access key and secret, which stay valid until someone revokes them

tx0/java:static-aws-key-pairrecommendedwarningsecurity/secretsdepth fastsecurity, cwe-798

What it finds

An access key with its secret works for anyone who has it, for as long as it exists. Roles, instance profiles and session credentials expire on their own and are not kept in code or configuration.

Reported is AwsBasicCredentials.create and new BasicAWSCredentials(...).

From the rule's source, long_term_aws_credentials.rs.

Example from the rule's tests
class Creds {  void run(String id, String secret) {    Object a = AwsBasicCredentials.create(id, secret);tx0 reports: stay valid until revoked    Object b = new BasicAWSCredentials(id, secret);tx0 reports: stay valid until revoked  }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

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:

tx0.toml
[rules]
"tx0/java:static-aws-key-pair" = "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/java:static-aws-key-pair] reason="..."

tx0 explain tx0/java:static-aws-key-pair shows the same in the terminal. Found a false positive? Report it.