Skip to content

Commit

Permalink
Limit request body sizes in WAF
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Mar 15, 2024
1 parent 862d53a commit 549e566
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions apps/aws-app/cdk/waf-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,24 @@ export class WafStack extends cdk.Stack {
rules: [
{
priority: 1,
name: `request-body-size-limit`,
visibilityConfig: {
cloudWatchMetricsEnabled: false,
metricName: `${webAclName}-request-body-size-limit`,
sampledRequestsEnabled: true,
},
statement: {
sizeConstraintStatement: {
fieldToMatch: {body: {}},
comparisonOperator: `GT`,
size: 1024,
textTransformations: [{priority: 0, type: `NONE`}],
},
},
action: {block: {customResponse: {responseCode: 413}}},
},
{
priority: 2,
name: `rate-limit`,
visibilityConfig: {
cloudWatchMetricsEnabled: false,
Expand Down

0 comments on commit 549e566

Please sign in to comment.