Kaynağa Gözat

Set workflow permissions

Since 2023, it has been possible to limit the permissions granted to
a workflow. The default of all permissions is now being flagged as
a security issue, so add some minimal permissions.

It isn't really clear from the docs which of these are actually
required, as the only detailed docs are at the web API level, but
libraries for working with actions are generally in Python or NodeJS
and the libraries have not been updated to state which permissions
they require.
Jason Rumney 10 ay önce
ebeveyn
işleme
ee316831c0

+ 4 - 0
.github/workflows/hacs-validate.yml

@@ -7,6 +7,10 @@ on:
 jobs:
 jobs:
   validate:
   validate:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
+  permissions:
+    contents: read
+    pull-requests: write
+
     steps:
     steps:
       - uses: actions/checkout@v4
       - uses: actions/checkout@v4
       - name: HACS validation
       - name: HACS validation

+ 5 - 0
.github/workflows/hassfest-validate.yml

@@ -7,6 +7,11 @@ on:
 jobs:
 jobs:
   validate:
   validate:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
+
+  permissions:
+    contents: read
+    pull-requests: write
+
     steps:
     steps:
       - uses: actions/checkout@v4
       - uses: actions/checkout@v4
       - uses: home-assistant/actions/hassfest@master
       - uses: home-assistant/actions/hassfest@master

+ 4 - 0
.github/workflows/linting.yml

@@ -5,6 +5,10 @@ on: [push, pull_request]
 jobs:
 jobs:
   lint:
   lint:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
+    permissions:
+      checks: write
+      contents: read
+      pull-requests: write
     steps:
     steps:
       - uses: actions/checkout@v4
       - uses: actions/checkout@v4
 
 

+ 4 - 0
.github/workflows/tests.yml

@@ -12,6 +12,10 @@ on:
 jobs:
 jobs:
   tests:
   tests:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
+    permissions:
+      checks: write
+      contents: read
+      pull-requests: write
     strategy:
     strategy:
       matrix:
       matrix:
         python-version: ['3.13']
         python-version: ['3.13']

+ 6 - 0
.github/workflows/yamltests.yml

@@ -12,6 +12,12 @@ on:
 jobs:
 jobs:
   tests:
   tests:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
+
+  permissions:
+    checks: write
+    contents: read
+    pull-requests: write
+
     strategy:
     strategy:
       matrix:
       matrix:
         python-version: ['3.13']
         python-version: ['3.13']