[Bug]: 2.0 rejects filter-variable queries with HC0047; Hot Chocolate cost limits are not configurable
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Bắt đầu trong Startup.AddGraphQLService, nơi được báo cáo là ModifyCostOptions không được gọi, và kiểm tra cách xử lý runtime.graphql đối với thiết lập depth-limit hiện có. Tái hiện sự cố bằng cách POST một truy vấn có biến bộ lọc tới /graphql sau dab init, sau đó xác minh rằng hành vi chi phí có thể cấu hình được và các bộ lọc hợp lệ được cung cấp qua biến không còn bất ngờ thất bại với HC0047.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
[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)
- Ngôn ngữ chính
- C#
- Star
- 1.5k
- Fork
- 372
- Merge trung bình
- 9 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Azure/data-api-builder
-
pgsql
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/data-api-builder#3598 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
2.x cli mcp-server
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/data-api-builder#3576 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
2.x health-endpoint
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/data-api-builder#3570 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
2.x telemetry
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/data-api-builder#3564 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
2.x telemetry
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Azure/data-api-builder#3562 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Azure/data-api-builder
Issue tương tự
-
ci-failure-cause test-failure
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
area:frontend bug FE hotspot:css mvp P3
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
klasolsson81/jobbliggaren#1856 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Area: App+Library Build
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Aaronontheweb/freshdesk-cli#148 ·