USRSE / USRSE/usrse.github.io

feat(api): add per-actor rate limit on POST /events/submit (and future /forms, /announcements submit)

Open
#2,008 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
33
Forks
104
Avg merge
12h 3m
Merged PRs (30d)
10

Description

Summary

POST /events/submit is auth-gated but unbounded — a single member could enqueue arbitrary draft events into the staff review queue. Same concern will apply to future member-facing submission endpoints in Plans 4 and 5.

Requirements

  • Decide a sensible cap (e.g., 10 submissions per actor per 24h)
  • Implement per-actor rate limit middleware that applies to POST /events/submit
  • Surface rate-limit-exceeded as 429 Too Many Requests with a Retry-After header
  • Add unit test covering the cap
  • Make the middleware composable so future submission endpoints (Plans 4 + 5) can opt in

Context

Flagged in the Plan 2 review. Rate limiting is best done at the Worker layer (e.g., Cloudflare Workers KV or Durable Object). Plan 4 (forms) and Plan 5 (announcements/broadcast) will benefit from the same primitive.

Implementation Notes

Options:

  • Cloudflare Workers Rate Limiting API (built-in, easy)
  • KV-backed counter with TTL (cheap, works on the existing stack)
  • Postgres-backed counter (consistent but adds DB hops to every submit)

Workers Rate Limiting API is the YAGNI default unless we need cross-region consistency.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the authenticated POST /events/submit handler and review how the project runs requests at the Worker layer. Compare the listed Workers Rate Limiting API, KV-backed counter, and Postgres-backed counter options, then identify the existing unit-test setup. Done means a composable per-actor limit, 429 responses with Retry-After, and a test covering the cap.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend, cloud, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.