Skip to content

Commit 20eb96e

Browse files
authored
chore: Set permissions for GitHub actions (#3849)
Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much. - Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) Signed-off-by: nathannaveen <[email protected]>
1 parent ed12e6c commit 20eb96e

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

.github/workflows/create-release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@ on:
55
# branches to consider in the event; optional, defaults to all
66
branches:
77
- master
8+
permissions:
9+
contents: read
10+
811
jobs:
912
update_release_draft:
13+
permissions:
14+
contents: write # for release-drafter/release-drafter to create a github release
15+
pull-requests: write # for release-drafter/release-drafter to add label to PR
1016
runs-on: ubuntu-latest
1117
steps:
1218
# Drafts your next Release notes as Pull Requests are merged into "master"

.github/workflows/labeler.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ on:
33
issues:
44
types: [opened, edited]
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
triage:
11+
permissions:
12+
contents: read # for github/issue-labeler to get repo contents
13+
issues: write # for github/issue-labeler to create or remove labels
814
runs-on: ubuntu-latest
915
steps:
1016
- uses: github/[email protected]

.github/workflows/lock.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ on:
44
schedule:
55
- cron: '0 0 * * *'
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
lock:
12+
permissions:
13+
issues: write # for dessant/lock-threads to lock issues
14+
pull-requests: write # for dessant/lock-threads to lock PRs
915
runs-on: ubuntu-latest
1016
steps:
1117
- uses: dessant/lock-threads@v3

.github/workflows/version-check.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ name: Version Check
77
on: push
88

99
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
# This workflow contains a single job called "build"
1215
Version-Check:

0 commit comments

Comments
 (0)