-
Notifications
You must be signed in to change notification settings - Fork 4k
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(cognito): re-adding threat protection capabilities and clarifying feature plans #33565
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #33565 +/- ##
==========================================
+ Coverage 82.20% 82.21% +0.01%
==========================================
Files 119 119
Lines 6872 6876 +4
Branches 1162 1162
==========================================
+ Hits 5649 5653 +4
Misses 1120 1120
Partials 103 103
Flags with carried forward coverage won't be shown. Click here to find out more.
|
I know the flags are copied from the issue I used, but tbh this should be p1 bug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix! Left some comments.
Pull request has been modified.
doing one more quick change to reorganize.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for the contributions and addressing my questions and comments!
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). |
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 CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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). |
Comments on closed issues and PRs are hard for our team to see. |
Issue
Closes #33393
Reason for this change
This is to solve the issue, but also to help fix errors introduced by #32367
When Feature Flags was introduced, a bad assumption was made. This assumption is in the comments on #32367
Unfortunately, this is not what this error means, and oddly the readme entry they added actually has the correct text.
This text indicates the author thought that in order to use Threat Protection / advanced security mode, you needed to be on LITE mode. but this doesn't make sense, that's the lowest tier..
As confirmed by the issue this PR is closing #33393, you actually need to be on PLUS tier to be able to use Threat Protection.
Also the text "Advanced Security Mode is deprecated in favor of user pool feature plans" which is in multiple places is not correct. All feature plans are, is a flag indicating a price plan. Each price plan enables more features as you go up.
This means Advanced Security Mode isn't actually gone, all they did was rename it to Threat Protection. In fact, CFN has not changed the Advanced Security Mode key name in their interpreter language. Which is the correct call since this would be a very large breaking change if they did.
This is confirmed by the docs for CFN https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-userpooladdons.html#cfn-cognito-userpool-userpooladdons-advancedsecuritymode
and the docs for L1
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.CfnUserPool.UserPoolAddOnsProperty.html
So deprecating Advanced Security Mode is okay, only because a name change to Threat Protection would make more sense.
Description of changes
I've added props for Threat protection. There are 2 keys that can be edited, the mode of the standard user and the mode of a custom user, thus
standardThreatProtectionMode
,customThreatProtectionMode
I've allowed advancedSecurityMode to be usable with the deprecation flag, but updated the guidance to talk about threat protection.
Also I have disallowed using advancedSecurityMode and either ThreatProtectionMode key at the same time
And when I was testing this, I tested an empty cognito user pool, and I got this CFN error
Unsure if this is new behavior from CFN, but this is indicating to me that there needs to be a default setting.
So since advancedSecurityMode can't actually be anything but OFF without featurePlan being PLUS, and you can only get to PLUS by specifying the featurePlan key (no key = ESSENTIALS by default, or LITE for backwards compatibility), I am setting a new default value
Basically if advancedSecurityMode is not specified, then it falls to standardThreatProtectionMode, where if this is not specified, it's set to
StandardThreatProtectionMode.NO_ENFORCEMENT
. (OFF)I updated the enum keys to match the UI when using
StandardThreatProtectionMode
orCustomThreatProtectionMode
The keys will make more sense to someone who is creating a user pool with CDK, but still map to the required CFN values since CFN is keeping the current behavior.
Description of how you validated changes
I updated the tests created from the previous PR and I added some more to help.
I've updated a few integs but I also wrote my own for this.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license