From c7465479a2e274eeb03f39805ae491370aad4412 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 20 Dec 2013 10:39:14 +0100 Subject: [PATCH] Improve error on a signature certificate with no or broken auth --- lib/cartodb/signed_maps.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/cartodb/signed_maps.js b/lib/cartodb/signed_maps.js index 4a62432f..6c4af8d3 100644 --- a/lib/cartodb/signed_maps.js +++ b/lib/cartodb/signed_maps.js @@ -94,6 +94,14 @@ o.authorizedByCert = function(cert, auth) { throw new Error("Unsupported certificate version " + cert.version); } + if ( ! cert.auth ) { + throw new Error("No certificate authorization"); + } + + if ( ! cert.auth.method ) { + throw new Error("No certificate authorization method"); + } + // Open authentication certificates are always authorized if ( cert.auth.method === 'open' ) return true;