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

Aberta
#2,008 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
45/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Pouca atividade
Domínio
api, backend, cloud, security

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
HTML
Estrelas
33
Forks
107
Merge médio
14h 6min
PRs com merge (30d)
19

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de USRSE/usrse.github.io

Todas as issues de USRSE/usrse.github.io

Issues semelhantes

Mais issues de Backend & API Design

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.