inetChecksite() possible security issue fix
This commit is contained in:
@@ -58,6 +58,11 @@ function inetChecksite(url, callback) {
|
||||
result.url = urlSanitized;
|
||||
try {
|
||||
if (urlSanitized && !util.isPrototypePolluted()) {
|
||||
urlSanitized.__proto__.startsWith = util.stringStartWith;
|
||||
if (urlSanitized.startsWith('file:')) {
|
||||
if (callback) { callback(result); }
|
||||
return resolve(result);
|
||||
}
|
||||
let t = Date.now();
|
||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin || _sunos) {
|
||||
let args = ' -I --connect-timeout 5 -m 5 ' + urlSanitized + ' 2>/dev/null | head -n 1 | cut -d " " -f2';
|
||||
@@ -146,6 +151,11 @@ function inetLatency(host, callback) {
|
||||
}
|
||||
}
|
||||
}
|
||||
hostSanitized.__proto__.startsWith = util.stringStartWith;
|
||||
if (hostSanitized.startsWith('file:')) {
|
||||
if (callback) { callback(null); }
|
||||
return resolve(null);
|
||||
}
|
||||
let params;
|
||||
let filt;
|
||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
|
||||
|
||||
@@ -57,6 +57,7 @@ const stringToLower = new String().toLowerCase;
|
||||
const stringToString = new String().toString;
|
||||
const stringSubstr = new String().substr;
|
||||
const stringTrim = new String().trim;
|
||||
const stringStartWith = new String().startsWith;
|
||||
|
||||
function isFunction(functionToCheck) {
|
||||
let getType = {};
|
||||
@@ -939,5 +940,6 @@ exports.stringToLower = stringToLower;
|
||||
exports.stringToString = stringToString;
|
||||
exports.stringSubstr = stringSubstr;
|
||||
exports.stringTrim = stringTrim;
|
||||
exports.stringStartWith = stringStartWith;
|
||||
exports.WINDIR = WINDIR;
|
||||
exports.getFilesInPath = getFilesInPath;
|
||||
|
||||
Reference in New Issue
Block a user