Skip to content

Add pen tester access to staging - #2196

Merged
theseanything merged 4 commits into
mainfrom
theseanything/add-exception-ips
Jul 10, 2026
Merged

Add pen tester access to staging#2196
theseanything merged 4 commits into
mainfrom
theseanything/add-exception-ips

Conversation

@theseanything

Copy link
Copy Markdown
Contributor

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.

Copilot AI review requested due to automatic review settings July 10, 2026 11:47
@theseanything
theseanything requested a review from whi-tw July 10, 2026 11:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) to cidrhost(cidr, 0) in relevant pentester_cidr_ranges variable 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) < 1 because length(...) >= 0 is 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.

Comment thread infra/deployments/forms/account/tfvars/staging.tfvars
Comment thread infra/deployments/integration/inputs.tf Outdated
Comment thread infra/deployments/forms/account/inputs.tf Outdated
Copilot AI review requested due to automatic review settings July 10, 2026 12:51
@whi-tw
whi-tw force-pushed the theseanything/add-exception-ips branch from 4c7008f to c143855 Compare July 10, 2026 12:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@theseanything
theseanything force-pushed the theseanything/add-exception-ips branch from c143855 to d206ddf Compare July 10, 2026 13:21
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).
Copilot AI review requested due to automatic review settings July 10, 2026 13:23
@theseanything
theseanything force-pushed the theseanything/add-exception-ips branch from d206ddf to 7d8ec1c Compare July 10, 2026 13:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread infra/deployments/forms/account/tfvars/staging.tfvars
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.
Copilot AI review requested due to automatic review settings July 10, 2026 13:34
@theseanything
theseanything force-pushed the theseanything/add-exception-ips branch from 7d8ec1c to d420a88 Compare July 10, 2026 13:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread infra/deployments/forms/tfvars/staging.tfvars
Comment thread infra/deployments/deploy/engineer-access/roles.tf
@theseanything theseanything changed the title Add pen tester IPs for access to staging Add pen tester access to staging Jul 10, 2026
Copilot AI review requested due to automatic review settings July 10, 2026 13:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread infra/deployments/deploy/engineer-access/roles.tf Outdated
Grants the pentesters read-only roles in the staging and deploy
accounts, restricted to the pentester CIDR ranges.
Copilot AI review requested due to automatic review settings July 10, 2026 14:14
@theseanything
theseanything force-pushed the theseanything/add-exception-ips branch from 7d4abcc to 4323a3f Compare July 10, 2026 14:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@whi-tw whi-tw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - good catch updating the guardrail

@theseanything
theseanything added this pull request to the merge queue Jul 10, 2026
Merged via the queue into main with commit 5b33768 Jul 10, 2026
21 checks passed
@theseanything
theseanything deleted the theseanything/add-exception-ips branch July 10, 2026 14:24
@whi-tw

whi-tw commented Jul 10, 2026

Copy link
Copy Markdown
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

theseanything added a commit that referenced this pull request Aug 4, 2026
The penetration test has finished, so clear the pentester email
addresses, CIDR ranges and @accenture.com sign-in domain added in #2196,
#2201 and #2202.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants