Skip to content

Commit

Permalink
add permissions (restrictions) to GitHub actions
Browse files Browse the repository at this point in the history
follow principle of least privilege
  • Loading branch information
fohrloop committed Jan 22, 2024
1 parent 7640071 commit efb981d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/tests-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ name: Run tests (Linux)
'on':
[workflow_dispatch]

# See: https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions:
actions: write
checks: none
contents: read
deployments: none
id-token: none
issues: none
discussions: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: read
statuses: none

# Cancel in-progress jobs/runs for the same workflow; if you push to same
# pull request twice, the previous workflow should be canceled.
# From: https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/tests-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ name: Run tests (Mac)
on:
[workflow_dispatch]

# See: https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions:
actions: write
checks: none
contents: read
deployments: none
id-token: none
issues: none
discussions: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: read
statuses: none

# Cancel in-progress jobs/runs for the same workflow; if you push to same
# pull request twice, the previous workflow should be canceled.
# From: https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/tests-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ name: Run tests (Win)
on:
[workflow_dispatch]

# See: https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions:
actions: write
checks: none
contents: read
deployments: none
id-token: none
issues: none
discussions: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: read
statuses: none

# Cancel in-progress jobs/runs for the same workflow; if you push to same
# pull request twice, the previous workflow should be canceled.
# From: https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
Expand Down

0 comments on commit efb981d

Please sign in to comment.