chore(dep): update aws4 (#4580)

This commit is contained in:
Dimitri Mitropoulos 2022-03-17 07:47:02 -04:00 committed by GitHub
parent 0f1030f64f
commit fdfa25b876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 29 deletions

View File

@ -984,33 +984,30 @@ export function _getAwsAuthHeaders(
): {
name: string;
value: string;
description?: string;
disabled?: boolean;
}[] {
const parsedUrl = urlParse(url);
const contentTypeHeader = getContentTypeHeader(headers);
// AWS uses host header for signing so prioritize that if the user set it manually
const hostHeader = getHostHeader(headers);
const host = hostHeader ? hostHeader.value : parsedUrl.host;
const awsSignOptions = {
const awsSignOptions: aws4.Request = {
service,
region,
host,
...(host ? { host } : {}),
body,
method,
path: parsedUrl.path,
headers: contentTypeHeader
? {
'content-type': contentTypeHeader.value,
}
: {},
...(parsedUrl.path ? { path: parsedUrl.path } : {}),
headers: contentTypeHeader ? { 'content-type': contentTypeHeader.value } : {},
};
const signature = aws4.sign(awsSignOptions, credentials);
if (!signature.headers) {
return [];
}
return Object.keys(signature.headers)
.filter(name => name !== 'content-type') // Don't add this because we already have it
.map(name => ({
name,
value: signature.headers[name],
value: String(signature.headers?.[name]),
}));
}

View File

@ -13,7 +13,7 @@
"@hapi/hawk": "^8.0.0",
"@stoplight/spectral": "^5.9.0",
"analytics-node": "^6.0.0",
"aws4": "^1.9.0",
"aws4": "^1.11.0",
"axios": "^0.21.2",
"class-autobind-decorator": "^3.0.1",
"classnames": "^2.3.1",
@ -95,7 +95,7 @@
"@testing-library/react-hooks": "^5.1.2",
"@testing-library/user-event": "^14.0.0-beta.7",
"@types/analytics-node": "^3.1.7",
"@types/aws4": "^1.5.1",
"@types/aws4": "^1.11.1",
"@types/clone": "^2.1.0",
"@types/codemirror": "^5.60.2",
"@types/color": "^3.0.1",
@ -7410,10 +7410,13 @@
"dev": true
},
"node_modules/@types/aws4": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/@types/aws4/-/aws4-1.5.1.tgz",
"integrity": "sha1-Nh+tqxmKAwqzmCaRg64/qG6Vjtk=",
"dev": true
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@types/aws4/-/aws4-1.11.1.tgz",
"integrity": "sha512-yUnPMlHP5JMZJiiNZElJG5qj1ShezlaET6Bug9SBhYsxKVamh7aOwl7Q/XR1Y//cZ5PoeRb9j4hi9svb2+FLlg==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/babel__core": {
"version": "7.1.12",
@ -9975,9 +9978,9 @@
}
},
"node_modules/aws4": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz",
"integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA=="
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz",
"integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA=="
},
"node_modules/axios": {
"version": "0.21.2",
@ -37900,10 +37903,13 @@
"dev": true
},
"@types/aws4": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/@types/aws4/-/aws4-1.5.1.tgz",
"integrity": "sha1-Nh+tqxmKAwqzmCaRg64/qG6Vjtk=",
"dev": true
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@types/aws4/-/aws4-1.11.1.tgz",
"integrity": "sha512-yUnPMlHP5JMZJiiNZElJG5qj1ShezlaET6Bug9SBhYsxKVamh7aOwl7Q/XR1Y//cZ5PoeRb9j4hi9svb2+FLlg==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/babel__core": {
"version": "7.1.12",
@ -40157,9 +40163,9 @@
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg="
},
"aws4": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz",
"integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA=="
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz",
"integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA=="
},
"axios": {
"version": "0.21.2",

View File

@ -82,7 +82,7 @@
"@hapi/hawk": "^8.0.0",
"@stoplight/spectral": "^5.9.0",
"analytics-node": "^6.0.0",
"aws4": "^1.9.0",
"aws4": "^1.11.0",
"axios": "^0.21.2",
"class-autobind-decorator": "^3.0.1",
"classnames": "^2.3.1",
@ -189,7 +189,7 @@
"@testing-library/react-hooks": "^5.1.2",
"@testing-library/user-event": "^14.0.0-beta.7",
"@types/analytics-node": "^3.1.7",
"@types/aws4": "^1.5.1",
"@types/aws4": "^1.11.1",
"@types/clone": "^2.1.0",
"@types/codemirror": "^5.60.2",
"@types/color": "^3.0.1",