Skip to content

Commit

Permalink
Adding WAF to sit in front of cognito for additional security (#11837)
Browse files Browse the repository at this point in the history
Co-authored-by: karla-vm <[email protected]>
  • Loading branch information
dwhitestratiform and karla-vm authored Aug 12, 2024
1 parent 4f10541 commit 532f9d0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions services/ui-auth/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ plugins:
- serverless-s3-bucket-helper
- serverless-plugin-common-excludes # this should go before serverless-plugin-include-dependencies
- serverless-plugin-include-dependencies
- "@enterprise-cmcs/serverless-waf-plugin"

s3BucketHelper:
loggingConfiguration:
Expand All @@ -43,6 +44,11 @@ custom:
project: "mcr"
stage: ${opt:stage, self:provider.stage}
region: ${opt:region, self:provider.region}
wafPlugin:
name: ${self:service}-${self:custom.stage}-webacl-waf
wafExcludeRules:
awsCommon:
- "SizeRestrictions_BODY"
serverlessTerminationProtection:
stages:
- main
Expand Down Expand Up @@ -145,6 +151,18 @@ resources:
StringAttributeConstraints:
MinLength: 0
MaxLength: 2048
UserPoolAddOns:
AdvancedSecurityMode: ENFORCED
UserPoolTags:
Name: ${self:custom.stage}-user-pool

# Associate the WAF Web ACL with the Cognito User Pool
CognitoUserPoolWAFAssociation:
Type: 'AWS::WAFv2::WebACLAssociation'
Properties:
ResourceArn: !GetAtt CognitoUserPool.Arn
WebACLArn: !GetAtt WafPluginAcl.Arn

CognitoUserPoolClient:
Type: AWS::Cognito::UserPoolClient
Properties:
Expand Down

0 comments on commit 532f9d0

Please sign in to comment.