Skip to content

Commit bb70b33

Browse files
committed
fix: guard rm -rf with ${var:?} for SC2115 compliance
1 parent 6c7c9d4 commit bb70b33

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/rxnm-profiles.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ _task_profile_load_global() {
9595
# to its baseline condition. Non-default profiles must contain files to prevent accidental
9696
# network lockouts during standard profile switching.
9797
if [ "$has_files" = "false" ] && [ "$name" != "default" ]; then
98-
rm -rf "$staging_dir"
98+
rm -rf "${staging_dir:?}"
9999
log_error "Profile is empty or sync failed. Aborted to prevent network loss."
100100
return 1
101101
fi
@@ -110,7 +110,7 @@ _task_profile_load_global() {
110110
for f in "$staging_dir"/*; do
111111
[ -e "$f" ] && mv -f "$f" "${EPHEMERAL_NET_DIR}/"
112112
done
113-
rm -rf "$staging_dir"
113+
rm -rf "${staging_dir:?}"
114114
fi
115115

116116
[ -f "$profile_dir/proxy.conf" ] && cp "$profile_dir/proxy.conf" "${STORAGE_PROXY_GLOBAL}"
@@ -203,7 +203,7 @@ action_profile() {
203203
[ ! -d "$global_dir/$name" ] && { json_error "Profile not found: $name"; return 1; }
204204

205205
confirm_action "Delete global profile '$name'?" "$FORCE_ACTION"
206-
rm -rf "$global_dir/$name"
206+
rm -rf "${global_dir:?}/${name:?}"
207207

208208
local active_prof="default"
209209
[ -f "$global_dir/.default" ] && active_prof=$(cat "$global_dir/.default" | tr -d '\r\n')

0 commit comments

Comments
 (0)