Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 99b1d1d

Browse files
committed
Reduced limiting values
1 parent 88fb398 commit 99b1d1d

File tree

3 files changed

+7
-174
lines changed

3 files changed

+7
-174
lines changed

app/code/Magento/GraphQl/etc/di.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@
9999
</type>
100100
<type name="Magento\Framework\GraphQl\Query\QueryComplexityLimiter">
101101
<arguments>
102-
<argument name="queryDepth" xsi:type="number">50</argument>
103-
<argument name="queryComplexity" xsi:type="number">150</argument>
102+
<argument name="queryDepth" xsi:type="number">10</argument>
103+
<argument name="queryComplexity" xsi:type="number">50</argument>
104104
</arguments>
105105
</type>
106106
</config>

dev/tests/api-functional/testsuite/Magento/GraphQl/Framework/QueryComplexityLimiterTest.php

Lines changed: 3 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -86,109 +86,6 @@ public function testQueryComplexityIsLimited()
8686
id
8787
types
8888
}
89-
categories {
90-
id
91-
position
92-
level
93-
url_key
94-
url_path
95-
product_count
96-
breadcrumbs {
97-
category_id
98-
category_name
99-
category_url_key
100-
}
101-
products {
102-
items {
103-
name
104-
special_from_date
105-
special_to_date
106-
new_to_date
107-
new_from_date
108-
tier_price
109-
manufacturer
110-
thumbnail
111-
sku
112-
image
113-
canonical_url
114-
updated_at
115-
created_at
116-
categories {
117-
id
118-
position
119-
level
120-
url_key
121-
url_path
122-
product_count
123-
breadcrumbs {
124-
category_id
125-
category_name
126-
category_url_key
127-
}
128-
products {
129-
items {
130-
name
131-
special_from_date
132-
special_to_date
133-
new_to_date
134-
new_from_date
135-
tier_price
136-
manufacturer
137-
sku
138-
image
139-
canonical_url
140-
updated_at
141-
created_at
142-
categories {
143-
id
144-
position
145-
level
146-
url_key
147-
url_path
148-
product_count
149-
breadcrumbs {
150-
category_id
151-
category_name
152-
category_url_key
153-
}
154-
products {
155-
items {
156-
name
157-
special_from_date
158-
special_to_date
159-
new_to_date
160-
new_from_date
161-
tier_price
162-
manufacturer
163-
sku
164-
image
165-
thumbnail
166-
canonical_url
167-
updated_at
168-
created_at
169-
categories {
170-
id
171-
position
172-
level
173-
url_key
174-
url_path
175-
product_count
176-
default_sort_by
177-
breadcrumbs {
178-
category_id
179-
category_name
180-
category_url_key
181-
}
182-
}
183-
}
184-
}
185-
}
186-
}
187-
}
188-
}
189-
}
190-
}
191-
}
19289
}
19390
}
19491
}
@@ -201,7 +98,7 @@ public function testQueryComplexityIsLimited()
20198
}
20299
QUERY;
203100

204-
self::expectExceptionMessageRegExp('/Max query complexity should be 150 but got 151/');
101+
self::expectExceptionMessageRegExp('/Max query complexity should be 50 but got 62/');
205102
$this->graphQlQuery($query);
206103
}
207104

@@ -238,71 +135,7 @@ public function testQueryDepthIsLimited()
238135
categories {
239136
products {
240137
items {
241-
categories {
242-
products {
243-
items {
244-
categories {
245-
products {
246-
items {
247-
categories {
248-
products {
249-
items {
250-
name,
251-
categories {
252-
products {
253-
items {
254-
categories {
255-
products {
256-
items {
257-
categories{
258-
products {
259-
items {
260-
categories {
261-
products {
262-
items {
263-
categories {
264-
products {
265-
items {
266-
categories {
267-
products {
268-
items {
269-
name,
270-
categories {
271-
products {
272-
items {
273-
categories {
274-
name
275-
}
276-
}
277-
}
278-
}
279-
}
280-
}
281-
}
282-
}
283-
}
284-
}
285-
}
286-
}
287-
}
288-
}
289-
}
290-
}
291-
}
292-
}
293-
}
294-
}
295-
}
296-
}
297-
}
298-
}
299-
}
300-
}
301-
}
302-
}
303-
}
304-
}
305-
}
138+
name
306139
}
307140
}
308141
}
@@ -326,7 +159,7 @@ public function testQueryDepthIsLimited()
326159
}
327160
}
328161
QUERY;
329-
self::expectExceptionMessageRegExp('/Max query depth should be 50 but got 51/');
162+
self::expectExceptionMessageRegExp('/Max query depth should be 10 but got 20/');
330163
$this->graphQlQuery($query);
331164
}
332165
}

lib/internal/Magento/Framework/GraphQl/Query/QueryComplexityLimiter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class QueryComplexityLimiter
3434
* @param int $queryComplexity
3535
*/
3636
public function __construct(
37-
int $queryDepth = 50,
38-
int $queryComplexity = 150
37+
int $queryDepth = 10,
38+
int $queryComplexity = 50
3939
) {
4040
$this->queryDepth = $queryDepth;
4141
$this->queryComplexity = $queryComplexity;

0 commit comments

Comments
 (0)