mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-04 14:08:39 +00:00
Fixes #35033 ## Problem The GraphQL HTTP handler decoded request bodies directly before executing the query. Unlike the JSON-RPC HTTP path, `/graphql` did not have an explicit request body limit before JSON decoding. A single `Decode` also stops after the first JSON value, so the handler now requires EOF after the GraphQL request object to ensure oversized trailing request data is not ignored. ## Changes - Limit GraphQL request bodies to 5 MiB, matching the existing JSON-RPC default body limit. - Return `413 Request Entity Too Large` when the limit is exceeded. - Require EOF after the request JSON object. - Add regression coverage for oversized query bodies and oversized trailing request data. - Fix an existing GraphQL test fixture that had an unintended trailing quote after the JSON object. ## Validation - `gofmt -w graphql/service.go graphql/graphql_test.go` - `go run golang.org/x/tools/cmd/goimports@latest -w graphql/service.go graphql/graphql_test.go` - `go test ./graphql -run TestGraphQLHTTPBodyLimit -count=1` - `go test ./graphql -count=1` |
||
|---|---|---|
| .. | ||
| internal/graphiql | ||
| graphiql.go | ||
| graphql.go | ||
| graphql_test.go | ||
| schema.go | ||
| service.go | ||