Force pagination, limit query depth and complexity
This commit is contained in:
@@ -29,7 +29,8 @@ class GraphqlController < ApplicationController
|
||||
|
||||
GraphQL::Schema.define do
|
||||
query query_type
|
||||
max_depth 12
|
||||
max_depth 8
|
||||
max_complexity 2500
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ module GraphQL
|
||||
end
|
||||
when :multiple_association
|
||||
field_type = field_type.first
|
||||
connection(field_name, -> { created_types[field_type].connection_type }) do
|
||||
connection(field_name, -> { created_types[field_type].connection_type }, max_page_size: 50, complexity: 1000) do
|
||||
resolve -> (object, arguments, context) { field_type.public_for_api & object.send(field_name) }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -18,7 +18,7 @@ module GraphQL
|
||||
end
|
||||
end
|
||||
|
||||
connection model.graphql_pluralized_field_name, created_type.connection_type do
|
||||
connection(model.graphql_pluralized_field_name, created_type.connection_type, max_page_size: 50, complexity: 1000) do
|
||||
description model.graphql_pluralized_field_description
|
||||
resolve -> (object, arguments, context) { model.public_for_api }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user