@graphql-hive/plugin-aws-sigv4 2.0.66 → 2.0.67-alpha-a69e18c2b1e7fe329c741c8ceb9a8943983b6dae
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 +7 -0
- package/dist/index.cjs +7 -1
- package/dist/index.js +8 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @graphql-hive/plugin-aws-sigv4
|
|
2
2
|
|
|
3
|
+
## 2.0.67-alpha-a69e18c2b1e7fe329c741c8ceb9a8943983b6dae
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [`fd2a194`](https://github.com/graphql-hive/gateway/commit/fd2a194f309c6e7e2b52cd82c0e3aee28e1d79e4) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Verify incoming AWS SigV4 request bodies against the signed `x-amz-content-sha256` value
|
|
9
|
+
|
|
3
10
|
## 2.0.66
|
|
4
11
|
### Patch Changes
|
|
5
12
|
|
package/dist/index.cjs
CHANGED
|
@@ -263,7 +263,7 @@ function useAWSSigv4(opts) {
|
|
|
263
263
|
}
|
|
264
264
|
);
|
|
265
265
|
},
|
|
266
|
-
(payload) => {
|
|
266
|
+
async (payload) => {
|
|
267
267
|
if (!payload) {
|
|
268
268
|
return;
|
|
269
269
|
}
|
|
@@ -338,6 +338,12 @@ function useAWSSigv4(opts) {
|
|
|
338
338
|
serverContext
|
|
339
339
|
);
|
|
340
340
|
}
|
|
341
|
+
if (payload.bodyHash !== "UNSIGNED-PAYLOAD" && payload.bodyHash !== require$$2.createHash("sha256").update(Buffer.from(await request.clone().arrayBuffer())).digest("hex")) {
|
|
342
|
+
return incomingOptions.onSignatureMismatch?.(
|
|
343
|
+
request,
|
|
344
|
+
serverContext
|
|
345
|
+
);
|
|
346
|
+
}
|
|
341
347
|
return incomingOptions.onSuccess?.(payload);
|
|
342
348
|
}
|
|
343
349
|
);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createHash, createHmac } from 'node:crypto';
|
|
2
2
|
import { STS } from '@aws-sdk/client-sts';
|
|
3
3
|
import { handleMaybePromise } from '@whatwg-node/promise-helpers';
|
|
4
4
|
import aws4 from 'aws4';
|
|
@@ -257,7 +257,7 @@ function useAWSSigv4(opts) {
|
|
|
257
257
|
}
|
|
258
258
|
);
|
|
259
259
|
},
|
|
260
|
-
(payload) => {
|
|
260
|
+
async (payload) => {
|
|
261
261
|
if (!payload) {
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
@@ -332,6 +332,12 @@ function useAWSSigv4(opts) {
|
|
|
332
332
|
serverContext
|
|
333
333
|
);
|
|
334
334
|
}
|
|
335
|
+
if (payload.bodyHash !== "UNSIGNED-PAYLOAD" && payload.bodyHash !== createHash("sha256").update(Buffer.from(await request.clone().arrayBuffer())).digest("hex")) {
|
|
336
|
+
return incomingOptions.onSignatureMismatch?.(
|
|
337
|
+
request,
|
|
338
|
+
serverContext
|
|
339
|
+
);
|
|
340
|
+
}
|
|
335
341
|
return incomingOptions.onSuccess?.(payload);
|
|
336
342
|
}
|
|
337
343
|
);
|