Add a separate route for submitting file upload answers - #2352
Conversation
7ba4349 to
37aa920
Compare
832fa7d to
2657d61
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The key generated form-action behavior lacks end-to-end request coverage.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds a dedicated submission route for file-upload answers so WAF exemptions can be scoped appropriately.
Changes:
- Adds the upload route and controller action.
- Routes file-question forms to the new endpoint.
- Adds request coverage and corrects a spec description typo.
| File | Description |
|---|---|
config/routes.rb |
Defines the file-upload POST route. |
app/controllers/forms/step_controller.rb |
Selects the upload route and shares save logic. |
app/models/step.rb |
Adds file-question detection. |
spec/requests/forms/step_controller_spec.rb |
Tests the new endpoint’s behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
We need to be able to exempy file upload requests from particular WAF rules: - the file size rule so requests can include files >8KB in size - the XSS rule, so that files that contain XML, such as PDFs are not blocked. So that we don't need to allow these rules for submitting all answer types, make it so that file upload requests are submitted to a dedicated route. For now, this still allows file uploads to be submitted to the standard save question route so we don't cause issues for users currently filling out forms, but this will be changed in a separate deployment. Co-Authored-By: Claude
2657d61 to
8c42da6
Compare
|
🎉 A review copy of this PR has been deployed! It is made of up two components It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready For the sign in details and more information, see the review apps wiki page. |

What problem does this pull request solve?
We need to be able to exempy file upload requests from particular WAF rules:
So that we don't need to allow these rules for submitting all answer types, make it so that file upload requests are submitted to a dedicated route.
For now, this still allows file uploads to be submitted to the standard save question route so we don't cause issues for users currently filling out forms, but this will be changed in a separate deployment.
Things to consider when reviewing