Compare commits

..

No commits in common. "6aca59eb605eb131051175c40fd5db4209efe0c6" and "26a046c9b2510a96288989f692bbc221d8be94ad" have entirely different histories.

6 changed files with 8 additions and 15 deletions

View File

@ -70,17 +70,10 @@ export default function createCanonicalRequest(
signedHeadersList.sort((a: any, b: any) => a.localeCompare(b));
const signedHeaders = signedHeadersList.join(';');
const isProxyHost = !!pHeaders.proxyhost;
// canonical headers
const canonicalHeadersList = signedHeadersList.map((signedHeader: any) => {
if (pHeaders[signedHeader] !== undefined) {
// const trimmedHeader = pHeaders[signedHeader]
// .trim().replace(/\s+/g, ' ');
let header = pHeaders[signedHeader];
if (isProxyHost && signedHeader.toLowerCase() === 'host') {
header = pHeaders.proxyhost;
}
const trimmedHeader = header
const trimmedHeader = pHeaders[signedHeader]
.trim().replace(/\s+/g, ' ');
return `${signedHeader}:${trimmedHeader}\n`;
}

View File

@ -133,9 +133,9 @@ export function check(
}
let proxyPath: string | undefined;
if (request.headers.proxypath) {
if (request.headers.proxy_path) {
try {
proxyPath = decodeURIComponent(request.headers.proxypath);
proxyPath = decodeURIComponent(request.headers.proxy_path);
} catch (err) {
log.debug('invalid proxy_path header', { proxyPath, err });
return { err: errors.InvalidArgument.customizeDescription(

View File

@ -57,9 +57,9 @@ export function check(request: any, log: Logger, data: { [key: string]: string }
}
let proxyPath: string | undefined;
if (request.headers.proxypath) {
if (request.headers.proxy_path) {
try {
proxyPath = decodeURIComponent(request.headers.proxypath);
proxyPath = decodeURIComponent(request.headers.proxy_path);
} catch (err) {
log.debug('invalid proxy_path header', { proxyPath });
return { err: errors.InvalidArgument.customizeDescription(

View File

@ -6,7 +6,7 @@ const awsURIencode =
const createCanonicalRequest =
require('../../../../lib/auth/v4/createCanonicalRequest').default;
describe.skip('createCanonicalRequest function', () => {
describe('createCanonicalRequest function', () => {
// Example taken from: http://docs.aws.amazon.com/AmazonS3/
// latest/API/sig-v4-header-based-auth.html
it('should construct a canonical request in accordance ' +

View File

@ -35,7 +35,7 @@ const request = {
query: {},
};
describe.skip('v4 headerAuthCheck', () => {
describe('v4 headerAuthCheck', () => {
[
{ token: undefined, error: false },
{ token: 'invalid-token', error: true },

View File

@ -34,7 +34,7 @@ const request = {
query,
};
describe.skip('v4 queryAuthCheck', () => {
describe('v4 queryAuthCheck', () => {
it('should return error if algorithm param incorrect', done => {
const alteredRequest = createAlteredRequest({ 'X-Amz-Algorithm':
'AWS4-HMAC-SHA1' }, 'query', request, query);