Catch invalid pgp key

This commit is contained in:
Tankred Hase 2016-06-01 16:17:36 +02:00
parent eaca356917
commit 1a3e7f3942

View File

@ -85,6 +85,9 @@ class PublicKey {
log.error('public-key', 'Failed to parse PGP key:\n%s', publicKeyArmored, e); log.error('public-key', 'Failed to parse PGP key:\n%s', publicKeyArmored, e);
util.throw(500, 'Failed to parse PGP key'); util.throw(500, 'Failed to parse PGP key');
} }
if (!keys || !keys.length || !keys[0].primaryKey) {
util.throw(400, 'Invalid PGP key');
}
// get key user ids // get key user ids
keys.forEach(key => userIds = userIds.concat(key.getUserIds())); keys.forEach(key => userIds = userIds.concat(key.getUserIds()));
userIds = util.deDup(userIds); userIds = util.deDup(userIds);