@aws-sdk/middleware-flexible-checksums 3.973.6 → 3.974.1
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/dist-cjs/index.js
CHANGED
|
@@ -304,13 +304,17 @@ const flexibleChecksumsInputMiddleware = (config, middlewareConfig) => (next, co
|
|
|
304
304
|
|
|
305
305
|
const getChecksumAlgorithmListForResponse = (responseAlgorithms = []) => {
|
|
306
306
|
const validChecksumAlgorithms = [];
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
307
|
+
let i = PRIORITY_ORDER_ALGORITHMS.length;
|
|
308
|
+
for (const algorithm of responseAlgorithms) {
|
|
309
|
+
const priority = PRIORITY_ORDER_ALGORITHMS.indexOf(algorithm);
|
|
310
|
+
if (priority !== -1) {
|
|
311
|
+
validChecksumAlgorithms[priority] = algorithm;
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
validChecksumAlgorithms[i++] = algorithm;
|
|
310
315
|
}
|
|
311
|
-
validChecksumAlgorithms.push(algorithm);
|
|
312
316
|
}
|
|
313
|
-
return validChecksumAlgorithms;
|
|
317
|
+
return validChecksumAlgorithms.filter(Boolean);
|
|
314
318
|
};
|
|
315
319
|
|
|
316
320
|
const isChecksumWithPartNumber = (checksum) => {
|
|
@@ -385,9 +389,17 @@ const flexibleChecksumsResponseMiddleware = (config, middlewareConfig) => (next,
|
|
|
385
389
|
const { requestValidationModeMember, responseAlgorithms } = middlewareConfig;
|
|
386
390
|
if (requestValidationModeMember && input[requestValidationModeMember] === "ENABLED") {
|
|
387
391
|
const { clientName, commandName } = context;
|
|
392
|
+
const customChecksumAlgorithms = Object.keys(config.checksumAlgorithms ?? {}).filter((algorithm) => {
|
|
393
|
+
const responseHeader = getChecksumLocationName(algorithm);
|
|
394
|
+
return response.headers[responseHeader] !== undefined;
|
|
395
|
+
});
|
|
396
|
+
const algoList = getChecksumAlgorithmListForResponse([
|
|
397
|
+
...(responseAlgorithms ?? []),
|
|
398
|
+
...customChecksumAlgorithms,
|
|
399
|
+
]);
|
|
388
400
|
const isS3WholeObjectMultipartGetResponseChecksum = clientName === "S3Client" &&
|
|
389
401
|
commandName === "GetObjectCommand" &&
|
|
390
|
-
|
|
402
|
+
algoList.every((algorithm) => {
|
|
391
403
|
const responseHeader = getChecksumLocationName(algorithm);
|
|
392
404
|
const checksumFromResponse = response.headers[responseHeader];
|
|
393
405
|
return !checksumFromResponse || isChecksumWithPartNumber(checksumFromResponse);
|
|
@@ -397,7 +409,7 @@ const flexibleChecksumsResponseMiddleware = (config, middlewareConfig) => (next,
|
|
|
397
409
|
}
|
|
398
410
|
await validateChecksumFromResponse(response, {
|
|
399
411
|
config,
|
|
400
|
-
responseAlgorithms,
|
|
412
|
+
responseAlgorithms: algoList,
|
|
401
413
|
logger: context.logger,
|
|
402
414
|
});
|
|
403
415
|
}
|
|
@@ -20,9 +20,17 @@ export const flexibleChecksumsResponseMiddleware = (config, middlewareConfig) =>
|
|
|
20
20
|
const { requestValidationModeMember, responseAlgorithms } = middlewareConfig;
|
|
21
21
|
if (requestValidationModeMember && input[requestValidationModeMember] === "ENABLED") {
|
|
22
22
|
const { clientName, commandName } = context;
|
|
23
|
+
const customChecksumAlgorithms = Object.keys(config.checksumAlgorithms ?? {}).filter((algorithm) => {
|
|
24
|
+
const responseHeader = getChecksumLocationName(algorithm);
|
|
25
|
+
return response.headers[responseHeader] !== undefined;
|
|
26
|
+
});
|
|
27
|
+
const algoList = getChecksumAlgorithmListForResponse([
|
|
28
|
+
...(responseAlgorithms ?? []),
|
|
29
|
+
...customChecksumAlgorithms,
|
|
30
|
+
]);
|
|
23
31
|
const isS3WholeObjectMultipartGetResponseChecksum = clientName === "S3Client" &&
|
|
24
32
|
commandName === "GetObjectCommand" &&
|
|
25
|
-
|
|
33
|
+
algoList.every((algorithm) => {
|
|
26
34
|
const responseHeader = getChecksumLocationName(algorithm);
|
|
27
35
|
const checksumFromResponse = response.headers[responseHeader];
|
|
28
36
|
return !checksumFromResponse || isChecksumWithPartNumber(checksumFromResponse);
|
|
@@ -32,7 +40,7 @@ export const flexibleChecksumsResponseMiddleware = (config, middlewareConfig) =>
|
|
|
32
40
|
}
|
|
33
41
|
await validateChecksumFromResponse(response, {
|
|
34
42
|
config,
|
|
35
|
-
responseAlgorithms,
|
|
43
|
+
responseAlgorithms: algoList,
|
|
36
44
|
logger: context.logger,
|
|
37
45
|
});
|
|
38
46
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PRIORITY_ORDER_ALGORITHMS } from "./types";
|
|
2
2
|
export const getChecksumAlgorithmListForResponse = (responseAlgorithms = []) => {
|
|
3
3
|
const validChecksumAlgorithms = [];
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
let i = PRIORITY_ORDER_ALGORITHMS.length;
|
|
5
|
+
for (const algorithm of responseAlgorithms) {
|
|
6
|
+
const priority = PRIORITY_ORDER_ALGORITHMS.indexOf(algorithm);
|
|
7
|
+
if (priority !== -1) {
|
|
8
|
+
validChecksumAlgorithms[priority] = algorithm;
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
validChecksumAlgorithms[i++] = algorithm;
|
|
7
12
|
}
|
|
8
|
-
validChecksumAlgorithms.push(algorithm);
|
|
9
13
|
}
|
|
10
|
-
return validChecksumAlgorithms;
|
|
14
|
+
return validChecksumAlgorithms.filter(Boolean);
|
|
11
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-flexible-checksums",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.974.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
6
6
|
"build:cjs": "node ../../scripts/compilation/inline middleware-flexible-checksums",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@aws-crypto/crc32": "5.2.0",
|
|
38
38
|
"@aws-crypto/crc32c": "5.2.0",
|
|
39
39
|
"@aws-crypto/util": "5.2.0",
|
|
40
|
-
"@aws-sdk/core": "^3.973.
|
|
40
|
+
"@aws-sdk/core": "^3.973.21",
|
|
41
41
|
"@aws-sdk/crc64-nvme": "^3.972.5",
|
|
42
42
|
"@aws-sdk/types": "^3.973.6",
|
|
43
43
|
"@smithy/is-array-buffer": "^4.2.2",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"@smithy/protocol-http": "^5.3.12",
|
|
46
46
|
"@smithy/types": "^4.13.1",
|
|
47
47
|
"@smithy/util-middleware": "^4.2.12",
|
|
48
|
-
"@smithy/util-stream": "^4.5.
|
|
48
|
+
"@smithy/util-stream": "^4.5.20",
|
|
49
49
|
"@smithy/util-utf8": "^4.2.2",
|
|
50
50
|
"tslib": "^2.6.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@smithy/node-http-handler": "^4.
|
|
53
|
+
"@smithy/node-http-handler": "^4.5.0",
|
|
54
54
|
"concurrently": "7.0.0",
|
|
55
55
|
"downlevel-dts": "0.10.1",
|
|
56
56
|
"premove": "4.0.0",
|