Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

host: /api rate limit is easy to hit and shows up as "signed out" in the UI

未关闭
#634 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
api, backend, security

调研方向

Start by reading the host's SecurityMiddleware configuration and tracing how 429 responses from /api/auth/get-session reach the UI. Reproduce with bos dev and repeated page loads; the issue names no source files or tests, so locate the middleware and UI handling first. Done means rate limiting no longer creates misleading signed-out or not-found states, with behavior for shared IPs and trusted proxy headers addressed.

由索引模型根据 Issue 内容生成。

描述

The host's SecurityMiddleware (hono-rate-limiter) limits /api/* to RATE_LIMIT_MAX (300) requests per RATE_LIMIT_WINDOW_MS (900000, 15 min) per IP. The key is the first x-forwarded-for entry, else the socket IP, and the store is in-memory.

That's lower than it looks. A nearbuilders.org page load makes about 9 API calls signed out and more signed in, so 20–30 page loads in 15 minutes trips it. bos dev loads the same host bundle, so it hits local dev too, where all traffic comes from 127.0.0.1.

What happens when it trips: /api/auth/get-session returns 429 along with everything else. The UI treats that as no session, so the user looks signed out, and project pages show "Project not found". Nothing says it's a rate limit.

Repro (local):

  1. bos dev in nearbuilders.org, sign in.
  2. Click around / reload ~30 times within 15 minutes.
  3. /api/* calls start returning 429; the header shows signed out and project pages say "Project not found".

Other concerns:

  • People behind one IP (city node events, offices, conference wifi) share one bucket, so one busy room can lock everyone out.
  • The first x-forwarded-for entry is set by the client, so anyone can pick a fresh key per request and skip the limit. The rightmost entry added by the trusted proxy is the safer one.
  • In-memory store means the limit is per instance and resets on restart.

Suggestions:

  • Raise the default, or key signed-in requests by session/user and fall back to IP only when signed out.
  • Exempt /api/auth/get-session (or give it its own, higher limit).
  • Handle 429 in the UI: show a "too many requests, try again shortly" message instead of signed-out / not-found states.
  • Take the client IP from the trusted proxy hop, not the first x-forwarded-for value.
  • Document RATE_LIMIT_MAX / RATE_LIMIT_WINDOW_MS for local dev (setting RATE_LIMIT_MAX=5000 in .env works around it).
主要语言
TypeScript
星标
5
派生
3
平均合并
9 小时 37 分钟
30 天内合并 PR
157

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NEARBuilders/everything-dev 的其他 Issue

查看 NEARBuilders/everything-dev 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。