Severity: MEDIUM · Contract · boundless-events
Surfaced by the Almanax scan of e1f17937. Closes Hackathon submissions can bloat persistent storage.
Files
contracts/events/src/event_ops.rs:505-562 — submit
Problem
Applicants (MAX_APPLICANTS_PER_EVENT = 5_000) and contributors (MAX_CONTRIBUTORS_PER_EVENT = 5_000) are capped, but Hackathon events have needs_application = false, so any address can create a persistent EventSubmission(event_id, applicant) entry with an arbitrarily long content_uri, with no cap on the number of distinct submissions. An attacker spamming submit from many fresh addresses grows the contract's persistent state / rent burden and degrades indexers.
Fix
- Add a per-event submission counter with a
MAX_SUBMISSIONS_PER_EVENT cap; reserve the slot before writing (matching the contributor append_* pattern so a cap-exceed reverts cleanly).
- Enforce a
MAX_CONTENT_URI_LEN bound on content_uri.
- New typed errors as needed — mind the 50-variant
contracterror cap; reuse existing variants where sensible.
Tests
- Submission at cap+1 reverts.
- Oversized
content_uri reverts.
- Re-submission by an existing applicant (update in place) does not increment the counter.
Severity: MEDIUM · Contract ·
boundless-eventsSurfaced by the Almanax scan of
e1f17937. ClosesHackathon submissions can bloat persistent storage.Files
contracts/events/src/event_ops.rs:505-562—submitProblem
Applicants (
MAX_APPLICANTS_PER_EVENT = 5_000) and contributors (MAX_CONTRIBUTORS_PER_EVENT = 5_000) are capped, but Hackathon events haveneeds_application = false, so any address can create a persistentEventSubmission(event_id, applicant)entry with an arbitrarily longcontent_uri, with no cap on the number of distinct submissions. An attacker spammingsubmitfrom many fresh addresses grows the contract's persistent state / rent burden and degrades indexers.Fix
MAX_SUBMISSIONS_PER_EVENTcap; reserve the slot before writing (matching the contributorappend_*pattern so a cap-exceed reverts cleanly).MAX_CONTENT_URI_LENbound oncontent_uri.contracterrorcap; reuse existing variants where sensible.Tests
content_urireverts.