Skip to content

feat(cognito): validate oidc provider name#28802

Merged
mergify[bot] merged 9 commits intoaws:mainfrom
msambol:28667
Jan 29, 2024
Merged

feat(cognito): validate oidc provider name#28802
mergify[bot] merged 9 commits intoaws:mainfrom
msambol:28667

Conversation

@msambol
Copy link
Copy Markdown
Contributor

@msambol msambol commented Jan 21, 2024

Closes #28667.


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 January 21, 2024 21:39
@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 star-contributor [Pilot] contributed between 25-49 PRs to the CDK labels Jan 21, 2024

if (props.name && !Token.isUnresolved(props.name) && (props.name.length < 3 || props.name.length > 32)) {
throw new Error(`Expected provider name to be between 3 and 32 characters, received ${props.name} (${props.name.length} characters)`);
}
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.

This isn't needed because the validation is done in getProviderName below.

@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 21, 2024
Copy link
Copy Markdown
Contributor

@laurelmay laurelmay left a comment

Choose a reason for hiding this comment

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

Thanks! I do think I've seen a few recent validation additions get marked as feat instead of chore; not sure whether that applies here.

@aws-cdk-automation aws-cdk-automation added pr/needs-maintainer-review This PR needs a review from a Core Team Member and removed pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Jan 22, 2024
@msambol msambol changed the title chore(cognito): validate oidc provider name feat(cognito): validate oidc provider name Jan 22, 2024
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.

@msambol
Copy link
Copy Markdown
Contributor Author

msambol commented Jan 22, 2024

Exemption Request: I only added validation, I don't believe a README update is needed.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Jan 22, 2024
@IkeNefcy
Copy link
Copy Markdown
Contributor

IkeNefcy commented Jan 22, 2024

Does this function check work? From what I'm reading PCRE is not natural in js/ts. The string CFN uses to check is in PCRE but .match() uses ECMAScript right? I think the string would need to be translated to this regex dialect first for this to work.

My concern is mainly with the escape characters. In PCRE \p{} indicates special characters, for instance \p{Z} is a space. Checking with https://regex101.com/ works. But with js regex, it would act like https://regexr.com/ , where it's checking the character p and Z as if they are letters

@laurelmay
Copy link
Copy Markdown
Contributor

Does this function check work? From what I'm reading PCRE is not natural in js/ts. The string CFN uses to check is in PCRE but .match() uses ECMAScript right? I think the string would need to be translated to this regex dialect first for this to work.

Good catch! I believe that per the specification the correct thing to do here to enable the u flag on the regex for unicode support. In this situation, both sites you linked to (regex101 with the JS engine selected and regexr) show a proper parsing of the regex.

@msambol
Copy link
Copy Markdown
Contributor Author

msambol commented Jan 22, 2024

@kylelaker / @IkeNefcy I updated the pattern with the u. Thanks!

@GavinZZ GavinZZ added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Jan 29, 2024
@msambol
Copy link
Copy Markdown
Contributor Author

msambol commented Jan 29, 2024

@GavinZZ I removed the snapshot changes.

@GavinZZ
Copy link
Copy Markdown
Member

GavinZZ commented Jan 29, 2024

We've had some issue with CodeBuild which is why the CI is not passing. We're actively working on a fix, sorry for any inconvenience.

@GavinZZ
Copy link
Copy Markdown
Member

GavinZZ commented Jan 29, 2024

@mergify update

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 29, 2024

update

✅ Branch has been successfully updated

@GavinZZ GavinZZ added the pr-linter/exempt-readme The PR linter will not require README changes label Jan 29, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review January 29, 2024 23:12

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

Copy link
Copy Markdown
Member

@GavinZZ GavinZZ left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for contributing!

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 29, 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).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 29, 2024
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

@mergify mergify bot merged commit 534794c into aws:main Jan 29, 2024
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 29, 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).

Vandita2020 pushed a commit to Vandita2020/aws-cdk that referenced this pull request Jan 30, 2024
Closes aws#28667.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Vandita2020 pushed a commit to Vandita2020/aws-cdk that referenced this pull request Jan 30, 2024
Closes aws#28667.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
SankyRed pushed a commit that referenced this pull request Feb 8, 2024
Closes #28667.

----

*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

effort/small Small work item – less than a day 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 pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. star-contributor [Pilot] contributed between 25-49 PRs to the CDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-cognito: Add PCRE Regex Validation

5 participants