Require a bearer token for the Express analytics endpoint
Los mantenedores suelen responder en 1 día
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 13
- Forks
- 7
- Merge medio
- 3 h 33 min
- PR fusionados (30 d)
- 176
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de codercops/chatcops
-
Add startup checks that catch weak or leaked security settingsPosiblemente ocupada @varun-pahuja la tomó hace 3 días. Abiertoenhancement good first issue hacktoberfest server
codercops/chatcops#231 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Type-check the TypeScript samples in the docsPosiblemente ocupada @An16og la tomó hace 2 días. Abiertodocumentation hacktoberfest help wanted testing
Dificultad 4/5 3-5 días Aptitud para principiantes 70/100
codercops/chatcops#201 · 7 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Hacktoberfest 2026: start hereAbiertohacktoberfest
Dificultad 1/5 Menos de una hora Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Add built-in translations to the widgetPosiblemente ocupada @piyusshhjangid la tomó hace 1 día. Abiertohelp wanted widget
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
codercops/chatcops#55 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de codercops/chatcops
Issues similares
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 82/100
source-cooperative/docs.source.coop#41 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Nimblesite/SharpLsp#468 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
solidjs-community/solid-primitives#1082 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día