Skip to content
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

bug: spurious AwsSolutions-SMG4 with aws-cdk-lib >= 2.116.0 #1560

Closed
anentropic opened this issue Jan 12, 2024 · 2 comments
Closed

bug: spurious AwsSolutions-SMG4 with aws-cdk-lib >= 2.116.0 #1560

anentropic opened this issue Jan 12, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@anentropic
Copy link

anentropic commented Jan 12, 2024

What is the problem?

we updated our version of aws-cdk-lib today from 2.115 to 2.120 latest

started getting this nag:

AwsSolutions-SMG4: The secret does not have automatic rotation scheduled. AWS Secrets Manager can be configured to automatically rotate the secret for a secured service or database.

but in our cdk code there is clearly a rotation set up

Reproduction Steps

        rds_instance = rds.DatabaseInstance(
            ...
        )
        rds_instance.add_rotation_single_user(
            automatically_after=Duration.days(30),
            rotate_immediately_on_update=True,
        )

then use aws-cdk-lib >= 2.116.0

What did you expect to happen?

no nag, because we have a rotation

What actually happened?

when upgrading aws-cdk-lib to 2.116.0 or later we start getting the nag

cdk-nag version

2.28.7

Language

Python

Other information

Looking at the changes released in aws-cdk-lib 2.116.0 there were two possibly relevant PRs:

I think it may be the latter, because here it changes the rotationRules in the generated schedule to use a scheduleExpression rather than automaticallyAfterDays

and the relevant check in cdk-nag:

const automaticallyAfterDays = Stack.of(node).resolve(
only looks for automaticallyAfterDays rather than any valid scheduling rule

@anentropic anentropic added bug Something isn't working needs-triage This issue or PR still needs to be triaged. labels Jan 12, 2024
@ruvimrd
Copy link

ruvimrd commented Jan 17, 2024

Related to #1565 and #1566

@clueleaf
Copy link
Contributor

@anentropic Please try cdk-nag v2.28.13

@dontirun dontirun removed the needs-triage This issue or PR still needs to be triaged. label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants