build: harden GitHub workflow permissions
authorAlex Low <aleksandrosansan@gmail.com>
Mon, 19 Sep 2022 10:20:37 +0000 (12:20 +0200)
committerJosef Schlehofer <pepe.schlehofer@gmail.com>
Sun, 4 Dec 2022 15:26:59 +0000 (16:26 +0100)
Grant pull-requests write permission to the labeler workflow and
read-only to everything else.

Signed-off-by: Alex Low <aleksandrosansan@gmail.com>
[ wrap to 80 columns and fix wrong author as requested by author itself ]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
(cherry picked from commit 715259940776843d8799bc39de8eb50eb764189b)

.github/workflows/formal.yml
.github/workflows/kernel.yml
.github/workflows/labeler.yml
.github/workflows/tools.yml

index 5046b5a180cc84b717158c5e68401cd71f143d6e..125648163782152c53a191982d64743fe0a1dad7 100644 (file)
@@ -3,6 +3,9 @@ name: Test Formalities
 on:
   pull_request:
 
+permissions:
+  contents: read
+
 jobs:
   build:
     name: Test Formalities
index 4f8c6b9317c0cb24f8c40f20b182dcbbb01ec137..62e0952f195c06834f94c2eca3b32fda1f0c8f75 100644 (file)
@@ -7,6 +7,10 @@ on:
       - 'include/kernel-*'
       - 'package/kernel/**'
       - 'target/linux/generic/**'
+
+permissions:
+  contents: read
+
 jobs:
   determine_targets:
     name: Set targets
index 6bcdf51a89288836ca1b2b676b9b69ad9821afde..420617809b668068d255838bb7f5bcc6650b6c17 100644 (file)
@@ -2,8 +2,15 @@ name: 'Pull Request Labeler'
 on:
   - pull_request_target
 
+permissions:
+  contents: read
+
 jobs:
   labeler:
+    permissions:
+      contents: read # to determine modified files (actions/labeler)
+      pull-requests: write # to add labels to PRs (actions/labeler)
+
     name: Pull Request Labeler
     runs-on: ubuntu-latest
     steps:
index be967833cb4a92aca1896990eb78480ff4e5ded9..4e423fdd6292c3346cca44804040f65699224d44 100644 (file)
@@ -6,6 +6,9 @@ on:
       - 'tools/**'
       - '.github/workflows/tools.yml'
 
+permissions:
+  contents: read
+
 jobs:
   build:
     name: tools-${{ matrix.os }}