File tree Expand file tree Collapse file tree
infrastructure/stacks/api-layer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,8 +118,9 @@ resource "aws_wafv2_web_acl" "api_gateway" {
118118 }
119119
120120 # Rule 5: Geographic Block Rule - Block non-UK traffic
121- # NHS-specific requirement: block requests originating from outside GB
122- # Defence-in-depth against stolen mTLS certificates being used from outside the UK
121+ # Blocks requests from outside the allowed country list.
122+ # In prod: GB only - all legitimate traffic must originate from within the UK
123+ # In preprod: GB + US - GitHub Actions integration tests run from US-based servers
123124 rule {
124125 name = " BlockNonUK"
125126 priority = 50
@@ -132,7 +133,7 @@ resource "aws_wafv2_web_acl" "api_gateway" {
132133 not_statement {
133134 statement {
134135 geo_match_statement {
135- country_codes = [" GB" ] # United Kingdom only (does NOT include Crown Dependencies)
136+ country_codes = var . environment == " preprod " ? [" GB" , " US " ] : [ " GB " ]
136137 }
137138 }
138139 }
Original file line number Diff line number Diff line change @@ -130,6 +130,8 @@ resource "aws_cloudwatch_metric_alarm" "waf_rate_limit_blocks" {
130130}
131131
132132# Alarm for blocked non-UK requests
133+ # In preprod US is also allowed (for GitHub Actions), so this alarm fires on traffic
134+ # from countries outside GB+US. In prod it fires on anything outside GB.
133135resource "aws_cloudwatch_metric_alarm" "waf_non_uk_counted" {
134136 count = local. waf_enabled ? 1 : 0
135137 alarm_name = " WAF-NonUK-BlockedRequests-${ local . workspace } "
You can’t perform that action at this time.
0 commit comments