Skip to content

Commit

Permalink
github: Minimize permissions granted to automated workflows / jobs
Browse files Browse the repository at this point in the history
Jobs that use the GITHUB_TOKEN to perform sensitive actions on behalf of
a real user may be granted a range of permissions. Instead of granting
blanket permissions to read and write "all" APIs, we should really limit
the permissions what any individual workflow or job can do.

This commit sets the default permissions for each workflow to "contents:
read", which allows jobs to only read from the repository.

Link: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idpermissions
Signed-off-by: Jason Gerecke <[email protected]>
  • Loading branch information
jigpu authored and whot committed Nov 30, 2023
1 parent 3d3b474 commit dbb8ddc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
on: [ push, pull_request ]

permissions:
contents: read

jobs:
python-black:
runs-on: ubuntu-20.04
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
on: [ push, pull_request ]

permissions:
contents: read

env:
CFLAGS: -Werror
UBUNTU_PACKAGES: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
- cron: '0 0 1,15 * *'
workflow_dispatch:

permissions:
contents: read

env:
COVERITY_SCAN_PROJECT_NAME: linuxwacom/xf86-input-wacom
COVERITY_SCAN_NOTIFICATION_EMAIL: [email protected]
Expand Down

0 comments on commit dbb8ddc

Please sign in to comment.