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
Mask subgraph errors before they reach clients, preventing internal details from leaking.
11
+
12
+
Masking is **enabled by default**: subgraph error messages are replaced with `"Unexpected error"`. It runs last in the pipeline, so metrics, tracing, and logging still see the original error.
13
+
14
+
Configure it under `error_masking`:
15
+
16
+
```yaml
17
+
error_masking:
18
+
redacted_error_message: "Unexpected error"
19
+
all:
20
+
error_message: true
21
+
extensions:
22
+
mode: allow # allow | deny
23
+
keys:
24
+
- code
25
+
subgraphs:
26
+
products:
27
+
error_message: false
28
+
```
29
+
30
+
- `error_message` toggles message redaction; `extensions` redacts extension keys via an `allow`/`deny` list.
31
+
- `subgraphs.<name>`overrides `all` per subgraph, inheriting any field it doesn't set.
32
+
- Set `DISABLE_SUBGRAPH_ERROR_MASKING=true` to disable message masking without editing the config.
Copy file name to clipboardExpand all lines: docs/README.md
+17-11Lines changed: 17 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@
9
9
|[**cors**](#cors)|`object`|Configuration for CORS (Cross-Origin Resource Sharing).<br/>Default: `{"allow_any_origin":false,"allow_credentials":false,"enabled":false,"policies":[]}`<br/>|yes|
10
10
|[**csrf**](#csrf)|`object`|Configuration for CSRF prevention.<br/>Default: `{"enabled":false,"required_headers":[]}`<br/>||
|[**error\_masking**](#error_masking)|`object`|Configuration for error masking.<br/>Default: `{"all":{"error_message":true,"extensions":null},"redacted_error_message":"Unexpected error"}`<br/>||
12
+
|[**error\_masking**](#error_masking)|`object`|Configuration for error masking.<br/>Default: `{"all":{"error_message":true},"redacted_error_message":"Unexpected error"}`<br/>||
13
13
|[**headers**](#headers)|`object`|Configuration for the headers.<br/>Default: `{}`<br/>||
14
14
|[**http**](#http)|`object`|Configuration for the HTTP server/listener.<br/>Default: `{"graphql_endpoint":"/graphql","host":"0.0.0.0","port":4000}`<br/>||
15
15
|**introspection**||Configuration to enable or disable introspection queries.<br/>||
@@ -61,7 +61,6 @@ csrf:
61
61
error_masking:
62
62
all:
63
63
error_message: true
64
-
extensions: null
65
64
redacted_error_message: Unexpected error
66
65
headers:
67
66
all:
@@ -1011,42 +1010,48 @@ Configuration for error masking.
|[**all**](#error_maskingall)|`object`|The default error masking configuration for all subgraphs.<br/>Default: `{"error_message":true}`<br/>||
1014
+
|**redacted\_error\_message**|`string`|The error message to redact in subgraph errors. The default is "Unexpected error".<br/>Default: `"Unexpected error"`<br/>||
1015
+
|[**subgraphs**](#error_maskingsubgraphs)|`object`, `null`|The error masking configuration for individual subgraphs.<br/>||
1017
1016
1018
1017
**Additional Properties:** not allowed
1019
1018
**Example**
1020
1019
1021
1020
```yaml
1022
1021
all:
1023
1022
error_message: true
1024
-
extensions: null
1025
1023
redacted_error_message: Unexpected error
1026
1024
1027
1025
```
1028
1026
1029
1027
<a name="error_maskingall"></a>
1030
1028
### error\_masking\.all: object
1031
1029
1030
+
The default error masking configuration for all subgraphs.
1031
+
1032
+
1032
1033
**Properties**
1033
1034
1034
1035
|Name|Type|Description|Required|
1035
1036
|----|----|-----------|--------|
1036
-
|**error\_message**|`boolean`, `null`|||
1037
-
|**extensions**||||
1037
+
|**error\_message**|`boolean`|Whether to redact the error message in subgraph errors. The default is `true`.<br/><br/>This field can be set to `false`, in order to disable error masking, by setting the `DISABLE_SUBGRAPH_ERROR_MASKING=true` environment variable.<br/>Default: `true`<br/>||
1038
+
|**extensions**||Whether to redact the `extensions` in errors.<br/><br/>You may pick the execution mode by setting `mode: allow` or `mode: deny`.<br/>Note: only root-level fields are supported.<br/>||
1038
1039
1040
+
**Additional Properties:** not allowed
1039
1041
**Example**
1040
1042
1041
1043
```yaml
1042
1044
error_message: true
1043
-
extensions: null
1044
1045
1045
1046
```
1046
1047
1047
1048
<a name="error_maskingsubgraphs"></a>
1048
1049
### error\_masking\.subgraphs: object,null
1049
1050
1051
+
The error masking configuration for individual subgraphs.
1052
+
Any configuration field that will be specified here, will override the configuration in `all`.
1053
+
1054
+
1050
1055
**Additional Properties**
1051
1056
1052
1057
|Name|Type|Description|Required|
@@ -1060,9 +1065,10 @@ extensions: null
1060
1065
1061
1066
|Name|Type|Description|Required|
1062
1067
|----|----|-----------|--------|
1063
-
|**error\_message**|`boolean`, `null`|||
1064
-
|**extensions**||||
1068
+
|**error\_message**|`boolean`, `null`|Whether to redact the `error_message` in errors, for that specific subgraph.<br/><br/>Configuring this will override the global `all.error_message` setting.<br/>||
1069
+
|**extensions**||Whether to redact the `extensions` in errors, for that specific subgraph.<br/>Configuring this will override the global `all.extensions` setting.<br/><br/>You may pick the execution mode by setting `mode: allow` or `mode: deny`.<br/>Note: only root-level fields are supported.<br/>||
0 commit comments