Skip to content

Commit 6da0c90

Browse files
committed
Check with GitHub Actions on "pull_request_target" from external contributors
1 parent 888f9f4 commit 6da0c90

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

.github/workflows/check.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
name: Check
2-
on: [ pull_request, push ]
2+
on:
3+
- push
4+
# The "pull_request_target" event allows a pull request from an external fork to run the Workflow with Secrets.
5+
# It can be vulnerable as a modified Workflow in a malicious pull request can run with Secrets.
6+
# See: https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
7+
#
8+
# Confirm this repo is configured to "Require approval for all external contributors" in Settings of the repo,
9+
# and inspect any external pull request before approving the Workflow to run for the external pull request.
10+
- pull_request_target
311
jobs:
412
check:
513
runs-on: ${{ matrix.os }}
14+
permissions: # The "pull_request_target" event also permits "write" by default, but it should be disabled.
15+
contents: read
16+
actions: read
617
# push: always run.
718
# pull_request: run only when the PR is submitted from a forked repository, not within this repository.
819
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
@@ -22,12 +33,11 @@ jobs:
2233
with:
2334
java-version: 8
2435
distribution: "temurin"
25-
cache: "gradle"
2636
- name: Check
2737
env:
28-
GCP_EMAIL: ${{secrets.GCP_EMAIL}}
29-
GCP_JSON_KEYFILE: ${{secrets.GCP_JSON_KEYFILE}}
30-
GCP_PRIVATE_KEYFILE: ${{secrets.GCP_PRIVATE_KEYFILE}}
31-
GCP_BUCKET: ${{secrets.GCP_BUCKET}}
32-
GCP_BUCKET_DIRECTORY: ${{secrets.GCP_BUCKET_DIRECTORY}}
38+
GCP_EMAIL: ${{ secrets.GCP_EMAIL }}
39+
GCP_JSON_KEYFILE: ${{ secrets.GCP_JSON_KEYFILE }}
40+
GCP_PRIVATE_KEYFILE: ${{ secrets.GCP_PRIVATE_KEYFILE }}
41+
GCP_BUCKET: ${{ secrets.GCP_BUCKET }}
42+
GCP_BUCKET_DIRECTORY: ${{ secrets.GCP_BUCKET_DIRECTORY }}
3343
run: ./gradlew --stacktrace check

0 commit comments

Comments
 (0)