Skip to content

Commit cdc13a8

Browse files
committed
ci: build: Enable build on PR and prevent use of pull_request_target
Also added comment to prevent privileges escalation using pull_request_target (see related change) Relate-to:SiliconLabsSoftware#67 Relate-to: https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/ Signed-off-by: Philippe Coval <[email protected]>
1 parent 90e8f43 commit cdc13a8

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

.github/workflows/build-rootfs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
name: z-wave-protocol-controller Build in rootfs for arch
44

55
on: # yamllint disable-line rule:truthy
6+
# pull_request_target: # Avoid to prevent CodeQL CWE-829
67
push:
78
tags:
89
- '*'
@@ -18,6 +19,9 @@ jobs:
1819
- arm64
1920
# - armhf # TODO Enable when supported
2021
steps:
22+
- name: Security check
23+
if: ${{ github.event.action == 'pull_request_target'}}
24+
run: echo "Prevent running (CodeQL CWE-829)" && exit 1
2125
# yamllint disable-line rule:line-length
2226
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2327
with:

.github/workflows/build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
name: build
77

88
on: # yamllint disable-line rule:truthy
9+
pull_request:
10+
# pull_request_target: # Avoid to prevent CodeQL CWE-829
911
push:
1012

1113
jobs:
@@ -16,6 +18,9 @@ jobs:
1618
project-name: z-wave-protocol-controller # Align to docker (lowercase)
1719
runs-on: ubuntu-22.04
1820
steps:
21+
- name: Security check
22+
if: ${{ github.event.action == 'pull_request_target'}}
23+
run: echo "Prevent running (CodeQL CWE-829)" && exit 1
1924
# yamllint disable-line rule:line-length
2025
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2126
with:

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ name: test
99
run-name: "test: ${{ github.event.workflow_run.head_branch }}#${{ github.event.workflow_run.head_commit.id }}"
1010

1111
on: # yamllint disable-line rule:truthy
12+
# pull_request_target: # Avoid to prevent CodeQL CWE-829
1213
workflow_run:
1314
workflows: ["build"]
1415
types:
@@ -24,6 +25,9 @@ jobs:
2425
runs-on: ubuntu-24.04
2526
if: ${{ github.event.workflow_run.conclusion == 'success' }}
2627
steps:
28+
- name: Security check
29+
if: ${{ github.event.action == 'pull_request_target'}}
30+
run: echo "Prevent running (CodeQL CWE-829)" && exit 1
2731
- name: Download image
2832
id: image
2933
# yamllint disable-line rule:line-length

0 commit comments

Comments
 (0)