Compare commits

..

No commits in common. "65b70ee0966ba2502f20b3387c0237f7d3e8d53f" and "4da59769d24ec0fa4590de1f826dd1dcab1872c6" have entirely different histories.

2 changed files with 4 additions and 14 deletions

View File

@ -173,7 +173,6 @@ function doAuth(
* @param [proxyPath] - path that gets proxied by reverse proxy
* @param [sessionToken] - security token if the access/secret keys
* are temporary credentials from STS
* @param [payload] - body of the request if any
*/
function generateV4Headers(
request: any,
@ -181,9 +180,8 @@ function generateV4Headers(
accessKey: string,
secretKeyValue: string,
awsService: string,
proxyPath?: string,
sessionToken?: string,
payload?: string,
proxyPath: string,
sessionToken: string
) {
Object.assign(request, { headers: {} });
const amzDate = convertUTCtoISO8601(Date.now());
@ -196,7 +194,7 @@ function generateV4Headers(
const timestamp = amzDate;
const algorithm = 'AWS4-HMAC-SHA256';
payload = payload || '';
let payload = '';
if (request.method === 'POST') {
payload = queryString.stringify(data, undefined, undefined, {
encodeURIComponent,
@ -207,13 +205,7 @@ function generateV4Headers(
request.setHeader('host', request._headers.host);
request.setHeader('x-amz-date', amzDate);
request.setHeader('x-amz-content-sha256', payloadChecksum);
if (request.path && request.path.includes('backbeat')) {
request.setHeader('content-md5', crypto.createHash('md5')
.update(payload, 'binary').digest('hex'));
} else {
request.setHeader('content-md5', crypto.createHash('md5')
.update(payload, 'binary').digest('base64'));
}
if (sessionToken) {
request.setHeader('x-amz-security-token', sessionToken);
}
@ -223,7 +215,6 @@ function generateV4Headers(
.filter(headerName =>
headerName.startsWith('x-amz-')
|| headerName.startsWith('x-scal-')
|| headerName === 'content-md5'
|| headerName === 'host'
).sort().join(';');
const params = { request, signedHeaders, payloadChecksum,

View File

@ -80,7 +80,6 @@
"lint_md": "mdlint $(git ls-files '*.md')",
"lint_yml": "yamllint $(git ls-files '*.yml')",
"test": "jest tests/unit",
"test_auth": "jest tests/unit/auth",
"build": "tsc",
"prepare": "yarn build",
"ft_test": "jest tests/functional --testTimeout=120000 --forceExit",