[Bug]: GraphQL has no complexity or alias limit

Aperta
#125 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
graphql, rust
Ambito
backend, security

Direzione di ricerca

Start at src/api/schema.rs around line 112, where limit_depth(16) is set on the schema builder, and read the surrounding schema construction plus the expensive root fields (library listings, probes) mentioned in the issue. Read the async-graphql docs for limit_complexity and the complexity field attribute, then decide a cost budget and whether alias/root-field caps are needed. Done means a schema test showing an over-cost query (e.g. one field aliased hundreds of times) is rejected while normal queries still pass; no such test file exists yet, so one will have to be added.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

[!NOTE]
This issue was written by Claude (Claude Opus 5.5) from a code review session with @PhrolovaMoe. It was found by reading the code and hasn't been reproduced on a running server.

Version

0.40.0 (feat/desktop, 017a837b)

Area

Other

What happened?

The schema only sets limit_depth(16) (src/api/schema.rs:112). One request can alias an expensive field (like library listings or probes) hundreds of times, and any signed-in user can make the server do a lot of work with it.

Expected behavior

Requests over a reasonable cost are rejected.

Suggested fix

Add .limit_complexity(…) (with complexity on expensive fields) and cap aliases or the number of root fields per request.

Lingua principale
TypeScript
Stelle
4
Fork
1
Merge medio
4h 49m
PR unite (30g)
5

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tinystream-dev/tinystream

Tutte le issue di tinystream-dev/tinystream

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.