`/status?network=mainnet` is rate limited although `/status` is exempt

Abierto Apto para principiantes
#662 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

@Joyful12-tech ya está trabajando en esto.

Desde el 20/11/2026.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
84/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
api, backend, testing

Línea de trabajo

Empieza por la exención de probes en src/app.ts y compara su comprobación de URL con la comprobación de la ruta enrutada en src/middleware/globalRateLimit.ts. Lee src/__tests__/rateLimitContract.test.ts y tests/healthProbes.test.ts para ver patrones de pruebas. Añade cobertura que demuestre que las solicitudes de probes con query string siguen exentas y que una ruta normal sigue devolviendo 429 cuando el límite es bajo; termina cuando esos casos pasen con los límites de velocidad existentes sin cambios.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

area:reliability difficulty:easy help wanted points:100 Stellar Wave
Background

Health probes must never be throttled. src/app.ts says so at lines 55 to 62 and exempts them at line 174:

allowList: (req) => PROBE_PATHS.has(req.url),

req.url includes the query string. /status takes a network parameter (it reports per network), so a monitor that polls /status?network=mainnet does not match '/status', is counted against the shared per-IP limit of 100 a minute, and can be answered 429 during an incident. That is the exact failure the comment warns about.

The global ceiling next door does it right: src/middleware/globalRateLimit.ts line 44 compares the routed path, not the raw URL.

What to build
  • Make the exemption match the route, not the raw URL, so any query string on /status, /live and /ready is still exempt. The /v1/... forms must be exempt too.
  • Do not exempt anything else. Do not change any limit value.
  • Add tests that set a very low RATE_LIMIT_IP_MAX, call /status?network=testnet more times than the limit, and get no 429; and that a normal route still gets 429.
Where to look
  • src/app.ts lines 62 and 168 to 186
  • src/middleware/globalRateLimit.ts line 44
  • src/__tests__/rateLimitContract.test.ts, tests/healthProbes.test.ts
Done when
  • /status, /live and /ready are exempt with and without a query string, on bare and /v1 paths
  • A non-probe route is still limited, proved by a test
  • No rate limit, scope or CORS rule was removed or loosened
  • npm test passes

Drips Wave · Complexity: Easy · 100 points


Repo: Divinity-Labs/Lens. Install with npm ci, typecheck with npx tsc --noEmit, test with npm test. Tests are vitest. Do not run jest: it reports zero tests and proves nothing.

You cannot reach the production service. Prove your change with local tests and fixtures. Mock the database (pgPool, prisma) the way the existing tests in src/__tests__/ and tests/ do.

Generated files are checked byte for byte by CI. If you add or change a route, edit openapi.yaml by hand and then regenerate the generated files and commit them: npm run openapi:gen (writes openapi.json and the README sections), npm run client:gen (the TypeScript client schema) and, if you touched the GraphQL schema, npm run graphql:schema:gen (writes schema.graphql). The full list is in the scripts section of package.json; also read CONTRIBUTING.md. If a check fails and the diff looks empty, it is line endings: commit with LF.

Prices are high-precision decimals. Do not add a new place where a price or amount goes through parseFloat, Number() or ::float before it reaches the caller.

MCP tools must return exactly the fields the matching REST route returns (tests/mcp-lens.test.ts asserts equality), and the MCP tool modules must not import the database driver directly. Reads are injected.

Do not remove or loosen an existing API-key scope, CORS rule or rate limit, and do not replace src/app.ts wholesale. Past pull requests did both by accident.

Do not weaken a test to make it pass. No real user data, wallet addresses of real users, keys, tokens or connection strings in code, tests or fixtures. Never shorten a Stellar address or contract id; copy it in full from the file that defines it.



Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk

Lenguaje dominante
TypeScript
Estrellas
4
Forks
71
Merge medio
2 d 6 h
PR fusionados (30 d)
24

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Divinity-Labs/Lens

Todos los issues de Divinity-Labs/Lens

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.