RDS Master Password In Plaintext
rds-master-password-plaintext
What this rule checks
Detects RDS instances and clusters whose MasterUserPassword is a literal string in the template rather than a Secrets Manager/SSM dynamic reference or managed credential.
How to fix it
- 1Use ManageMasterUserPassword (rds.Credentials.fromGeneratedSecret in CDK) so RDS manages and rotates the credential
- 2Or reference an existing secret with a '{{resolve:secretsmanager:...}}' dynamic reference
- 3Rotate any credential that has already been committed in plaintext
import * as rds from 'aws-cdk-lib/aws-rds';
new rds.CfnDBInstance(this, 'Db', {
dbInstanceClass: 'db.t3.micro',
engine: 'postgres',
allocatedStorage: '20',
masterUsername: 'admin',
masterUserPassword: 'SuperSecretPassw0rd!',
});import * as rds from 'aws-cdk-lib/aws-rds';
new rds.CfnDBInstance(this, 'Db', {
dbInstanceClass: 'db.t3.micro',
engine: 'postgres',
allocatedStorage: '20',
masterUsername: 'admin',
manageMasterUserPassword: true,
});CDK Insights pinpoints the exact file and line in your CDK source for every finding, so you can jump straight to the fix.
Affected resource types
AWS::RDS::DBInstanceAWS::RDS::DBClusterIntentional? Suppress this finding
Sometimes a flag is deliberate β a genuinely public endpoint, say. You can dismiss rds-master-password-plaintext and the reason is kept in the report, not silently hidden.
In .cdk-insights.json:
{
"ignoreRules": [
{ "id": "rds-master-password-plaintext", "reason": "Why this is intentional" }
]
}Or inline in your CDK code:
Validations.of(scope).acknowledge({
id: 'cdk-insights::rds-master-password-plaintext',
reason: 'Why this is intentional',
});Use the rule ID rds-master-password-plaintext shown above β not the CDK-* ID from SARIF / GitHub code scanning. To dismiss every finding on one construct instead, use ignorePaths. Suppression docs β
Catch this in your stack
$ npx cdk-insights scanCDK Insights runs this and 136+ other rules locally against your synthesised CDK app β free, no account, your code never leaves your machine.