Fix unhandled exception when JWS is malformed
This commit is contained in:
parent
7a04785dcf
commit
8e1e100a02
1 changed files with 3 additions and 3 deletions
|
@ -95,12 +95,12 @@ export const withWebhookSignatureVerified = (
|
||||||
signature,
|
signature,
|
||||||
};
|
};
|
||||||
|
|
||||||
const jwksKey = await jose.createRemoteJWKSet(
|
const jwks = jose.createRemoteJWKSet(
|
||||||
new URL(jwksUrl(saleorDomain))
|
new URL(jwksUrl(saleorDomain))
|
||||||
)(jose.decodeProtectedHeader(payloadSignature), jws);
|
) as jose.FlattenedVerifyGetKey;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await jose.flattenedVerify(jws, jwksKey);
|
await jose.flattenedVerify(jws, jwks);
|
||||||
} catch {
|
} catch {
|
||||||
return Response.BadRequest({
|
return Response.BadRequest({
|
||||||
success: false,
|
success: false,
|
||||||
|
|
Loading…
Reference in a new issue