Skip to content

Hackathon submit() has no submission cap or content_uri length limit #71

Description

@0xdevcollins

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-562submit

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions