From 716aa26b7e469bd491d97d591b6255e0b805bca5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2024 07:39:13 +0000 Subject: [PATCH 1/6] Bump ws from 8.4.0 to 8.18.0 Bumps [ws](https://github.com/websockets/ws) from 8.4.0 to 8.18.0. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/8.4.0...8.18.0) --- updated-dependencies: - dependency-name: ws dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index c01bbef..5b32d30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8668,16 +8668,16 @@ } }, "node_modules/ws": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.0.tgz", - "integrity": "sha512-IHVsKe2pjajSUIl4KYMQOdlyliovpEPquKkqbwswulszzI7r0SfQrxnXdWAEqOlDCLrVSJzo+O1hAwdog2sKSQ==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", "dev": true, "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" + "utf-8-validate": ">=5.0.2" }, "peerDependenciesMeta": { "bufferutil": { @@ -15729,9 +15729,9 @@ } }, "ws": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.0.tgz", - "integrity": "sha512-IHVsKe2pjajSUIl4KYMQOdlyliovpEPquKkqbwswulszzI7r0SfQrxnXdWAEqOlDCLrVSJzo+O1hAwdog2sKSQ==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", "dev": true, "requires": {} }, From 91a20965d36ef4cb6eb473dc1695e08b4b1e94eb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Oct 2024 18:40:08 +0000 Subject: [PATCH 2/6] Bump elliptic from 6.5.4 to 6.5.7 Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.4 to 6.5.7. - [Commits](https://github.com/indutny/elliptic/compare/v6.5.4...v6.5.7) --- updated-dependencies: - dependency-name: elliptic dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1e94c32..72ba7f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2175,9 +2175,9 @@ "dev": true }, "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "version": "6.5.7", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.7.tgz", + "integrity": "sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", @@ -10551,9 +10551,9 @@ "dev": true }, "elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "version": "6.5.7", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.7.tgz", + "integrity": "sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q==", "dev": true, "requires": { "bn.js": "^4.11.9", From 063c232935c3586229375bdfd2c63d1a43b4397f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 02:33:32 +0000 Subject: [PATCH 3/6] Bump elliptic from 6.5.7 to 6.6.0 Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.7 to 6.6.0. - [Commits](https://github.com/indutny/elliptic/compare/v6.5.7...v6.6.0) --- updated-dependencies: - dependency-name: elliptic dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 72ba7f8..86bd315 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2175,9 +2175,9 @@ "dev": true }, "node_modules/elliptic": { - "version": "6.5.7", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.7.tgz", - "integrity": "sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.0.tgz", + "integrity": "sha512-dpwoQcLc/2WLQvJvLRHKZ+f9FgOdjnq11rurqwekGQygGPsYSK29OMMD2WalatiqQ+XGFDglTNixpPfI+lpaAA==", "dev": true, "dependencies": { "bn.js": "^4.11.9", @@ -10551,9 +10551,9 @@ "dev": true }, "elliptic": { - "version": "6.5.7", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.7.tgz", - "integrity": "sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.0.tgz", + "integrity": "sha512-dpwoQcLc/2WLQvJvLRHKZ+f9FgOdjnq11rurqwekGQygGPsYSK29OMMD2WalatiqQ+XGFDglTNixpPfI+lpaAA==", "dev": true, "requires": { "bn.js": "^4.11.9", From e7db7803719f701f4f172beba56e8e390bf030d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zvonimir=20Bu=C5=A1i=C4=87?= Date: Tue, 26 Nov 2024 09:28:24 +0100 Subject: [PATCH 4/6] Handle missing action for GG messages Ref CU-8696u8yd7 --- src/master_gateway.js | 4 ++++ src/pub_sub.js | 6 +++--- src/slave_gateway.js | 4 ++++ test/pub_sub.js | 10 +++++++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/master_gateway.js b/src/master_gateway.js index 359cb57..67d1ee9 100644 --- a/src/master_gateway.js +++ b/src/master_gateway.js @@ -145,6 +145,10 @@ var masterGateway = { return false; } + if (!(event.data && event.data.action)) { + logger.out('critical', '[GG] Master: Message action missing', event.data); + } + masterPattern = new RegExp('^Master\\.', 'g'); slavePattern = new RegExp('^Slave\\.', 'g'); diff --git a/src/pub_sub.js b/src/pub_sub.js index 23162af..fdd947e 100644 --- a/src/pub_sub.js +++ b/src/pub_sub.js @@ -71,9 +71,9 @@ var pubSub = { findAction : function(actionName) { var actionFound = Object.prototype.hasOwnProperty.call(this.topics, actionName); - if(actionFound) { + if (actionFound) { return this.topics[actionName]; - } else if (actionName !== '*') { + } else if (actionName && actionName !== '*') { return this.checkWildcardActions(actionName); } else { return false; @@ -112,4 +112,4 @@ var pubSub = { pubSub.on = pubSub.subscribe; pubSub.off = pubSub.unsubscribe; -module.exports = pubSub; \ No newline at end of file +module.exports = pubSub; diff --git a/src/slave_gateway.js b/src/slave_gateway.js index 5eb953e..887c54f 100644 --- a/src/slave_gateway.js +++ b/src/slave_gateway.js @@ -130,6 +130,10 @@ var slaveGateway = { return false; } + if (!(event.data && event.data.action)) { + logger.out('critical', '[GG] Master: Message action missing', event.data); + } + slavePattern = new RegExp('^Slave\\.', 'g'); masterPattern = new RegExp('^Master\\.', 'g'); // Check if message is reserved system message (Master and Slave messages) diff --git a/test/pub_sub.js b/test/pub_sub.js index b206a32..bce7604 100644 --- a/test/pub_sub.js +++ b/test/pub_sub.js @@ -135,6 +135,14 @@ describe('Publish funcionality', function() { var result = pubSub.publish('stake.update'); assert.equal(result, false); }); + + it('Publish: Should fail - Action not defined or null', function () { + var resultForUndefined = pubSub.publish(undefined); + var resultForNull = pubSub.publish(null); + + assert.equal(resultForUndefined, false); + assert.equal(resultForNull, false); + }); }); describe('Subscription and callback execute', function() { @@ -196,4 +204,4 @@ describe('Clear subscriptions', function() { var result = pubSub.publish('betslip.add'); assert.equal(result, false); }); -}); \ No newline at end of file +}); From 745f628d704a07703a1729836b2b9fbd80763e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zvonimir=20Bu=C5=A1i=C4=87?= Date: Tue, 26 Nov 2024 10:24:50 +0100 Subject: [PATCH 5/6] Skip code execution when message action doesn't exist Ref CU-8696u8yd7 --- src/master_gateway.js | 2 ++ src/slave_gateway.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/master_gateway.js b/src/master_gateway.js index 67d1ee9..752bb42 100644 --- a/src/master_gateway.js +++ b/src/master_gateway.js @@ -147,6 +147,8 @@ var masterGateway = { if (!(event.data && event.data.action)) { logger.out('critical', '[GG] Master: Message action missing', event.data); + + return false; } masterPattern = new RegExp('^Master\\.', 'g'); diff --git a/src/slave_gateway.js b/src/slave_gateway.js index 887c54f..c8262ba 100644 --- a/src/slave_gateway.js +++ b/src/slave_gateway.js @@ -132,6 +132,8 @@ var slaveGateway = { if (!(event.data && event.data.action)) { logger.out('critical', '[GG] Master: Message action missing', event.data); + + return false; } slavePattern = new RegExp('^Slave\\.', 'g'); From 261f9fcf8380bd2f6bbc6ccf23bc15c5047f4920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zvonimir=20Bu=C5=A1i=C4=87?= Date: Wed, 27 Nov 2024 08:52:18 +0100 Subject: [PATCH 6/6] 3.0.4 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 86bd315..66a0c91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@nsftx/seven-gravity-gateway", - "version": "3.0.3", + "version": "3.0.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@nsftx/seven-gravity-gateway", - "version": "3.0.3", + "version": "3.0.4", "license": "UNLICENSED", "devDependencies": { "chai": "~4.3.7", diff --git a/package.json b/package.json index abdd970..e77b6b9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@nsftx/seven-gravity-gateway", "private": false, - "version": "3.0.3", + "version": "3.0.4", "description": "Seven Gravity Gateway", "homepage": "https://github.com/nsftx/seven-gravity-gateway", "engines": {