Skip to content

Commit be44012

Browse files
authored
[NDR-182] Exclude body firewall rule for api (#357)
* [NDR-182] exclude body rule * [NDR-182] temp remove count * [NDR-182] fixing dodgy dynamic * [NDR-182] revert count * [NDR-182] rebase error --------- Co-authored-by: Sam Whyte <[email protected]>
1 parent f3931d5 commit be44012

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

infrastructure/modules/firewall_waf_v2/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module "waf_acl" {
2828
# Required: resource owner for tagging
2929
owner = "security-team"
3030
31-
# True if using the firewall for an api - removes AWSBotControl
31+
# True if using the firewall for an api - removes AWSBotControl and SizeRestrictions_BODY
3232
api = true
3333
}
3434
@@ -53,7 +53,7 @@ module "waf_acl" {
5353

5454
| Name | Description | Type | Default | Required |
5555
|------|-------------|------|---------|:--------:|
56-
| <a name="input_api"></a> [api](#input\_api) | True if using the firewall for an api - removes AWSBotControl. | `bool` | `false` | no |
56+
| <a name="input_api"></a> [api](#input\_api) | True if using the firewall for an api - removes AWSBotControl and SizeRestrictions\_BODY | `bool` | `false` | no |
5757
| <a name="input_cloudfront_acl"></a> [cloudfront\_acl](#input\_cloudfront\_acl) | Set to true if this WAF ACL is for a CloudFront distribution. | `bool` | n/a | yes |
5858
| <a name="input_environment"></a> [environment](#input\_environment) | Environment name used for tagging and resource naming. | `string` | n/a | yes |
5959
| <a name="input_owner"></a> [owner](#input\_owner) | Name of the owner used for tagging. | `string` | n/a | yes |

infrastructure/modules/firewall_waf_v2/local.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ locals {
77
name = "AWSCoreRuleSet"
88
managed_rule_name = "AWSManagedRulesCommonRuleSet"
99
cloudwatch_metrics_name = "AWS-core-ruleset"
10-
excluded_rules = []
10+
excluded_rules = var.api ? ["SizeRestrictions_BODY"] : []
1111
bypass = ["Yes"]
1212
},
1313
{

infrastructure/modules/firewall_waf_v2/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ resource "aws_wafv2_web_acl" "waf_v2_acl" {
4747

4848

4949
dynamic "rule_action_override" {
50-
for_each = rule.value["excluded_rules"]
50+
for_each = rule.value.excluded_rules
5151
content {
52-
name = excluded_rule.value
52+
name = rule_action_override.value
5353
action_to_use {
5454
allow {}
5555
}

infrastructure/modules/firewall_waf_v2/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ variable "cloudfront_acl" {
1414
}
1515

1616
variable "api" {
17-
description = "True if using the firewall for an api - removes AWSBotControl."
17+
description = "True if using the firewall for an api - removes AWSBotControl and SizeRestrictions_BODY"
1818
type = bool
1919
default = false
2020
}

0 commit comments

Comments
 (0)