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

オープン
#2,008 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
HTML
スター
33
フォーク
107
平均マージ
14時間 6分
マージ済み PR(30日)
19

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

USRSE/usrse.github.io のほかの issue

USRSE/usrse.github.io の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。