Skip to content

feat(iam): validate roleName#28509

Merged
mergify[bot] merged 10 commits intoaws:mainfrom
frattallone:28502-the-naming-conventions
Jan 2, 2024
Merged

feat(iam): validate roleName#28509
mergify[bot] merged 10 commits intoaws:mainfrom
frattallone:28502-the-naming-conventions

Conversation

@frattallone
Copy link
Copy Markdown
Contributor

Validates roleName

Closes #28502


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

@aws-cdk-automation aws-cdk-automation requested a review from a team December 28, 2023 12:09
@github-actions github-actions bot added effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Dec 28, 2023
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@kaizencc kaizencc added pr-linter/exempt-readme The PR linter will not require README changes pr-linter/exempt-integ-test The PR linter will not require integ test changes labels Dec 29, 2023
@kaizencc kaizencc changed the title feat(aws-iam): validates roleName feat(iam): validate roleName Dec 29, 2023
@aws-cdk-automation aws-cdk-automation dismissed their stale review December 29, 2023 04:48

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Copy link
Copy Markdown
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @frattallone. I got you to pass the automated reviewer but I do have one concern re: tokens before I approve this PR.

Also, the build is failing. The build needs to succeed before we take a second look!

physicalName: props.roleName,
});

if (props.roleName && !/^[\w_+=,.@-]{1,64}$/.test(props.roleName)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to cover the case where the roleName is a token, and thus we cannot parse it and see if the roleName is valid. We let these go through to CloudFormation, and there's tons of prior art around CDK that handles these situations. Need a unit test for it as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to add this check and relative tests

@mergify mergify bot dismissed kaizencc’s stale review December 29, 2023 13:39

Pull request has been modified.

Copy link
Copy Markdown
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got some unit tests in other submodules failing after this validation. Methinks either the unit tests were using invalid rolenames, or your check is too restrictive. Either way, the unit tests need to pass.

@mergify mergify bot dismissed kaizencc’s stale review January 2, 2024 12:10

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jan 2, 2024
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 9be4c1a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

Copy link
Copy Markdown
Contributor

@paulhcsun paulhcsun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional check and tests have been added for roleName is token case. Great work @frattallone, thanks for the contribution!

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 2, 2024

Thank you for contributing! Your pull request will be updated from main 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 999c01a into aws:main Jan 2, 2024
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jan 2, 2024
paulhcsun pushed a commit to paulhcsun/aws-cdk that referenced this pull request Jan 5, 2024
> Validates roleName


Closes aws#28502 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-readme The PR linter will not require README changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(iam): The naming conventions for IAM role names have not been verified

4 participants