Secrets Manager secrets must have automatic rotation enabled Affecting Secrets Manager service in AWS


Severity

0.0
medium
0
10
Severity Framework
Snyk CCSS
Rule category
Keys and Secrets/ Lifecycle

Is your environment affected by this misconfiguration?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
Frameworks
  • Snyk IDSNYK-CC-00750
  • creditSnyk Research Team

Description

Disabling or not configuring automatic rotation for Secrets Manager secrets can lead to the use of outdated credentials, increasing the risk of unauthorized access due to potential credential leakage or compromise. Enabling automatic rotation helps maintain security by regularly changing access credentials without manual intervention, thus reducing the window of opportunity for an attacker to use stolen or leaked credentials.

How to fix?

Use the aws_secretsmanager_secret_rotation resource and specify either the automatically_after_days or schedule_expression parameter.

Example configuration:

resource "aws_secretsmanager_secret_rotation" "example_rotation" {
  secret_id           = aws_secretsmanager_secret.example.id
  rotation_lambda_arn = aws_lambda_function.rotation_lambda.arn

  rotation_rules {
    automatically_after_days = 30
    schedule_expression      = "rate(1 day)"
  }
}