From 3924cbaa842ae8f5257a9af231bfdf5387c99e5f Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Sun, 19 Nov 2023 01:47:42 +0100 Subject: [PATCH] Added a security check to the server.js --- api/server.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/api/server.js b/api/server.js index 627019f..75871f6 100644 --- a/api/server.js +++ b/api/server.js @@ -87,6 +87,19 @@ io.on("connection", (socket) => { return; } + try { + const priceInt = parseInt(price); + const amountInt = parseInt(amount); + + if (isNaN(priceInt) || isNaN(amountInt)) { + callback(false); + return; + } + } catch (e) { + callback(false); + return; + } + if (price < 0 || price > 10000 || amount < 0 || amount > 20) { callback(false); return;