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 41 min
- PR fusionados (30 d)
- 155
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
-
Document the pre-chat formPosiblemente ocupada @masyarakatai la tomó hace 6 días. Abiertodocumentation good first issue hacktoberfest widget
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
codercops/chatcops#70 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
docs: update the providers page for openai-compatible, registerProvider and provider importsPosiblemente ocupada @prakashNalla la tomó hace 1 día. Abiertodocumentation good first issue hacktoberfest website
Dificultad 3/5 1-2 días Aptitud para principiantes 76/100
codercops/chatcops#291 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
docs: add a protocol reference page for custom clientsPosiblemente ocupada @kachamsiddarth la tomó hace 1 día. Abiertodocumentation good first issue hacktoberfest website
codercops/chatcops#286 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Create @chatcops/store-cloudflare (D1, KV and a Durable Object counter)Posiblemente ocupada @bhushan4work la tomó hace 1 día. Abiertoenhancement hacktoberfest help wanted server
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
codercops/chatcops#249 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Create @chatcops/store-sqlite, a store for single-server setupsPosiblemente ocupada @srikar-naidu la tomó hace 1 día. Abiertoenhancement hacktoberfest help wanted server
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
codercops/chatcops#247 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de codercops/chatcops
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
maniator/verticopolis#1303 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
components-web-app/docs#297 ·
-
listFeatures/getFeatureExamples never return Kotlin examples for Android or server Kotlin SDKsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
appwrite/mcp-for-docs#23 · 1 comentario ·
-
`@vanilla-extract/turbopack-plugin`: "getImageSize is not a function" with Next.js 16.4.x when a `.css.ts` file imports an imagePosiblemente ocupada @aevarOrigo la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
vanilla-extract-css/vanilla-extract#1799 · 1 comentario ·
-
native
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
prime-radiant-inc/evener#4839 ·
Los mantenedores suelen responder en 1 día