Prevent source code viewing by "JSGI-BIN" instead of "jsgi-bin" in Windows

This commit is contained in:
Dorian Niemiec 2023-08-14 18:13:56 +02:00
parent c0fa6a6a74
commit 4504450365

View file

@ -188,7 +188,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
executeJSGI("." + a, req, res, dh, jsgiRequestObject);
}
if (href.indexOf("/jsgi-bin") == 0) {
if (href.match(new RegExp("/jsgi-bin(?:$|[?#/])",os.platform() == "win32" ? "i" : ""))) {
fs.stat("." + href, function (err, stats) {
if (!err) {
if (!stats.isFile()) {
@ -345,16 +345,6 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
}
}
});
} else if (href == "/YellowSquare-interpreters.json" && path.normalize(__dirname + "/../../..") == process.cwd()) {
if (!callServerError) {
res.writeHead(200, "OK", {
"Content-Type": "application/json",
"Server": "YellowSquare/" + version
});
res.end(JSON.stringify(exttointerpreteruser, null, 2));
} else {
callServerError(200, "YellowSquare/" + version, exttointerpreteruser);
}
} else {
elseCallback();
}