From 457f14cfbec79e2899216f8d8e89ed88803a4233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Alejandro=20Marug=C3=A1n?= Date: Sun, 15 Feb 2026 19:43:34 +0100 Subject: [PATCH] fix: Unvalidated dynamic method call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Iván Alejandro Marugán --- src/lib/terminal/simulator.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/terminal/simulator.ts b/src/lib/terminal/simulator.ts index 1c01b8c..d199d65 100644 --- a/src/lib/terminal/simulator.ts +++ b/src/lib/terminal/simulator.ts @@ -48,8 +48,15 @@ export function executeCommand( } } - if (handlerToExecute) { - return handlerToExecute(currentCode); + if (typeof handlerToExecute === "function") { + try { + return handlerToExecute(currentCode); + } catch (error) { + return { + output: `Error: command execution failed`, + exitCode: 1, + }; + } } // Built-in commands