Skip to main content
HIGHRDSSecurity

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

  1. 1Use ManageMasterUserPassword (rds.Credentials.fromGeneratedSecret in CDK) so RDS manages and rotates the credential
  2. 2Or reference an existing secret with a '{{resolve:secretsmanager:...}}' dynamic reference
  3. 3Rotate any credential that has already been committed in plaintext
FlaggedmasterUserPassword is a literal string: it lands in plaintext in the synthesized template, the stored CloudFormation template, and every deploy artifact.
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!',
});
FixedmanageMasterUserPassword: true has RDS create and rotate the credential in Secrets Manager β€” no password ever appears in the template, so the finding clears.
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::DBCluster

Compliance frameworks

SOC2HIPAAPCI-DSSCISNIST

AWS documentation

Read the AWS guidance

Intentional? 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 scan

CDK Insights runs this and 136+ other rules locally against your synthesised CDK app β€” free, no account, your code never leaves your machine.

More RDS rules