From 6f608a9b9d6b4593279b090d7666e9867a7847d9 Mon Sep 17 00:00:00 2001 From: Matt Krick Date: Thu, 29 Oct 2020 11:54:56 -0700 Subject: [PATCH] throw when cert is null --- src/libsaml.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libsaml.ts b/src/libsaml.ts index 4159cbd2..18e5eba7 100644 --- a/src/libsaml.ts +++ b/src/libsaml.ts @@ -357,6 +357,9 @@ const libSaml = () => { const certificateNode = select(".//*[local-name(.)='X509Certificate']", signatureNode) as any; // certificate in metadata let metadataCert: any = opts.metadata.getX509Certificate(certUse.signing); + if (!metadataCert) { + throw new Error('INVALID_CERTIFICATE_PROVIDED') + } // flattens the nested array of Certificates from each KeyDescriptor if (Array.isArray(metadataCert)) { metadataCert = flattenDeep(metadataCert);