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

cognito: Add configuration for Threat Protection enforcement level for the UserPool construct #33393

Closed
2 tasks
sashee opened this issue Feb 11, 2025 · 8 comments · Fixed by #33565
Closed
2 tasks
Labels
@aws-cdk/aws-cognito Related to Amazon Cognito effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@sashee
Copy link

sashee commented Feb 11, 2025

Describe the feature

I could not find any way to set the Threat protection when using the UserPool construct.

To enable auth events logging I could configure the FeaturePlan but then there is no way to set the pool to audit.

Image

This is possible with the CfnUserPool construct.

This should be configurable with the UserPool construct as well.

Use Case

I want to see the login, password change, and other events for users in a user pool. For this, I need to set two things:

  • pricing plan to Plus
  • threat protection level to AUDIT

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.176.0

Environment details (OS name and version, etc.)

Linux

@sashee sashee added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Feb 11, 2025
@github-actions github-actions bot added the @aws-cdk/aws-cognito Related to Amazon Cognito label Feb 11, 2025
@sashee
Copy link
Author

sashee commented Feb 11, 2025

As a workaround, it seems like it's possible to override it with a propertyOverride:

    const pool = new aws_cognito.UserPool(
      this,
      "Pool",
      {
        // ....
        featurePlan: aws_cognito.FeaturePlan.PLUS,
      }
    );

    pool.node.defaultChild.addPropertyOverride("UserPoolAddOns", {AdvancedSecurityMode: "AUDIT"});

@pahud
Copy link
Contributor

pahud commented Feb 11, 2025

Yes, while property override is always a working hack. We welcome PRs from the community to expose this to L2.

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Feb 11, 2025
@badmintoncryer
Copy link
Contributor

badmintoncryer commented Feb 21, 2025

@sashee
You can configure this using the advancedSecurityMode property. However, this parameter has been deprecated...

https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts#L1162

@IkeNefcy
Copy link
Contributor

IkeNefcy commented Feb 21, 2025

I'm not sure that deprecating was the right move. I think the change was maybe not fully understood.
Feature Plans (what the deprecation message says it was changing to) is only a method of unlocking new features. It's only a pricing change, then you can do more things. This Threat Protection is actually totally untouchable unless you are on the 3rd plan for this user pool (as mentioned in this issue's description). Once you unlock it, you still need to set the auth type etc in the Thread Protection tab.
What I'm saying is, Feature Plans is not a replacement for Threat Protection, and this should not have been deprecated. Instead we should consider 2 things.

  • Is there a CFN for deciding the Feature Plan?
    • If Yes then we should add that feature and checks on AdvancedSecurityMode to check if that feature is enabled or not.
    • If No then get cfn coverage and in the mean team add a warning that AdvancedSecurityMode may not work correctly if the feature plan is not enabled. (Using AdvancedSecurityMode in CFN might even enable it automatically, still researching)

There already is a featurePlan? arg ! so perhaps we just need to un-deprecate advancedSecurityMode?

@IkeNefcy
Copy link
Contributor

found #32367

@IkeNefcy
Copy link
Contributor

IkeNefcy commented Feb 21, 2025

Image
more clarity that "Advanced Security" is deprecated in the sense that they just don't use that name. Rather it's now called "Threat protection", but the options are exactly the same.

However the name is the same in the l1
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.CfnUserPool.UserPoolAddOnsProperty.html
and I doubt cfn is going to change this behavior, since it would be mega breaking. So we just need to rename it in CDK potentially ?

Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

1 similar comment
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/aws-cognito Related to Amazon Cognito 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 a pull request may close this issue.

4 participants