Skip to content

Commit edae3c8

Browse files
Merge pull request #3 from im-open/pr-target
ARCH-1192 - Switch to pr_target & add descriptions for use
2 parents f5585d8 + c4222fb commit edae3c8

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
name: Build and Test
1+
name: Build and Check for Changes
22
on:
3+
# This workflow uses the pull_request trigger which prevents write permissions and secrets
4+
# access to the target repository from public forks. This should remain as a pull_request
5+
# trigger because checkout, build, format and checking for changes do not need elevated
6+
# permissions to the repository. The reduced permissions for public forks is adequate.
37
pull_request:
48
paths-ignore:
59
- '**.md'

.github/workflows/increment-version-on-merge.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
name: Increment Version on Merge
22
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:
417
types: [closed]
518

619
jobs:
@@ -10,12 +23,19 @@ jobs:
1023
runs-on: ubuntu-latest
1124

1225
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.
1330
- name: Checkout Repository
1431
uses: actions/checkout@v2
1532
with:
33+
ref: main
1634
fetch-depth: 0
35+
persist-credentials: false
1736

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
1939
- name: Increment the version
2040
uses: im-open/git-version-lite@v2.0.6
2141
with:

0 commit comments

Comments
 (0)