Skip to content

Commit e4af36e

Browse files
committed
eli-537 added US to permitted geos, for preprod only, to allow github action tests to still flow
1 parent 8de651c commit e4af36e

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

infrastructure/stacks/api-layer/waf.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff 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
}

infrastructure/stacks/api-layer/waf_alarms.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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.
133135
resource "aws_cloudwatch_metric_alarm" "waf_non_uk_counted" {
134136
count = local.waf_enabled ? 1 : 0
135137
alarm_name = "WAF-NonUK-BlockedRequests-${local.workspace}"

0 commit comments

Comments
 (0)