From 534edc1eb826dee248ca8f99cb8448eee6bb47fa Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Mon, 14 Aug 2023 18:14:17 +0200 Subject: [PATCH] Prevent source code viewing by "JSGI-BIN" instead of "jsgi-bin" in Windows --- index.js | 12 +----------- mod.info | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index 34258b2..babf811 100644 --- a/index.js +++ b/index.js @@ -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(); } diff --git a/mod.info b/mod.info index 33fc804..921292d 100755 --- a/mod.info +++ b/mod.info @@ -1,4 +1,4 @@ { "name": "DorianTech YellowSquare JSGI engine for SVR.JS", - "version": "1.0.0" + "version": "1.0.1" }