@graphql-mesh/hmac-upstream-signature 1.2.19-alpha-c1c9af06e2b55777ff5a00ff91a3f235f6917202 → 1.2.19-alpha-f0b9caef8c2ed033b8a6a3ec3a6b5fa38c7c67bd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -5
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -1,22 +1,46 @@
|
|
1
1
|
# @graphql-mesh/hmac-upstream-signature
|
2
2
|
|
3
|
-
## 1.2.19-alpha-
|
3
|
+
## 1.2.19-alpha-f0b9caef8c2ed033b8a6a3ec3a6b5fa38c7c67bd
|
4
4
|
|
5
5
|
### Patch Changes
|
6
6
|
|
7
|
-
- [#381](https://github.com/graphql-hive/gateway/pull/381) [`
|
7
|
+
- [#381](https://github.com/graphql-hive/gateway/pull/381) [`55eb1b4`](https://github.com/graphql-hive/gateway/commit/55eb1b4d14aec7b3e6c7bcf9f596bc01192d022c) Thanks [@ardatan](https://github.com/ardatan)! - dependencies updates:
|
8
8
|
|
9
9
|
- Added dependency [`@graphql-tools/executor-common@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-tools/executor-common/v/workspace:^) (to `dependencies`)
|
10
10
|
- Removed dependency [`@graphql-mesh/transport-common@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-mesh/transport-common/v/workspace:^) (from `dependencies`)
|
11
11
|
|
12
|
-
- [#381](https://github.com/graphql-hive/gateway/pull/381) [`
|
12
|
+
- [#381](https://github.com/graphql-hive/gateway/pull/381) [`55eb1b4`](https://github.com/graphql-hive/gateway/commit/55eb1b4d14aec7b3e6c7bcf9f596bc01192d022c) Thanks [@ardatan](https://github.com/ardatan)! - This is a bugfix with some internal changes, no user action is needed. This bugfix and improvement is done to improve the stability of some components of the gateway;
|
13
|
+
|
14
|
+
Like HMAC Upstream Signature plugin, different components of the gateway were using different ways of serializing the execution request.
|
13
15
|
Some of them were ignoring `variables` if it is empty, some of not, this was causing the signature generation to be different for the same query.
|
14
16
|
For example, it was working as expected in Proxy mode, but not working as expected in Federation Gateway mode.
|
15
17
|
|
16
18
|
With this change, now we have a shared helper to serialize the upstream execution request with a memoized `print` function for query AST etc to have a consistent serialization so consistent signature generation for HMAC.
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
+
For example instead of using `print`, you should use `defaultPrintFn` that memoizes `print` operation and also used the string version of it parsed before by Envelop/Yoga.
|
21
|
+
|
22
|
+
```diff
|
23
|
+
-import { print } from 'graphql';
|
24
|
+
-const query = print(parsedQuery);
|
25
|
+
+import { defaultPrintFn } from '@graphql-tools/executor-common';
|
26
|
+
+const query = defaultPrintFn(parsedQuery);
|
27
|
+
```
|
28
|
+
|
29
|
+
Or instead of creating objects from `ExecutionRequest`, use `serializeExecutionRequest` helper.
|
30
|
+
|
31
|
+
```diff
|
32
|
+
-const serializedRequest = {
|
33
|
+
- query: print(executionRequest.document),
|
34
|
+
- variables: executionRequest.variables,
|
35
|
+
- operationName: executionRequest.operationName,
|
36
|
+
- extensions: executionRequest.extensions,
|
37
|
+
-};
|
38
|
+
+import { serializeExecutionRequest } from '@graphql-tools/executor-common';
|
39
|
+
+const serializedRequest = serializeExecutionRequest(executionRequest);
|
40
|
+
```
|
41
|
+
|
42
|
+
- Updated dependencies [[`55eb1b4`](https://github.com/graphql-hive/gateway/commit/55eb1b4d14aec7b3e6c7bcf9f596bc01192d022c)]:
|
43
|
+
- @graphql-tools/executor-common@0.0.1-alpha-f0b9caef8c2ed033b8a6a3ec3a6b5fa38c7c67bd
|
20
44
|
|
21
45
|
## 1.2.18
|
22
46
|
|
package/dist/index.cjs
CHANGED
@@ -84,7 +84,7 @@ function useHmacUpstreamSignature(options) {
|
|
84
84
|
String.fromCharCode(...new Uint8Array(signature))
|
85
85
|
);
|
86
86
|
logger?.debug(
|
87
|
-
`produced hmac signature for subgraph ${subgraphName}, signature: ${
|
87
|
+
`produced hmac signature for subgraph ${subgraphName}, signature: ${extensionValue}, signed payload: ${serializedExecutionRequest}`
|
88
88
|
);
|
89
89
|
setExecutionRequest({
|
90
90
|
...executionRequest,
|
package/dist/index.js
CHANGED
@@ -78,7 +78,7 @@ function useHmacUpstreamSignature(options) {
|
|
78
78
|
String.fromCharCode(...new Uint8Array(signature))
|
79
79
|
);
|
80
80
|
logger?.debug(
|
81
|
-
`produced hmac signature for subgraph ${subgraphName}, signature: ${
|
81
|
+
`produced hmac signature for subgraph ${subgraphName}, signature: ${extensionValue}, signed payload: ${serializedExecutionRequest}`
|
82
82
|
);
|
83
83
|
setExecutionRequest({
|
84
84
|
...executionRequest,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graphql-mesh/hmac-upstream-signature",
|
3
|
-
"version": "1.2.19-alpha-
|
3
|
+
"version": "1.2.19-alpha-f0b9caef8c2ed033b8a6a3ec3a6b5fa38c7c67bd",
|
4
4
|
"type": "module",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -45,13 +45,13 @@
|
|
45
45
|
"@graphql-mesh/cross-helpers": "^0.4.9",
|
46
46
|
"@graphql-mesh/types": "^0.103.6",
|
47
47
|
"@graphql-mesh/utils": "^0.103.6",
|
48
|
-
"@graphql-tools/executor-common": "0.0.1-alpha-
|
48
|
+
"@graphql-tools/executor-common": "0.0.1-alpha-f0b9caef8c2ed033b8a6a3ec3a6b5fa38c7c67bd",
|
49
49
|
"@graphql-tools/utils": "^10.7.0",
|
50
50
|
"json-stable-stringify": "^1.1.1",
|
51
51
|
"tslib": "^2.8.1"
|
52
52
|
},
|
53
53
|
"devDependencies": {
|
54
|
-
"@graphql-hive/gateway": "1.7.4-alpha-
|
54
|
+
"@graphql-hive/gateway": "1.7.4-alpha-f0b9caef8c2ed033b8a6a3ec3a6b5fa38c7c67bd",
|
55
55
|
"@types/json-stable-stringify": "^1.1.0",
|
56
56
|
"graphql": "^16.9.0",
|
57
57
|
"graphql-yoga": "^5.10.6",
|