Skip to content

Commit 2cca6a0

Browse files
silkenelsonCopilot
andauthored
Update scripts/ipmConfigEpics
copilot suggested fix. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 758a6ad commit 2cca6a0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

scripts/ipmConfigEpics

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,13 @@ fi
250250
# Attempt to read the :SUM PV and open a GUI if successful and exits if not. Uses wave8 or ipimb accordingly
251251
ipmGUI(){
252252
if caget "${BASE}":SUM > /dev/null 2>&1; then
253-
if [ ${#WAVE8V3} -gt 0 ]; then
254-
cmdName=$(caget -St "${BASE}":LAUNCH_EDM)
255-
echo calling the screen from: "$cmdName"
256-
$cmdName
253+
# Validate cmdName: allow only safe characters (alphanum, underscore, dash, slash, period)
254+
if [[ "$cmdName" =~ ^[a-zA-Z0-9_./-]+$ ]]; then
255+
$cmdName
256+
else
257+
echo "Error: Unsafe command detected in LAUNCH_EDM PV: '$cmdName'. Aborting."
258+
exit 1
259+
fi
257260
elif [ ${#WAVE8} -gt 0 ]; then
258261
/reg/g/pcds/pyps/apps/wave8/latest/wave8 --base "$BASE" --evr "$EVR" --ioc "$IOC"
259262
else

0 commit comments

Comments
 (0)