Skip to content

Commit 9ce25b6

Browse files
fix: github workflow vulnerable to script injection (#2600)
* fix: github workflow vulnerable to script injection Signed-off-by: Diogo Teles Sant'Anna <[email protected]> * inline forked repo check * Update hermetic_library_generation.yaml * remove unnecessary variable evaluation token * fix wording --------- Signed-off-by: Diogo Teles Sant'Anna <[email protected]> Co-authored-by: Diego Marquez <[email protected]>
1 parent f1407bb commit 9ce25b6

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:
22-
# skip pull requests come from a forked repository
23-
if: github.event.pull_request.head.repo.full_name == github.repository
26+
# skip pull requests coming from a forked repository
27+
if: github.env.REPO_FULL_NAME == github.repository
2428
runs-on: ubuntu-latest
2529
steps:
2630
- uses: actions/checkout@v4
@@ -35,6 +39,6 @@ jobs:
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)