Skip to content

Commit c79ae15

Browse files
committed
Narrows privileges for GitHub workflow in publish.yml
Why: The principle of Least Privilege guards against a vulnerability in the actions.
1 parent 0618829 commit c79ae15

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
pull_request:
99
workflow_dispatch:
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
lint:
1316
runs-on: ubuntu-latest
@@ -55,6 +58,11 @@ jobs:
5558
strategy:
5659
matrix:
5760
version: ["3.5.0", "3.4.0", "3.3.1", "2.93.9"]
61+
permissions:
62+
contents: read
63+
actions: write # essential for uploading artifacts to GitHub's storage
64+
id-token: write # enables authentication with GitHub's cache service
65+
packages: write # required for artifact storage operations
5866
timeout-minutes: 20
5967
steps:
6068
- uses: actions/checkout@v5
@@ -110,6 +118,10 @@ jobs:
110118
if-no-files-found: error
111119

112120
publish:
121+
permissions:
122+
contents: read
123+
actions: write # essential for uploading artifacts to GitHub's storage
124+
packages: write # enables writing to GitHub's package storage
113125
needs: test
114126
runs-on: ubuntu-latest
115127
timeout-minutes: 20

0 commit comments

Comments
 (0)