1
0
Fork 0
forked from svrjs/svrjs

Update to SVR.JS 3.4.41

This commit is contained in:
Dorian Niemiec 2024-01-14 19:11:30 +01:00
parent 54678c7e25
commit c9351632da
6 changed files with 36 additions and 39 deletions

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020-2023 DorianTech
Copyright (c) 2018-2024 SVR.JS
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>SVR.JS 3.4.40</title>
<title>SVR.JS 3.4.41</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="UTF-8" />
<style>
@ -12,7 +12,7 @@
</style>
</head>
<body>
<h1>Welcome to SVR.JS 3.4.40</h1>
<h1>Welcome to SVR.JS 3.4.41</h1>
<br/>
<img src="/logo.png" style="width: 256px;" />
<br/>
@ -119,7 +119,10 @@
</div>
<p>Changes:</p>
<ul>
<li>SVR.JS now refuses to start with misconfigured SNI in order to prevent ReDoS vulnerabilities.</li>
<li>Removed all remnants of "DorianTech".</li>
<li>Mitigated log file injection vulnerability for HTTP authentication.</li>
<li>Mitigated log file injection vulnerability for SVR.JS mod file names.</li>
<li>SVR.JS no longer crashes, when access to a log file is denied.</li>
</ul>
<br/>
<a href="/tests.html">Tests</a><br/>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>SVR.JS 3.4.40 Licenses</title>
<title>SVR.JS 3.4.41 Licenses</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="UTF-8" />
<style>
@ -12,12 +12,12 @@
</style>
</head>
<body>
<h1>SVR.JS 3.4.40 Licenses</h1>
<h2>SVR.JS 3.4.40</h2>
<h1>SVR.JS 3.4.41 Licenses</h1>
<h2>SVR.JS 3.4.41</h2>
<div style="display: inline-block; text-align: left; border-width: 2px; border-style: solid; border-color: gray; padding: 8px;">
MIT License<br/>
<br/>
Copyright (c) 2020-2023 DorianTech<br/>
Copyright (c) 2018-2024 SVR.JS<br/>
<br/>
Permission is hereby granted, free of charge, to any person obtaining a copy<br/>
of this software and associated documentation files (the "Software"), to deal<br/>
@ -37,7 +37,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br/>
SOFTWARE.<br/>
</div>
<h2>Packages used by SVR.JS 3.4.40 and utilities</h2>
<h2>Packages used by SVR.JS 3.4.41 and utilities</h2>
<div style="width: 100%; background-color: #ccc; border: 1px solid green; text-align: left; margin: 10px 0;">
<div style="float: right;">License: MIT</div>
<div style="font-size: 20px;">

48
svr.js
View file

@ -1,26 +1,17 @@
//DorianTech HTTP Server
//Uses Content-Type and Content-Length
//Events calling:
//|
//+--request
//|
//+--connect
//|
//+--error
//
//APIs:
// - https
// - readline
// - os
// - http
// - url
// - fs
// - path
// - hexstrbase64
// - crypto
// - svrmodpack
// - graceful-fs
// - formidable
// SVR.JS - a web server running on Node.JS
/*
* MIT License
*
* Copyright (c) 2018-2024 SVR.JS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
if (typeof require === "undefined") {
if (typeof ActiveXObject !== "undefined" && typeof WScript !== "undefined") {
var shell = new ActiveXObject("WScript.Shell");
@ -71,7 +62,7 @@ function deleteFolderRecursive(path) {
}
var os = require("os");
var version = "3.4.40";
var version = "3.4.41";
var singlethreaded = false;
if (process.versions) process.versions.svrjs = version; //Inject SVR.JS into process.versions
@ -1134,6 +1125,9 @@ function LOG(s) {
flags: "a",
autoClose: false
});
logFile.on("error", function(err) {
if (!s.match(/^SERVER WARNING MESSAGE(?: \[Request Id: [0-9a-f]{6}\])?: There was a problem while saving logs! Logs will not be kept in log file\. Reason: /) && !reallyExiting) serverconsole.locwarnmessage("There was a problem while saving logs! Logs will not be kept in log file. Reason: " + err.message);
});
}
if (logFile.writable) {
logFile.write("[" + new Date().toISOString() + "] " + s + "\r\n");
@ -1349,7 +1343,7 @@ if (!disableMods) {
}
} catch (ex) {
if (cluster.isPrimary || cluster.isPrimary === undefined) {
serverconsole.locwarnmessage("There was a problem while loading a \"" + modFiles[i] + "\" mod.");
serverconsole.locwarnmessage("There was a problem while loading a \"" + String(modFiles[i]).replace(/[\r\n]/g, "") + "\" mod.");
serverconsole.locwarnmessage("Stack:");
serverconsole.locwarnmessage(generateErrorStack(ex));
}
@ -4143,7 +4137,7 @@ if (!cluster.isPrimary) {
}
}
callServerError(401, undefined, undefined, ha);
serverconsole.errmessage("User " + username + " failed to log in.");
serverconsole.errmessage("User " + String(username).replace(/[\r\n]/g, "") + " failed to log in.");
} else {
if (bruteProtection) {
if (process.send) {
@ -4357,7 +4351,7 @@ function start(init) {
if (init) {
for (i = 0; i < logo.length; i++) console.log(logo[i]); //Print logo
console.log();
console.log("Welcome to DorianTech SVR.JS server.");
console.log("Welcome to SVR.JS - a web server running on Node.JS");
if (version.indexOf("Nightly-") === 0) serverconsole.locwarnmessage("This version is only for test purposes and may be unstable.");
if (vnum <= 57 && JSON.stringify(rewriteMap) != "[]") serverconsole.locwarnmessage("Some URL rewriting regexes will not work in Node.JS 8.x and earlier.");
if (http2.__disabled__ !== undefined) serverconsole.locwarnmessage("HTTP/2 isn't supported by your Node.JS version!");

View file

@ -1,6 +1,6 @@
</div>
<div class="footer">
Copyright &copy; 2020 DorianTech S.A.
Copyright &copy; 2020-2024 SVR.JS
</div>
</body>
</html>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>SVR.JS 3.4.40 Tests</title>
<title>SVR.JS 3.4.41 Tests</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="UTF-8" />
<style>
@ -12,7 +12,7 @@
</style>
</head>
<body>
<h1>SVR.JS 3.4.40 Tests</h1>
<h1>SVR.JS 3.4.41 Tests</h1>
<h2>Directory</h2>
<iframe src="/testdir" width="50%" height="300px"></iframe>
<h2>Directory (with query)</h2>