Skip to content

Commit

Permalink
fix(s3,): 🐛 Fix "range" header not included within canonical headers …
Browse files Browse the repository at this point in the history
…string and signature calculation
  • Loading branch information
Hobart2967 committed Oct 6, 2023
1 parent dbf59b4 commit f2d903a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/services/request-verification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class RequestVerificationService {

if (authorization && !authorization.startsWith('AWS4-HMAC-SHA256 ')) {
logger.debug('Unknown authorization handling found. Uri is not whitelisted for this, so flushing a 400');
return this.unauthorized
return this.unauthorized;
}

logger.debug('AWS4 Signature found. Counterchecking signature...', request);
Expand All @@ -99,6 +99,10 @@ export class RequestVerificationService {

const headers = this.getCleansedHeaders(request, incomingSignature);

const extraHeadersToInclude = [
'range'
].filter(x => Object.keys(request.headers).includes(x));

const extraHeadersToIgnore: { [header: string]: boolean } =
Object
.keys(request.headers)
Expand All @@ -120,7 +124,8 @@ export class RequestVerificationService {
service: incomingSignature.credential.service,
headers,
region: incomingSignature.credential.region,
extraHeadersToIgnore
extraHeadersToIgnore,
extraHeadersToInclude
} as any;

this._logger.debug('Counter-Check request build: ' + JSON.stringify(requestData));
Expand Down

0 comments on commit f2d903a

Please sign in to comment.