From 9a2c209cee898931df310c218cd87d0840a72572 Mon Sep 17 00:00:00 2001 From: Logan Adams <114770087+loadams@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:04:56 -0800 Subject: [PATCH] Sanitize inputs to eval() (#6745) --- tests/model/BingBertSquad/run_BingBertSquad.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/model/BingBertSquad/run_BingBertSquad.sh b/tests/model/BingBertSquad/run_BingBertSquad.sh index f665456416e0..4d06bb1230a4 100755 --- a/tests/model/BingBertSquad/run_BingBertSquad.sh +++ b/tests/model/BingBertSquad/run_BingBertSquad.sh @@ -160,8 +160,11 @@ run_cmd="deepspeed.pt \ --master_port ${master_port} ${BingBertSquad_script} ${other_args} ${squad_args}" -echo ${run_cmd} -eval ${run_cmd} +# Sanitize input before running eval() +safe_cmd=$(printf '%q' "$run_cmd") + +echo ${safe_cmd} +eval ${safe_cmd} set +x