1
1
name : Increment Version on Merge
2
2
on :
3
- pull_request :
3
+ # https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
4
+ # - GitHub’s standard pull_request workflow trigger prevents write permissions and secrets
5
+ # access to the target repository from public forks. PRs from a branch in the same repo
6
+ # and forks of internal/private repos are not limited the same way for this trigger.
7
+ # - The pull_request_target trigger allows the workflow to relax some restrictions to a
8
+ # target repository so PRs from forks have write permission to the target repo and have
9
+ # secrets access (which we need in order to push a new tag in this workflow).
10
+ # - For this workflow, the elevated permissions should not be a problem because:
11
+ # - Our im-open repositories do not contain secrets, they are dumb actions
12
+ # - Require approval for all outside collaborators' is set at the org level so someone
13
+ # with Write access has a chance to review code before allowing any workflow runs
14
+ # - This workflow with elevated Write permissions will only run once the code has been
15
+ # reviewed, approved by a CODEOWNER and merged
16
+ pull_request_target :
4
17
types : [closed]
5
18
6
19
jobs :
@@ -10,12 +23,19 @@ jobs:
10
23
runs-on : ubuntu-latest
11
24
12
25
steps :
26
+ # Generally speaking, when the PR contents are treated as passive data, i.e. not in a
27
+ # position of influence over the build/testing process, it is safe to checkout the code
28
+ # on a pull_request_target. But we need to be extra careful not to trigger any script
29
+ # that may operate on PR controlled contents like in the case of npm install.
13
30
- name : Checkout Repository
14
31
uses : actions/checkout@v2
15
32
with :
33
+ ref : main
16
34
fetch-depth : 0
35
+ persist-credentials : false
17
36
18
- # See https://github.com/im-open/git-version-lite for more details around how to increment major/minor/patch through commit messages
37
+ # See https://github.com/im-open/git-version-lite for more details around how to increment
38
+ # major/minor/patch through commit messages
19
39
- name : Increment the version
20
40
uses : im-open/git-version-lite@v2.0.6
21
41
with :
0 commit comments