Handle missing webhook signature header

This commit is contained in:
Krzysztof Wolski 2022-08-04 12:27:45 +02:00
parent 95cbf1c9eb
commit 3d4c513be9

View file

@ -72,6 +72,13 @@ export const withWebhookSignatureVerified =
const { domain: saleorDomain, signature: payloadSignature } = getSaleorHeaders(request.headers);
if (!payloadSignature) {
return Response.BadRequest({
success: false,
message: "Missing payload signature.",
});
}
if (secretKey !== undefined) {
const calculatedSignature = crypto
.createHmac("sha256", secretKey)