From 0bd45d1ec1fddce6d17ccddf4bb4e9a80fbd7f45 Mon Sep 17 00:00:00 2001 From: Mike Peachey Date: Fri, 24 Apr 2026 11:54:19 +0100 Subject: [PATCH] Fix unquoted argument iteration in tfenv-exec.sh Fix #453: Quote ${@} in for-loop to prevent word-splitting. "for _arg in ${@:1}" word-splits arguments containing spaces, breaking terraform commands that pass quoted arguments (e.g. terraform import with resource addresses containing brackets). Changed to "for _arg in "${@}"" which preserves argument boundaries. --- lib/tfenv-exec.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tfenv-exec.sh b/lib/tfenv-exec.sh index 66af4cd9..c2791047 100644 --- a/lib/tfenv-exec.sh +++ b/lib/tfenv-exec.sh @@ -29,7 +29,7 @@ function realpath-relative-to() { export -f realpath-relative-to; function tfenv-exec() { - for _arg in ${@:1}; do + for _arg in "${@}"; do if [[ "${_arg}" == -chdir=* ]]; then chdir="${_arg#-chdir=}"; log 'debug' "Found -chdir arg: ${chdir}";