diff --git a/CHANGELOG.md b/CHANGELOG.md index 6feab404d2..e07cc91229 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,51 @@ +#### v2.8.10 (2023-03-27) + +##### Chores + +* up composer-default (e9a8e195) +* incrementing version number - v2.8.9 (57f14e41) +* update changelog for v2.8.9 (18b2150e) +* incrementing version number - v2.8.8 (b331b942) +* incrementing version number - v2.8.7 (3f8248d6) +* incrementing version number - v2.8.6 (af6ce447) +* incrementing version number - v2.8.5 (bff5ce2d) +* incrementing version number - v2.8.4 (a46b2bbc) +* incrementing version number - v2.8.3 (c20b20a7) +* incrementing version number - v2.8.2 (050e43f8) +* incrementing version number - v2.8.1 (727f879e) +* incrementing version number - v2.8.0 (8e77673d) +* incrementing version number - v2.7.0 (96cc0617) +* incrementing version number - v2.6.1 (7e52a7a5) +* incrementing version number - v2.6.0 (e7fcf482) +* incrementing version number - v2.5.8 (dec0e7de) +* incrementing version number - v2.5.7 (5836bf4a) +* incrementing version number - v2.5.6 (c7bd7dbf) +* incrementing version number - v2.5.5 (3509ed94) +* incrementing version number - v2.5.4 (e83260ca) +* incrementing version number - v2.5.3 (7e922936) +* incrementing version number - v2.5.2 (babcd17e) +* incrementing version number - v2.5.1 (ce3aa950) +* incrementing version number - v2.5.0 (01d276cb) +* incrementing version number - v2.4.5 (dd3e1a28) +* incrementing version number - v2.4.4 (d5525c87) +* incrementing version number - v2.4.3 (9c647c6c) +* incrementing version number - v2.4.2 (3aa7b855) +* incrementing version number - v2.4.1 (60cbd148) +* incrementing version number - v2.4.0 (4834cde3) +* incrementing version number - v2.3.1 (d2425942) +* incrementing version number - v2.3.0 (046ea120) + +##### Bug Fixes + +* #11403, remove loader.js crash counter logic (830f142b) +* don't crash if event name is not a string (37b48b82) +* closes #11173, move cache clear code (c2961ad4) + +##### Other Changes + +* fix arrow (1aff9cad) +* whitespace (894f392b) + #### v2.8.9 (2023-03-19) ##### Chores diff --git a/loader.js b/loader.js index 1d86d3a37e..9a1f0cdbad 100644 --- a/loader.js +++ b/loader.js @@ -30,9 +30,7 @@ const output = logrotate({ file: outputLogFilePath, size: '1m', keep: 3, compres const silent = nconf.get('silent') === 'false' ? false : nconf.get('silent') !== false; let numProcs; const workers = []; -const Loader = { - timesStarted: 0, -}; +const Loader = {}; const appPath = path.join(__dirname, 'app.js'); Loader.init = function () { @@ -57,21 +55,6 @@ Loader.displayStartupMessages = function () { Loader.addWorkerEvents = function (worker) { worker.on('exit', (code, signal) => { - if (code !== 0) { - if (Loader.timesStarted < numProcs * 3) { - Loader.timesStarted += 1; - if (Loader.crashTimer) { - clearTimeout(Loader.crashTimer); - } - Loader.crashTimer = setTimeout(() => { - Loader.timesStarted = 0; - }, 10000); - } else { - console.log(`${numProcs * 3} restarts in 10 seconds, most likely an error on startup. Halting.`); - process.exit(); - } - } - console.log(`[cluster] Child Process (${worker.pid}) has exited (code: ${code}, signal: ${signal})`); if (!(worker.suicide || code === 0)) { console.log('[cluster] Spinning up another process...'); diff --git a/src/socket.io/index.js b/src/socket.io/index.js index dc69204473..a4a4327005 100644 --- a/src/socket.io/index.js +++ b/src/socket.io/index.js @@ -120,7 +120,12 @@ async function onMessage(socket, payload) { return winston.warn('[socket.io] Empty method name'); } - const parts = eventName.toString().split('.'); + if (typeof eventName !== 'string') { + const escapedName = validator.escape(String(eventName)); + return callback({ message: `[[error:invalid-event, ${escapedName}]]` }); + } + + const parts = eventName.split('.'); const namespace = parts[0]; const methodToCall = parts.reduce((prev, cur) => { if (prev !== null && prev[cur] && (!prev.hasOwnProperty || prev.hasOwnProperty(cur))) { diff --git a/test/socket.io.js b/test/socket.io.js index fae66f82bc..e95eb6527e 100644 --- a/test/socket.io.js +++ b/test/socket.io.js @@ -107,6 +107,15 @@ describe('socket.io', () => { }); }); + it('should return error for invalid eventName type', (done) => { + const eventName = ['topics.loadMoreTags']; + io.emit(eventName, (err) => { + const eventAsString = String(eventName); + assert.strictEqual(err.message, `[[error:invalid-event, ${eventAsString}]]`); + done(); + }); + }); + it('should get installed themes', (done) => { const themes = ['nodebb-theme-persona']; io.emit('admin.themes.getInstalled', (err, data) => {