rubyforgood / rubyforgood/awbw
Bulk payment: unhandled UnreadableUpload can 500 the public payment form
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 15
- Forks
- 26
- Avg merge
- 12h 42m
- Merged PRs (30d)
- 242
Description
🤖 From Claude:
What
FormSubmission#persist_answer (extracted from EventRegistrationServices::PublicRegistration on maebeale/public-form-endpoint) raises FormSubmission::UnreadableUpload when a file_upload field's value is a forged or stale direct-upload signed id.
EventRegistrationServices::BulkPayment#call rescues only ActiveRecord::RecordInvalid, so the exception escapes.
Impact
Events::BulkPaymentFormSubmissionsController#create is a public, account-free endpoint. A bulk-payment form carrying a file_upload field would 500 instead of re-rendering with a form error. Before the extraction this path stored the raw value as text and could not raise.
Reachability is currently narrow — the bulk-payment new view renders no file input, so a legitimate submission won't produce the value; it takes a crafted POST or a stale signed id. That's why it's filed rather than fixed inline.
Fix
Add the rescue alongside the existing one in app/services/event_registration_services/bulk_payment.rb:
rescue FormSubmission::UnreadableUpload => e
Result.new(success?: false, form_submission: nil, errors: [ e.message ])
PublicRegistration and PublicFormSubmission both already rescue it — this is the one caller that doesn't.
Test
Request spec on POST /events/:event_id/bulk_payment_form_submissions with a file_upload field and a garbage signed id: expect :unprocessable_content with the error surfaced, not a raised exception.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in app/services/event_registration_services/bulk_payment.rb and inspect the existing rescue in EventRegistrationServices::BulkPayment#call. Exercise POST /events/:event_id/bulk_payment_form_submissions with a file_upload field and garbage signed id, then verify the response is unprocessable content, surfaces the error, and does not raise; use the existing rescues in PublicRegistration and PublicFormSubmission as reference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100