You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/waf/policies/graphql-protection.md
+21-23Lines changed: 21 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -131,15 +131,13 @@ Under the "_blocking-settings_", you can selectively enable or disable these vio
131
131
132
132
Any changes to these violation settings will override the default settings, and the violation details will be recorded in the security log.
133
133
134
-
See also the [Violations](#violations) section for more details.
134
+
Since the GraphQL violations are enabled by default, you can change the GraphQL violations settings i.e. alarm: `true` and block: `false` under the "blocking settings".
135
135
136
-
While configuring GraphQL, since the GraphQL violations are enabled by default, you can change the GraphQL violations settings i.e. alarm: `true` and block: `false` under the "blocking settings". In this manner, the GraphQL profile detects violations but does not block the request. They may contribute to the Violation Rating, which, if raised above 3, will automatically block the request.
136
+
With this configuration the GraphQL profile detects violations but does not block the request. They may still contribute to the Violation Rating, which, if raised above 3, will automatically block the request.
137
137
138
-
However, setting the alarm and block to `true` will enforce block settings and App Protect will block any violating requests.
138
+
To block violating requests, set the alarm and block to `true`.
139
139
140
-
See below example for more details:
141
-
142
-
```shell
140
+
```json
143
141
{
144
142
"name": "graphql_policy",
145
143
"template": {
@@ -175,25 +173,25 @@ See below example for more details:
175
173
}
176
174
```
177
175
178
-
### GraphQL Profile
176
+
### GraphQL profile
179
177
180
-
{{< call-out "note" >}} For GraphQL profile default values and GraphQL violations reference, see NGINX App Protect WAF [Declarative Policy guide.]({{< ref "/nap-waf/v5/declarative-policy/policy.md" >}}) {{< /call-out >}}
178
+
The GraphQL profile defines the GraphQL properties that are enforced by the security policy.
181
179
182
-
The GraphQL Profile defines the GraphQL properties that are enforced by the security policy.
180
+
The profile can be added by the security engineers to make sure that GraphQL applications are bound to the same security settings defined in the profile.
183
181
184
-
The profile can be added by the security engineers to make sure that GraphQL apps are bound to the same security settings defined in the profile. Different GraphQL apps can have different profiles based on the security needs.
182
+
Different GraphQL applications can have different profiles based on their security needs.
185
183
186
-
The GraphQL Profile includes:
184
+
GraphQL profiles include:
187
185
188
-
-**Security enforcement**: whether to detect signatures and/or metacharacters and optionally an exception (a.k.a override) list of signatures that need to be disabled in the context of this profile.
189
-
-**Defense attributes**: special restrictions applied to the GraphQL traffic. The below example shows the customized GraphQL properties.
190
-
-**responseEnforcement**: whether to block Disallowed patterns and provide the list of patterns against the `disallowedPatterns` property.
186
+
-**Security enforcement**: Whether to detect signatures and/or metacharacters and an optional override list of signatures that need to be disabled in the context of this profile.
187
+
-**Defense attributes**: Special restrictions applied to the GraphQL traffic.
188
+
-**responseEnforcement**: Whether to block Disallowed patterns and the list of patterns for the `disallowedPatterns` property.
191
189
192
-
GraphQL profile example:
190
+
In the following GraphQL profile example, the "_defenseAttributes_" have been given custom values.
193
191
194
-
In the GraphQL profile example below, we changed the "defenseAttributes" to custom values. You can customize these values under the "defenseAttributes" property. Add a list of disallowed patterns to the "disallowedPatterns" field (for example, here we've added pattern1 and pattern2).
192
+
You can also add a list of disallowed patterns to the "_disallowedPatterns_" field, also visible in the example:
195
193
196
-
```shell
194
+
```json
197
195
"graphql-profiles" : [
198
196
{
199
197
"attackSignaturesCheck" : true,
@@ -217,17 +215,17 @@ In the GraphQL profile example below, we changed the "defenseAttributes" to cust
217
215
]
218
216
```
219
217
220
-
### Define URL settings
218
+
### URL settings
221
219
222
-
he second step to configure GraphQL is to define the URL settings. Set the values for "isAllowed": **true**, "name": **/graphql** in the URLs section, which means URLs with **/graphql** name are permitted. This path will be used for all GraphQL API requests.
220
+
The second step to configure GraphQL is to define the URL settings. Set the values for "isAllowed": **true**, "name": **/graphql** in the URLs section, which means URLs with **/graphql** name are permitted. This path will be used for all GraphQL API requests.
223
221
224
222
Under the "urlContentProfiles" settings define the GraphQL profile name, headerValue: `*` (wildcard), headerName: `*` (wildcard), headerOrder: `default` (allowing any GraphQL URL request with any headerValue, headerName and type should be `graphql`.
225
223
226
224
There are no restrictions on the number of GraphQL profiles that can be added by the user.
227
225
228
226
GraphQL URL example:
229
227
230
-
```shell
228
+
```json
231
229
"urls": [
232
230
{
233
231
"$action": "delete",
@@ -257,15 +255,15 @@ GraphQL URL example:
257
255
]
258
256
```
259
257
260
-
### Associating GraphQL Profiles with URL
258
+
### Associate GraphQL profiles with URLs
261
259
262
260
The last step is to associate the GraphQL profiles with the URLs. As with JSON and XML profiles, in order for a GraphQL Profile to become effective, it has to be associated with a URL that represents the service. Add the GraphQL profile name which you defined previously under the GraphQL profiles in the name field. For example, here we have defined two GraphQL profiles with the "name": "Default" and "My Custom Profile" under the urlContentProfiles. Later we also associated these profiles in "graphql-profiles".
263
261
264
262
GraphQL configuration example:
265
263
266
264
In this example we define a custom GraphQL profile and use it on one URL, while assigning the default profile to another one.
267
265
268
-
```shell
266
+
```json
269
267
{
270
268
"name": "graphql_policy",
271
269
"template": {
@@ -362,7 +360,7 @@ In this example we define a custom GraphQL profile and use it on one URL, while
362
360
}
363
361
```
364
362
365
-
### GraphQL Response Pages
363
+
### Response pages
366
364
367
365
A GraphQL error response page is returned when a request is blocked. This GraphQL response page, like other blocking response pages, can be customized, but the GraphQL JSON syntax must be preserved for them to be displayed correctly. The default page returns the GraphQL status code Blocking Response Page (BRP) and a short JSON error message which includes the support ID.
0 commit comments