Skip to content

Commit 60fc06e

Browse files
committed
[nrf noup] ci: prevent PRs from installing python pkgs
pip install requirements-actions.txt from base branch instead of untrusted PR During install a malicious package can execute code in setup.py Solution is to split manifest-check and apply-labels Signed-off-by: Thomas Stilwell <[email protected]>
1 parent dc15a79 commit 60fc06e

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

.github/workflows/manifest.yml

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
name: Manifest
1+
name: Manifest Target
22
on:
33
pull_request_target:
4+
branches:
5+
- main
46

57
permissions:
68
contents: read
79

810
jobs:
9-
contribs:
11+
manifest-check:
1012
runs-on: ubuntu-24.04
11-
permissions:
12-
pull-requests: write # to create/update pull request comments
13-
name: Manifest
13+
name: Manifest Check
14+
outputs:
15+
manifest-result: ${{ steps.manifest.outputs.result }}
1416
steps:
17+
1518
- name: Checkout the code
1619
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1720
with:
1821
path: zephyrproject/zephyr
19-
ref: ${{ github.event.pull_request.head.sha }}
22+
ref: ${{ github.event.pull_request.base.sha }}
2023
fetch-depth: 0
2124
persist-credentials: false
2225

@@ -32,6 +35,14 @@ jobs:
3235
cd zephyrproject/zephyr
3336
pip install -r scripts/requirements-actions.txt --require-hashes
3437
38+
- name: Checkout the code
39+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
40+
with:
41+
path: zephyrproject/zephyr
42+
ref: ${{ github.event.pull_request.head.sha }}
43+
fetch-depth: 0
44+
persist-credentials: false
45+
3546
- name: west setup
3647
env:
3748
BASE_REF: ${{ github.base_ref }}
@@ -42,6 +53,7 @@ jobs:
4253
west init -l . || true
4354
4455
- name: Manifest
56+
id: manifest
4557
uses: zephyrproject-rtos/action-manifest@1729cded3fc798cf0de4a789c596dcb9c40eb14c # v1.9.1
4658
with:
4759
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -55,3 +67,19 @@ jobs:
5567
dnm-labels: 'DNM (manifest)'
5668
blobs-added-labels: 'Binary Blobs Added'
5769
blobs-modified-labels: 'Binary Blobs Modified'
70+
71+
apply-labels:
72+
runs-on: ubuntu-24.04
73+
needs: manifest-check
74+
permissions:
75+
pull-requests: write # to create/update pull request comments and labels
76+
name: Apply Labels and Comments
77+
steps:
78+
- name: Checkout
79+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
80+
81+
- name: Process manifest results
82+
run: |
83+
echo "Manifest check completed with result: ${{ needs.manifest-check.outputs.manifest-result }}"
84+
# This job can now add labels and comments based on the manifest check results
85+
# The actual logic would depend on what the manifest action outputs

0 commit comments

Comments
 (0)