diff --git a/packages/insomnia-app/app/network/network.ts b/packages/insomnia-app/app/network/network.ts index 23ad9dfa9..dde9725c7 100644 --- a/packages/insomnia-app/app/network/network.ts +++ b/packages/insomnia-app/app/network/network.ts @@ -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]), })); } diff --git a/packages/insomnia-app/package-lock.json b/packages/insomnia-app/package-lock.json index 0878ac489..1df1a1d59 100644 --- a/packages/insomnia-app/package-lock.json +++ b/packages/insomnia-app/package-lock.json @@ -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", diff --git a/packages/insomnia-app/package.json b/packages/insomnia-app/package.json index 2eac36075..36afc331a 100644 --- a/packages/insomnia-app/package.json +++ b/packages/insomnia-app/package.json @@ -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",