Skip to content

Commit

Permalink
fix: 🐛 Fix content hash not working properly for lambda invocations
Browse files Browse the repository at this point in the history
  • Loading branch information
Hobart2967 committed Oct 1, 2023
1 parent c8dd0e7 commit ea607a0
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/services/request-verification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,17 @@ export class RequestVerificationService {

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

const signedCounterCheckRequest = this._signatureService.signRequestData(accessKeyId, secretKey, {
host: request.hostname,
method: request.method,
path: url,
body: request.rawBody || undefined,
service: incomingSignature.credential.service,
headers,
region: incomingSignature.credential.region
});
const signedCounterCheckRequest = this._signatureService.signRequestData(
accessKeyId,
secretKey, {
host: request.hostname,
method: request.method,
path: url,
body: request.rawBody || request.body || undefined,
service: incomingSignature.credential.service,
headers,
region: incomingSignature.credential.region
});

const resultHeaders = signedCounterCheckRequest.headers as OutgoingHttpHeaders;
if (resultHeaders['Authorization']) {
Expand All @@ -122,7 +124,7 @@ export class RequestVerificationService {
if (signature !== incomingSignature.signature) {
this._logger.debug(
`Signatures do not match. This indicates a wrong signature supplied in the request.` +
`(Incoming=${incomingSignature};Generated=${signature})`);
`(Incoming=${incomingSignature.signature}(${incomingSignature.signedHeaders.join(';')});Generated=${signature}(${signedCounterCheckAuth.signedHeaders.join(';')}))`);
return this.unauthorized;
}

Expand Down

0 comments on commit ea607a0

Please sign in to comment.