Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#634 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
api, backend, security

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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).
Ngôn ngữ chính
TypeScript
Star
5
Fork
3
Merge trung bình
9 giờ 37 phút
Pull request đã merge (30 ngày)
157

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NEARBuilders/everything-dev

Tất cả issue của NEARBuilders/everything-dev

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.