Add pen tester access to staging - #2196
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Enables staging penetration testing access by populating staging pentester CIDR ranges and adjusting Terraform input validation so valid CIDRs don’t fail due to an out-of-range cidrhost host index.
Changes:
- Fix CIDR validation by switching from
cidrhost(cidr, 32)tocidrhost(cidr, 0)in relevantpentester_cidr_rangesvariable validations. - Add a set of pentester CIDR ranges to the staging account tfvars.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| infra/deployments/integration/inputs.tf | Updates pentester_cidr_ranges validation to avoid rejecting valid CIDRs due to host index issues. |
| infra/deployments/forms/account/tfvars/staging.tfvars | Populates staging pentester_cidr_ranges with the pen tester IP allowlist. |
| infra/deployments/forms/account/inputs.tf | Updates pentester_cidr_ranges validation and corrects a validation error message typo. |
Comments suppressed due to low confidence (1)
infra/deployments/forms/account/inputs.tf:109
- This production-safety check is equivalent to
var.environment_type != "production" || length(var.pentester_cidr_ranges) < 1becauselength(...) >= 0is always true. Simplifying it avoids confusion and makes the intent clearer.
error_message = "Each entry in the list must be a valid IPv4 CIDR range"
}
validation {
condition = var.environment_type != "production" && (length(var.pentester_cidr_ranges) >= 0) || var.environment_type == "production" && (length(var.pentester_cidr_ranges) < 1)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
whi-tw
force-pushed
the
theseanything/add-exception-ips
branch
from
July 10, 2026 12:51
4c7008f to
c143855
Compare
theseanything
force-pushed
the
theseanything/add-exception-ips
branch
from
July 10, 2026 13:21
c143855 to
d206ddf
Compare
The validation used cidrhost(cidr, 32), which errors whenever host number 32 does not fit in the block's host bits, so valid /32 and /27 entries were rejected. This went unnoticed while the lists were empty. Use host number 0, which accepts any valid IPv4 CIDR. Also fix a typo in the error message (last -> list).
theseanything
force-pushed
the
theseanything/add-exception-ips
branch
from
July 10, 2026 13:23
d206ddf to
7d8ec1c
Compare
Allow penetration tester traffic from to assume the pentester roles in the staging account.
The workflow was missing the tfvars directory in the path for the forms account staging tfvars file, so changes to that file did not trigger the guardrail check.
theseanything
force-pushed
the
theseanything/add-exception-ips
branch
from
July 10, 2026 13:34
7d8ec1c to
d420a88
Compare
Grants the pentesters read-only roles in the staging and deploy accounts, restricted to the pentester CIDR ranges.
theseanything
force-pushed
the
theseanything/add-exception-ips
branch
from
July 10, 2026 14:14
7d4abcc to
4323a3f
Compare
whi-tw
approved these changes
Jul 10, 2026
whi-tw
left a comment
Contributor
There was a problem hiding this comment.
LGTM - good catch updating the guardrail
Contributor
|
confirmed email lists are the same visually, and with this upcoming guardrail: https://github.com/govuk-forms/forms-deploy/actions/runs/29099788588/job/86385404476?pr=2199 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this pull request solve?
Allow penetration tester traffic from to assume the pentester roles in the staging account.
Also fixes an issue with validation - it used cidrhost(cidr, 32), which errors whenever host number 32 does not fit in the block's host bits, so valid /32 and /27 entries were rejected. This went unnoticed while the lists were empty. Use host number 0, which accepts any valid IPv4 CIDR.