Skip to content

Commit 7c2e5fd

Browse files
iavclaude
andcommitted
extensions: cloud-init: quote variables in destructive commands (#9400 P0)
Quote ${config_src}, $config_dst, ${defaults_src}, $defaults_dst in cp commands and ${SDCARD} in rm -f commands to prevent word splitting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8a70558 commit 7c2e5fd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

extensions/cloud-init/cloud-init.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ function pre_customize_image__inject_cloud_init_config() {
4444
display_alert "Extension: ${EXTENSION}: Configuring" "cloud-init" "info"
4545
local config_src="${EXTENSION_DIR}/config"
4646
local config_dst="${SDCARD}/etc/cloud/cloud.cfg.d"
47-
run_host_command_logged cp ${config_src}/* $config_dst
47+
run_host_command_logged cp "${config_src}"/* "${config_dst}"
4848

4949
# Provide default cloud-init files
5050
display_alert "Extension: ${EXTENSION}: Defaults" "cloud-init" "info"
5151
local defaults_src="${EXTENSION_DIR}/defaults"
5252
local defaults_dst="${SDCARD}/boot"
53-
run_host_command_logged cp ${defaults_src}/* $defaults_dst
53+
run_host_command_logged cp "${defaults_src}"/* "${defaults_dst}"
5454
return 0
5555
}
5656

@@ -59,8 +59,8 @@ function pre_customize_image__disable_armbian_first_run() {
5959
display_alert "Extension: ${EXTENSION}: Disabling" "armbian firstrun" "info"
6060

6161
# Clean up default profile and network
62-
rm -f ${SDCARD}/etc/profile.d/armbian-check-first-*
63-
rm -f ${SDCARD}/etc/netplan/armbian-*
62+
rm -f "${SDCARD}"/etc/profile.d/armbian-check-first-*
63+
rm -f "${SDCARD}"/etc/netplan/armbian-*
6464

6565
# remove any networkd config leftover from armbian build
6666
rm -f "${SDCARD}"/etc/systemd/network/*.network || true

0 commit comments

Comments
 (0)