explicitly check if auth keys are undefined
Simply checking if they are truthy causes a false negative if the value is ''.
This commit is contained in:
@@ -122,10 +122,10 @@ export function handleParseHeaders(req, res, next) {
|
|||||||
// to preserve original behavior.
|
// to preserve original behavior.
|
||||||
const keys = ["clientKey", "javascriptKey", "dotNetKey", "restAPIKey"];
|
const keys = ["clientKey", "javascriptKey", "dotNetKey", "restAPIKey"];
|
||||||
const oneKeyConfigured = keys.some(function(key) {
|
const oneKeyConfigured = keys.some(function(key) {
|
||||||
return req.config[key];
|
return req.config[key] !== undefined;
|
||||||
});
|
});
|
||||||
const oneKeyMatches = keys.some(function(key){
|
const oneKeyMatches = keys.some(function(key){
|
||||||
return req.config[key] && info[key] == req.config[key];
|
return req.config[key] !== undefined && info[key] === req.config[key];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (oneKeyConfigured && !oneKeyMatches) {
|
if (oneKeyConfigured && !oneKeyMatches) {
|
||||||
|
|||||||
Reference in New Issue
Block a user