Skip to content

Commit 7077ada

Browse files
authored
Avoid interpolating values into bash (#4774)
This can lead to code execution. See https://woodruffw.github.io/zizmor/audits/#template-injection for details
1 parent 5aa2a9b commit 7077ada

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

.github/workflows/coverage-pr-base.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ jobs:
1919
- name: Set PR base on codecov
2020
run: |
2121
# fetch the merge commit between the PR base and head
22-
BASE_REF=refs/heads/${{ github.event.pull_request.base.ref }}
23-
MERGE_REF=refs/pull/${{ github.event.pull_request.number }}/merge
24-
2522
git fetch -u --progress --depth=1 origin "+$BASE_REF:$BASE_REF" "+$MERGE_REF:$MERGE_REF"
2623
while [ -z "$(git merge-base "$BASE_REF" "$MERGE_REF")" ]; do
2724
git fetch -u -q --deepen="10" origin "$BASE_REF" "$MERGE_REF";
@@ -38,3 +35,8 @@ jobs:
3835
--slug PyO3/pyo3 \
3936
--token ${{ secrets.CODECOV_TOKEN }} \
4037
--service github
38+
env:
39+
# Don't put these in bash, because we don't want the expansion to
40+
# risk code execution
41+
BASE_REF: "refs/heads/{{ github.event.pull_request.base.ref }}"
42+
MERGE_REF: "refs/pull/${{ github.event.pull_request.number }}/merge"

0 commit comments

Comments
 (0)