Skip to content

docdb.DatabaseSecret: Secret generated with invalid characters #15732

@Voyen

Description

@Voyen

docdb.DatabaseSecret by default calls aws_secretsmanager.Secret specifying exclusion characters of '"', '@', and '/'.
However since many databases use a 'proto://user:password@host.....' connection URL, a colon should be included in this exclusions list.

I'm currently trying to spin up a mongo-express container in my ECS environment but can't get it to connect because the secret that was generated contains a colon and so the connection URL is invalid.

Reproduction Steps

const secret = new docdb.DatabaseSecret(this, 'ClusterSecret', {
    username: 'root',
    secretName: 'myClusterSecret',
});

What did you expect to happen?

A valid secret is generated that can be used in a connection URL

What actually happened?

Secret generated with a ':' in it which makes connection URLs invalid

Environment

  • CDK CLI Version : 1.114.0 (build 7e41b6b)
  • Framework Version:
  • Node.js Version: v15.4.0
  • OS : 5.12.15.arch1-1
  • Language (Version): Using Typescript but I assume this affect all

Other

Note that while using this within your own applications is controllable (my Spring Boot application builds the connection string and url-encodes the password), providing this to out of the box images as environment secrets is impossible


This is 🐛 Bug Report

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-docdbRelated to Amazon DocumentDBbugThis issue is a bug.closed-for-stalenessThis issue was automatically closed because it hadn't received any attention in a while.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions