aws / aws/aws-cdk

(RDS): Rotation applications are very old and insecure

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

Description

### What is the problem?

I deployed a MySQL RDS instance in isolated subnets and added a lambda to rotate the database credentials using the `addRotationMultiUser` method. The Lambda function is provision correctly, but fails when it call the `set_secret` method. Connecting to the database fails with the following error:

`[ERROR] ModuleNotFoundError: No module named 'asn1crypto' Traceback (most recent call last): File "/var/task/lambda_function.py", line 78, in lambda_handler `

The dependency could be missing or the issue could be caused by a version update. Lock the version using a requirements.txt file when installing the dependencies.
`pip install -r requirements.txt`

### Reproduction Steps

[rds-stack.txt](https://github.com/aws/aws-cdk/files/7803428/rds-stack.txt)

### What did you expect to happen?

Create the "Secrets Manager RDS MySQL Handler" Lambda and rotate the database credentials successfully without throwing errors.

### What actually happened?

[ERROR] ModuleNotFoundError: No module named 'asn1crypto' Traceback (most recent call last): File "/var/task/lambda_function.py", line 78, in lambda_handler

### CDK CLI Version

1.137.0

### Framework Version

_No response_

### Node.js Version

14.15.5

### OS

macOS Big Sur Version 11.6.2

### Language

Typescript

### Language Version

3.9.7

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the linked rds-stack.txt reproduction and the generated lambda_function.py, focusing on the set_secret path used by addRotationMultiUser. Check how the rotation Lambda packages its dependencies and whether requirements.txt is involved; done means the Secrets Manager RDS MySQL Handler can rotate credentials without the asn1crypto error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.