From c99de4ffc286a2d8e0b0f906e2fc68e02a3ad3e0 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 12 Oct 2020 14:56:09 +0530 Subject: [PATCH] expose the canonical representation of adminKeys via /api/config --- server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 5a97c971f..ba0e9270f 100644 --- a/server.js +++ b/server.js @@ -200,12 +200,13 @@ app.use(/^\/[^\/]*$/, Express.static('customize.dist')); var admins = []; try { admins = (config.adminKeys || []).map(function (k) { - // XXX is there any reason not to use Keys.canonicalize ? + var unsafeKey = Keys.canonicalize(k); // return each admin's "unsafeKey" // this might throw and invalidate all the other admin's keys // but we want to get the admin's attention anyway. // breaking everything is a good way to accomplish that. - return Keys.parseUser(k).pubkey; + if (!unsafeKey) { throw new Error(); } + return unsafeKey; }); } catch (e) { console.error("Can't parse admin keys"); }