Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(secretsmanager): secretName for owned secrets includes suffix (under feature flag) #11736

Merged
merged 4 commits into from
Nov 30, 2020

Conversation

njlynch
Copy link
Contributor

@njlynch njlynch commented Nov 26, 2020

Proper (tokenized) secret names for owned secrets was introduced in #11202. This
caused Secret.secretName to return the full resource name (secret name + suffix)
for owned secrets. This was done to ensure that the secretName was a Tokenized
value that would create a dependency between the Secret and its consumer.

However, Secrets Manager's DescribeSecret API does not accept the resourceName
as an input; it accepts the full ARN, a partial ARN (without the suffix), or the
secret name (without the suffix). This leads to several integrations with other
services or custom scripts to fail when using the secretName from an owned
Secret.

For owned secrets, we can parse the resourceName to get the secretName based on
either (a) knowing the secret name or (b) knowing the format that CloudFormation
uses when secret names aren't specified. This fix introduces proper parsing of
secret names for owned secrets (behind a feature flag).

BREAKING CHANGE: (feature flag) Secret.secretName for owned secrets will now
only the secret name (without suffix) and not the full resource name. This is
enabled through the @aws-cdk/secretsmanager:parseOwnedSecretName flag.

fixes #11727


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

…der feature flag)

Proper (tokenized) secret names for owned secrets was introduced in #11202. This
caused `Secret.secretName` to return the full resource name (secret name + suffix)
for owned secrets. This was done to ensure that the secretName was a Tokenized
value that would create a dependency between the Secret and its consumer.

However, Secrets Manager's DescribeSecret API does not accept the resourceName
as an input; it accepts the full ARN, a partial ARN (without the suffix), or the
secret name (without the suffix). This leads to several integrations with other
services or custom scripts to fail when using the secretName from an owned
Secret.

For owned secrets, we can parse the resourceName to get the secretName based on
either (a) knowing the secret name or (b) knowing the format that CloudFormation
uses when secret names aren't specified. This fix introduces proper parsing of
secret names for owned secrets (behind a feature flag).

BREAKING CHANGE: (feature flag) Secret.secretName for owned secrets will now
only the secret name (without suffix) and not the full resource name. This is
enabled through the `@aws-cdk/secretsmanager:parseOwnedSecretName` flag.

fixes #11727
@njlynch njlynch requested review from skinny85, eladb and a team November 26, 2020 18:04
@njlynch njlynch self-assigned this Nov 26, 2020
@gitpod-io
Copy link

gitpod-io bot commented Nov 26, 2020

@eladb eladb added the pr/do-not-merge This PR should not be merged at this time. label Nov 26, 2020
@njlynch njlynch removed the pr/do-not-merge This PR should not be merged at this time. label Nov 30, 2020
@mergify
Copy link
Contributor

mergify bot commented Nov 30, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 19a1685
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Nov 30, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit f6b4334 into master Nov 30, 2020
@mergify mergify bot deleted the njlynch/ownedsecretsparsing branch November 30, 2020 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-secretsmanager Related to AWS Secrets Manager contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(secretsmanager): secret_name returns the end of the ARN with 6 character suffix
3 participants