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,
|
||||
};
|
||||
|
||||
const jwksKey = await jose.createRemoteJWKSet(
|
||||
const jwks = jose.createRemoteJWKSet(
|
||||
new URL(jwksUrl(saleorDomain))
|
||||
)(jose.decodeProtectedHeader(payloadSignature), jws);
|
||||
) as jose.FlattenedVerifyGetKey;
|
||||
|
||||
try {
|
||||
await jose.flattenedVerify(jws, jwksKey);
|
||||
await jose.flattenedVerify(jws, jwks);
|
||||
} catch {
|
||||
return Response.BadRequest({
|
||||
success: false,
|
||||
|
|
Loading…
Reference in a new issue