forked from svrjs/svrjs
Modified HTTP authentication functionality
This commit is contained in:
parent
7857e0e2fa
commit
184060fb79
1 changed files with 4 additions and 4 deletions
8
svr.js
8
svr.js
|
@ -4551,8 +4551,7 @@ if (!cluster.isPrimary) {
|
||||||
function checkIfPasswordMatches(list, password, callback, _i) {
|
function checkIfPasswordMatches(list, password, callback, _i) {
|
||||||
if (!_i) _i = 0;
|
if (!_i) _i = 0;
|
||||||
var cb = function (hash) {
|
var cb = function (hash) {
|
||||||
var matches = (hash == list[_i].pass);
|
if (hash == list[_i].pass) {
|
||||||
if (matches) {
|
|
||||||
callback(true);
|
callback(true);
|
||||||
} else if (_i >= list.length - 1) {
|
} else if (_i >= list.length - 1) {
|
||||||
callback(false);
|
callback(false);
|
||||||
|
@ -4653,10 +4652,11 @@ if (!cluster.isPrimary) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (usernameMatch.length == 0) {
|
if (usernameMatch.length == 0) {
|
||||||
|
// Pushing false user match to prevent time-based user enumeration
|
||||||
usernameMatch.push({
|
usernameMatch.push({
|
||||||
name: username,
|
name: username,
|
||||||
pass: "FAKEPASS",
|
pass: "SVRJSAWebServerRunningOnNodeJS",
|
||||||
salt: "FAKESALT"
|
salt: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0"
|
||||||
}); // Fake credentials
|
}); // Fake credentials
|
||||||
}
|
}
|
||||||
checkIfPasswordMatches(usernameMatch, password, function (authorized) {
|
checkIfPasswordMatches(usernameMatch, password, function (authorized) {
|
||||||
|
|
Reference in a new issue