Skip to content

Commit e497ceb

Browse files
authored
security: fix unsafe outputs (#420)
* security: fix unsafe outputs * Update to use printf
1 parent f904073 commit e497ceb

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

action.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ runs:
6464
HEAD_REF=${HEAD_REF/refs\/heads\//}
6565
REF_BRANCH=${REF/refs\/pull\//}
6666
REF_BRANCH=${REF_BRANCH/refs\/heads\//}
67-
67+
6868
# Strip branch prefix if provided
6969
REF_BRANCH=${REF_BRANCH/$INPUTS_STRIP_BRANCH_PREFIX/}
7070
HEAD_REF=${HEAD_REF/$INPUTS_STRIP_BRANCH_PREFIX/}
@@ -76,19 +76,18 @@ runs:
7676
REF_BRANCH=${REF_BRANCH//\//-}
7777
fi
7878
79-
echo "base_ref_branch=$(eval printf "%s" "$BASE_REF")" >> "$GITHUB_OUTPUT"
80-
echo "head_ref_branch=$(eval printf "%s" "$HEAD_REF")" >> "$GITHUB_OUTPUT"
81-
echo "ref_branch=$(eval printf "%s" "$REF_BRANCH")" >> "$GITHUB_OUTPUT"
79+
printf "base_ref_branch=%s\n" "$BASE_REF" >> "$GITHUB_OUTPUT"
80+
printf "head_ref_branch=%s\n" "$HEAD_REF" >> "$GITHUB_OUTPUT"
81+
printf "ref_branch=%s\n" "$REF_BRANCH" >> "$GITHUB_OUTPUT"
8282
else
8383
BASE_REF=$(printf "%q" "$GITHUB_EVENT_BASE_REF")
8484
BASE_REF=${BASE_REF/refs\/heads\/$INPUTS_STRIP_TAG_PREFIX/}
85-
85+
8686
# Replace slashes with hyphens if enabled
8787
if [[ "$INPUTS_REPLACE_SLASHES" == "true" ]]; then
8888
BASE_REF=${BASE_REF//\//-}
8989
fi
90-
91-
echo "base_ref_branch=$(eval printf "%s" "$BASE_REF")" >> "$GITHUB_OUTPUT"
90+
printf "base_ref_branch=%s\n" "$BASE_REF" >> "$GITHUB_OUTPUT"
9291
fi
9392
shell: bash
9493
- id: current_branch
@@ -141,7 +140,7 @@ runs:
141140
TAG=${TAG//\//-}
142141
fi
143142
144-
echo "tag=$(eval printf "%s" "$TAG")" >> "$GITHUB_OUTPUT"
143+
printf "tag=%s\n" "$TAG" >> "$GITHUB_OUTPUT"
145144
echo "is_tag=true" >> "$GITHUB_OUTPUT"
146145
else
147146
echo "is_tag=false" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)