aws / aws/aws-cdk

Secrets Manager: raises a security issue when adding rotationLambda

Open
#28,406 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-cloudformation bug effort/medium p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

The following cloudformation guard rule fails https://docs.aws.amazon.com/controltower/latest/userguide/lambda-rules.html#ct-lambda-pr-2-description

This is due to the fact that it is missing a SourceAccount in the service principal

A resource policy for rotation lambda is created here and this causes the cfn guard rule to fail.

https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-secretsmanager/lib/rotation-schedule.ts#L107

### Expected Behavior

I should be allowed to add or override the service principal created [here](https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-secretsmanager/lib/rotation-schedule.ts#L107
), to address cfn guard rule failing

### Current Behavior

I have no way to address the cloudformation guard [rule](https://docs.aws.amazon.com/controltower/latest/userguide/lambda-rules.html#ct-lambda-pr-2-description), created due to this [line](https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-secretsmanager/lib/rotation-schedule.ts#L107)

### Reproduction Steps

add a rotation lambda to secrets manager, and run [cdk cfn guard validator](https://github.com/cdklabs/cdk-validator-cfnguard)

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.104.0

### Framework Version

_No response_

### Node.js Version

v16.20.0

### OS

mac

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in packages/aws-cdk-lib/aws-secretsmanager/lib/rotation-schedule.ts around line 107 and reproduce the issue by adding a rotation Lambda, then running the cdk cfn guard validator. Determine how the service principal can be overridden or supplied with a SourceAccount, and verify that the generated resource policy satisfies the referenced guard rule.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.