From 5548ae3c4b93f3ad74269f8cd7b33bd1a3d27af8 Mon Sep 17 00:00:00 2001 From: HussainAliAkbar Date: Thu, 22 Jun 2017 21:20:49 +0500 Subject: [PATCH] Fix: Issue#79: called the utils.deny function when the validation whether the provided role is a string or not fails. --- lib/nacl.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/nacl.js b/lib/nacl.js index 9121d37..8bd6f4d 100644 --- a/lib/nacl.js +++ b/lib/nacl.js @@ -72,7 +72,17 @@ function authorize(req, res, next) { let role = helper.getRole(req, res, opt.decodedObjectName, opt.defaultRole); - if (!_.isString(role) || !role) return; + /** + * if no role or role not provided as string + */ + if (!_.isString(role) || !role) { + return utils.deny( + res, + 404, + 'REQUIRED: Role should be provided as a string', + null + ); + } /** * get resource from the url