From 3c8e8803d9c825dc90a9669651827245c43ee9ef Mon Sep 17 00:00:00 2001 From: Habib Deriv <88178645+habib-deriv@users.noreply.github.com> Date: Tue, 1 Jul 2025 11:50:01 +0800 Subject: [PATCH] Potential fix for code scanning alert no. 84: Log injection Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- examples/buy_contract/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/buy_contract/index.js b/examples/buy_contract/index.js index 10464140..93105f53 100644 --- a/examples/buy_contract/index.js +++ b/examples/buy_contract/index.js @@ -55,7 +55,8 @@ const buyContractResponse = async (res) => { const entry_tick = data.proposal_open_contract.entry_tick; const current_spot = data.proposal_open_contract.current_spot; if (typeof entry_tick !== 'undefined') entry_spot = entry_tick; - console.log(`Entry spot ${String(entry_spot)} \n`); + const sanitizedEntrySpot = String(entry_spot).replace(/\n|\r/g, ""); + console.log(`Entry spot ${sanitizedEntrySpot} \n`); console.log(`Current spot ${String(current_spot)} \n`); console.log(`Difference ${String(current_spot - entry_spot)} \n`); }