Skip to content

Commit 599255c

Browse files
fix: github workflow vulnerable to script injection (#3232)
* fix: github workflow vulnerable to script injection Signed-off-by: Diogo Teles Sant'Anna <[email protected]> * inline repo's full_name as env var --------- Signed-off-by: Diogo Teles Sant'Anna <[email protected]> Co-authored-by: Diego Marquez <[email protected]>
1 parent 4219cf8 commit 599255c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/hermetic_library_generation.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ name: Hermetic library generation upon generation config change through pull req
1717
on:
1818
pull_request:
1919

20+
env:
21+
HEAD_REF: ${{ github.head_ref }}
22+
REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }}
23+
2024
jobs:
2125
library_generation:
2226
# skip pull requests coming from a forked repository
23-
if: github.event.pull_request.head.repo.full_name == github.repository
27+
if: github.env.REPO_FULL_NAME == github.repository
2428
runs-on: ubuntu-latest
2529
steps:
2630
- uses: actions/checkout@v4
@@ -30,11 +34,11 @@ jobs:
3034
- name: Generate changed libraries
3135
shell: bash
3236
run: |
33-
set -x
37+
set -ex
3438
[ -z "$(git config user.email)" ] && git config --global user.email "[email protected]"
3539
[ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot"
3640
bash .github/scripts/hermetic_library_generation.sh \
3741
--target_branch ${{ github.base_ref }} \
38-
--current_branch ${{ github.head_ref }}
42+
--current_branch $HEAD_REF
3943
env:
4044
GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}

0 commit comments

Comments
 (0)