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

feat(cognito): added verified attribute changes #21180

Merged
merged 5 commits into from
Jul 19, 2022

Conversation

eriktisme
Copy link
Contributor

@eriktisme eriktisme commented Jul 16, 2022

Added the configuration to keep the original attributes until they are verified to improve the security of the users.

closes #21179


All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

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

@gitpod-io
Copy link

gitpod-io bot commented Jul 16, 2022

@github-actions github-actions bot added the p2 label Jul 16, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team July 16, 2022 17:10
@github-actions github-actions bot added the feature-request A feature should be added or improved. label Jul 16, 2022
@eriktisme eriktisme force-pushed the feat/configure-verified-changes branch from 3dd28ed to b9e260a Compare July 16, 2022 18:07
@eriktisme
Copy link
Contributor Author

I was unable to find out how to run the tests locally, can someone support me with it?

@mrgrain
Copy link
Contributor

mrgrain commented Jul 17, 2022

I was unable to find out how to run the tests locally, can someone support me with it?

Sure! It's a bit tricky to find, but this section describes it https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md#build

@eriktisme eriktisme force-pushed the feat/configure-verified-changes branch from ac540d4 to 0a12110 Compare July 18, 2022 08:05
Copy link
Contributor

@mrgrain mrgrain left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! 😃

There are a few issues to address. But feel free to ignore my style suggestion.

packages/@aws-cdk/aws-cognito/lib/user-pool.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-cognito/lib/user-pool.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-cognito/lib/user-pool.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-cognito/lib/user-pool.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-cognito/test/user-pool.test.ts Outdated Show resolved Hide resolved
@eriktisme
Copy link
Contributor Author

@mrgrain thank you for your review, I have addressed your suggestions by using constants!

@mergify mergify bot dismissed mrgrain’s stale review July 18, 2022 09:32

Pull request has been modified.

mrgrain
mrgrain previously approved these changes Jul 18, 2022
Copy link
Contributor

@mrgrain mrgrain left a comment

Choose a reason for hiding this comment

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

👍🏻 👍🏻

@mrgrain
Copy link
Contributor

mrgrain commented Jul 18, 2022

@eriktisme The test failure is unrelated to your change, I'm looking into this right now.

In the meantime, I think it would be good to add an explanation of this feature to the Readme - I guess it's either under Attributes or Sign In.

Related to that, I'm not super familiar with Cognito. Could you explain your naming choice for keepOriginal to me? On the surface this doesn't match up the what the Cloudformation docs describe.

@eriktisme
Copy link
Contributor Author

@eriktisme The test failure is unrelated to your change, I'm looking into this right now.

In the meantime, I think it would be good to add an explanation of this feature to the Readme - I guess it's either under Attributes or Sign In.

Related to that, I'm not super familiar with Cognito. Could you explain your naming choice for keepOriginal to me? On the surface this doesn't match up the what the Cloudformation docs describe.

@eriktisme The test failure is unrelated to your change, I'm looking into this right now.

In the meantime, I think it would be good to add an explanation of this feature to the Readme - I guess it's either under Attributes or Sign In.

Related to that, I'm not super familiar with Cognito. Could you explain your naming choice for keepOriginal to me? On the surface this doesn't match up the what the Cloudformation docs describe.

I opted for "keepOriginal" because it is to maintain the original value of the attribute until the new value is verified. This can be found in step 4 in the Cognito documentation "Choose Keep original attribute value active when an update is pending" at page https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-email-phone-verification.html?icmpid=docs_cognito_console_help_panel

@mergify mergify bot dismissed mrgrain’s stale review July 18, 2022 11:49

Pull request has been modified.

@mrgrain
Copy link
Contributor

mrgrain commented Jul 18, 2022

Thanks for the documentation, it reads great!

I have resolved the issue causing the build to fail. You will have to rebase/merge this branch with latest changes from main.

@eriktisme eriktisme force-pushed the feat/configure-verified-changes branch from 9d4a81f to 2b787bb Compare July 18, 2022 14:04
mrgrain
mrgrain previously approved these changes Jul 18, 2022
@eriktisme
Copy link
Contributor Author

@mrgrain do you know how to get the PR Linter to succeed?

@mrgrain
Copy link
Contributor

mrgrain commented Jul 18, 2022

@eriktisme Ah yes, it also needs integration tests to be updated to make sure the resource still deploys.
I reckon@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.ts is the appropriate one.

You can find details on how to run integration tests here: https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md

@mergify mergify bot dismissed mrgrain’s stale review July 18, 2022 17:54

Pull request has been modified.

@@ -27,6 +27,10 @@ const userpool = new UserPool(stack, 'myuserpool', {
email: true,
phone: true,
},
keepOriginal: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Updating this will require an update to the expected output file as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Updated the snapshot

Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

In addition to my last comment, please review the PR section of our contributing guide and edit the PR title and body accordingly.

@eriktisme eriktisme changed the title feat(aws-cognito): added verified changes feat(cognito): added verified attribute changes Jul 19, 2022
@eriktisme eriktisme force-pushed the feat/configure-verified-changes branch from c92de19 to 9d4a81f Compare July 19, 2022 07:17
@mergify mergify bot dismissed TheRealAmazonKendra’s stale review July 19, 2022 07:18

Pull request has been modified.

@eriktisme
Copy link
Contributor Author

In addition to my last comment, please review the PR section of our contributing guide and edit the PR title and body accordingly.

Thank you for your feedback! I have updated the title and the body, I hope it is more clear now and follows the guideline

@eriktisme eriktisme force-pushed the feat/configure-verified-changes branch from e21755d to ad7af53 Compare July 19, 2022 08:07
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: ad7af53
  • 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 Jul 19, 2022

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 ad67594 into aws:main Jul 19, 2022
@eriktisme eriktisme deleted the feat/configure-verified-changes branch July 19, 2022 13:14
@mrgrain mrgrain added the effort/medium Medium work item – several days of effort label Jul 20, 2022
comcalvi pushed a commit to comcalvi/aws-cdk that referenced this pull request Jul 25, 2022
Added the configuration to keep the original attributes until they are verified to improve the security of the users.

closes aws#21179

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*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/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-cognito: enable verifying attribute changes to keep original attributes
4 participants