[Bug]: GraphQL has no complexity or alias limit

Offen
#125 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
graphql, rust
Bereich
backend, security

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
TypeScript
Sterne
4
Forks
1
Ø Merge
4 Std. 49 Min.
Gemergte PRs (30 T.)
5

Entwicklungsumgebung

  • Enthält ein Dockerfile oder eine Docker-Compose-Datei
  • Keine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus tinystream-dev/tinystream

Alle Issues in tinystream-dev/tinystream

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.