Require a bearer token for the Express analytics endpoint
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
chatcopsAnalyticsHandler (packages/server/src/adapters/express.ts, lines 73 to 78) answers anyone who finds the URL. The stats aren't secret, but they show how much traffic and how many leads a site gets, which is nobody else's business.
What to do
- Add
analyticsToken?: stringtoChatCopsServerConfig(packages/server/src/config.ts), with a short doc comment. - When it's set,
chatcopsAnalyticsHandleronly answers requests withAuthorization: Bearer <token>. Anything else gets401with{ "error": "unauthorized" }and aWWW-Authenticate: Bearerheader. - Compare the tokens in constant time. Don't import
node:crypto: this file is part of the same bundle Workers load. A small loop that compares every character, and checks the length, is enough. - When it isn't set, keep today's behavior so nothing breaks, but log one warning the first time the endpoint is hit, saying anyone can read the stats and how to set
analyticsToken. - Update the "Reading Stats with Express" section of
website/src/content/docs/core/analytics.mdx(line 18) with the option and acurlexample.
Where to look
packages/server/src/adapters/express.ts,chatcopsAnalyticsHandlerpackages/server/tests/adapters/express.test.ts, line 322, has the existing analytics test
Acceptance criteria
- With
analyticsTokenset: the right token gets the stats, while a missing token, a wrong token and a token of a different length get 401 - Without it: the stats are returned as today, and the warning is logged once across several requests
- Docs updated
- Changeset for
@chatcops/server(minor, since it adds an option) -
pnpm test:coverageandpnpm lintpass
Please get this merged by Oct 31.
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #<this issue number>. Setup notes (pnpm, build before test) are in CONTRIBUTING.md.
- Ngôn ngữ chính
- TypeScript
- Star
- 13
- Fork
- 7
- Merge trung bình
- 3 giờ 33 phút
- Pull request đã merge (30 ngày)
- 176
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codercops/chatcops
-
Add startup checks that catch weak or leaked security settingsCó thể đã có người làm @varun-pahuja đã nhận 3 ngày trước. Đang mởenhancement good first issue hacktoberfest server
codercops/chatcops#231 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type-check the TypeScript samples in the docsCó thể đã có người làm @An16og đã nhận 2 ngày trước. Đang mởdocumentation hacktoberfest help wanted testing
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 70/100
codercops/chatcops#201 · 7 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Hacktoberfest 2026: start hereĐang mởhacktoberfest
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add built-in translations to the widgetCó thể đã có người làm @piyusshhjangid đã nhận 1 ngày trước. Đang mởhelp wanted widget
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
codercops/chatcops#55 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của codercops/chatcops
Issue tương tự
-
bug hacktoberfest help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
libredb/libredb-studio#1941 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chore other
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
alastair-smith/card-games#308 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
paperclipai/paperclip#17379 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[good first issue, hacktoberfest] 🏯 Hacktoberfest Task - Add new Anime Quote 626 (good-first-issue)Đang mởcommunity first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
lingdojo/kana-dojo#33040 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug mobile ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày