[Bug]: 2.0 rejects filter-variable queries with HC0047; Hot Chocolate cost limits are not configurable
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
Comienza en Startup.AddGraphQLService, donde según se informa no se llama a ModifyCostOptions, e inspecciona el manejo de runtime.graphql para la configuración existente de depth-limit. Reproduce el problema enviando mediante POST una consulta con una variable de filtro a /graphql después de dab init; luego verifica que el comportamiento de los costes sea configurable y que los filtros válidos proporcionados mediante variables ya no fallen inesperadamente con HC0047.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
[Bug]: 2.0 GA rejects filter: $variable queries with HC0047 — cost limits are not configurable
What happened?
After upgrading from 1.7.93 to 2.0.8, every query that passes a whole filter input as a GraphQL variable fails with:
{
"errors": [{
"message": "The maximum allowed field cost was exceeded.",
"extensions": { "code": "HC0047", "fieldCost": 1325, "maxFieldCost": 1000 }
}]
}
Hot Chocolate 16 (bundled since 2.0) enables static cost analysis by default with MaxFieldCost = 1000, and DAB exposes no configuration for it — runtime.graphql only has depth-limit; ModifyCostOptions is never called in Startup.AddGraphQLService.
Why this breaks virtually every real client
Generated *FilterInput types are self-referential (and: [XFilterInput!], or: [XFilterInput!]). When a filter is supplied as a variable, the cost analyzer prices the input type's recursive worst case, not the actual value. Measured against a DAB 2.0.8 instance (MSSQL, 131 entities) using GraphQL-Cost: validate:
| query shape | fieldCost |
|---|---|
organizations(first: 20) { items { id } } |
30 |
same + inline literal filter {status: {name: {in: [$name]}}} |
33 |
same + filter: $f variable (no value even supplied) |
1243 |
The ~1200 floor is entity-independent — a 3-column lookup table's filter variable prices at ~1202 — so every filter: $variable query exceeds the 1000 default. In our app that's 79 call sites across 48 routes, i.e. every list page. filter: $variable is the natural pattern for dynamic filtering (and what most GraphQL client codegen produces), and it worked on 1.x.
Related upstream: ChilliCream/graphql-platform#9548 (cost assumes two levels of recursion for circular references).
Expected
Either (preferably both):
runtime.graphqlconfig for cost analysis — e.g.cost: { enforce: bool, max-field-cost: int, max-type-cost: int }— mirroring the existingdepth-limitknob.- Defaults that don't reject variable-supplied filters on every entity (e.g. enforcement off unless configured, or variable inputs priced by provided value rather than recursive worst case).
Steps to reproduce
dab initagainst any MSSQL database, add any table entity, start DAB 2.0.8.POST /graphqlwithquery Q($f: <Entity>FilterInput) { <entities>(filter: $f) { items { __typename } } }and any (or no) variable value.- Observe HC0047 with fieldCost ≈ 1200+ vs maxFieldCost 1000.
Version
2.0.8 (the v2.0.9 tag contains no cost-related changes, so it is equally affected)
What database are you using?
Azure SQL / SQL Server
What hosting model are you using?
Container (App Service)
- Lenguaje dominante
- C#
- Estrellas
- 1.5k
- Forks
- 372
- Merge medio
- 7 d 19 h
- PR fusionados (30 d)
- 10
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 Azure/data-api-builder
-
pgsql
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/data-api-builder#3598 ·
-
2.x cli mcp-server
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/data-api-builder#3576 ·
-
2.x health-endpoint
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/data-api-builder#3570 ·
-
2.x telemetry
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/data-api-builder#3564 ·
-
2.x telemetry
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Azure/data-api-builder#3562 ·
Todos los issues de Azure/data-api-builder
Issues similares
-
untriaged
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
dotnet/dotnet-api-docs#13095 ·
-
area-deployment area-integrations triage:bot-seen
Dificultad 2/5 Medio día Aptitud para principiantes 86/100
-
type/automation type/tech-debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
newrelic/newrelic-dotnet-agent#3850 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
LuckyPennySoftware/AutoMapper#4660 ·