From dc533cbb677c94eb3f2ca43846f469ac46c70cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= <765740+giordano@users.noreply.github.com> Date: Thu, 31 Oct 2024 18:28:50 +0000 Subject: [PATCH] Avoid evaluation of command substitution in input In the body of the bash script, `${{ inputs }}` parameters are often quoted with double quotes, which allow command substitution. This replaces double quotes with single quotes to prevent that and avoid command substitution. --- action.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/action.yml b/action.yml index 046a7d8..dbd6e58 100644 --- a/action.yml +++ b/action.yml @@ -58,8 +58,8 @@ runs: - id: paths run: | - if [ -n "${{ inputs.depot }}" ]; then - depot="${{ inputs.depot }}" + if [ -n '${{ inputs.depot }}' ]; then + depot='${{ inputs.depot }}' elif [ -n "$JULIA_DEPOT_PATH" ]; then # Use the first depot path depot=$(echo $JULIA_DEPOT_PATH | cut -d$PATH_DELIMITER -f1) @@ -75,11 +75,11 @@ runs: cache_paths=() artifacts_path="${depot}/artifacts" - [ "${{ inputs.cache-artifacts }}" = "true" ] && cache_paths+=("$artifacts_path") + [ '${{ inputs.cache-artifacts }}' = "true" ] && cache_paths+=("$artifacts_path") packages_path="${depot}/packages" - [ "${{ inputs.cache-packages }}" = "true" ] && cache_paths+=("$packages_path") + [ '${{ inputs.cache-packages }}' = "true" ] && cache_paths+=("$packages_path") registries_path="${depot}/registries" - if [ "${{ inputs.cache-registries }}" = "true" ]; then + if [ '${{ inputs.cache-registries }}' = "true" ]; then if [ ! -d "${registries_path}" ]; then cache_paths+=("$registries_path") else @@ -87,11 +87,11 @@ runs: fi fi compiled_path="${depot}/compiled" - [ "${{ inputs.cache-compiled }}" = "true" ] && cache_paths+=("$compiled_path") + [ '${{ inputs.cache-compiled }}' = "true" ] && cache_paths+=("$compiled_path") scratchspaces_path="${depot}/scratchspaces" - [ "${{ inputs.cache-scratchspaces }}" = "true" ] && cache_paths+=("$scratchspaces_path") + [ '${{ inputs.cache-scratchspaces }}' = "true" ] && cache_paths+=("$scratchspaces_path") logs_path="${depot}/logs" - [ "${{ inputs.cache-logs }}" = "true" ] && cache_paths+=("$logs_path") + [ '${{ inputs.cache-logs }}' = "true" ] && cache_paths+=("$logs_path") { echo "cache-paths<