Modify regex for body size WAF rule - #2281
Merged
stephencdaly merged 1 commit intoSep 22, 2026
Merged
Conversation
We are going to add a separate forms-runner URL for file upload questions, so that we can exempt only this URL from WAF rules that block file uploads (request size, XSS) rather than exempting POST requests for all answer types. Update the regex to allow large request bodies for the new file upload URL. Once the forms-runner change to use the new URL has been deployed we can update the regex to only allow large request bodies for the `/upload-file` path.
stephencdaly
force-pushed
the
allow-oversize-request-body-for-new-file-upload-url
branch
from
September 22, 2026 11:19
c3eb34f to
649d2e2
Compare
stephencdaly
marked this pull request as ready for review
September 22, 2026 11:43
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused regex change correctly supports both existing and new upload routes during migration.
Review effort: Balanced
Findings: None
What changed in this PR
Updates WAF routing to support the new forms-runner file-upload endpoint while retaining existing upload behavior during rollout.
Changes:
- Allows optional
/upload-filesuffixes for file-upload requests. - Updates the route comment accordingly.
| File | Description |
|---|---|
infra/modules/cloudfront_waf_protection/waf.tf |
Extends the permitted file-upload URL regex. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
theseanything
approved these changes
Sep 22, 2026
cadmiumcat
approved these changes
Sep 22, 2026
stephencdaly
deleted the
allow-oversize-request-body-for-new-file-upload-url
branch
September 22, 2026 11:58
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?
We are going to add a separate forms-runner URL for file upload questions, so that we can exempt only this URL from WAF rules that block file uploads (request size, XSS) rather than exempting POST requests for all answer types.
See govuk-forms/forms-runner#2352
Update the regex to allow large request bodies for the new file upload URL. Once the forms-runner change to use the new URL has been deployed we can update the regex to only allow large request bodies for the
/upload-filepath.I've tested this on the dev environment before and after applying the related forms-runner change and ensured large files can be uploaded.
Things to consider when reviewing
Reminders
If you've made changes to the deployer role (files in
modules/deployer-access):make <environment> forms/account applyon the relevant environments (dev,stagingand/orprod)apply-forms-terraform-<environment>pipelines have run successfully