1
1
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
3
11
jobs :
4
12
check :
5
13
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
6
17
# push: always run.
7
18
# pull_request: run only when the PR is submitted from a forked repository, not within this repository.
8
19
if : github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
@@ -22,12 +33,11 @@ jobs:
22
33
with :
23
34
java-version : 8
24
35
distribution : " temurin"
25
- cache : " gradle"
26
36
- name : Check
27
37
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 }}
33
43
run : ./gradlew --stacktrace check
0 commit comments