GHA: clarify workflows permissions, set least possible privilege

Set top-level permissions to None on all workflows, setting per-job
permissions. This avoids that new jobs inherit unwanted permissions.

Discussion: https://curl.se/mail/lib-2022-11/0028.html

Signed-off-by: Diogo Teles Sant'Anna <diogoteles@google.com>

Closes #9928
This commit is contained in:
Diogo Teles Sant'Anna 2022-11-16 11:55:33 -03:00 committed by Daniel Stenberg
parent 8fc2423338
commit a2f5a4ca6f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
14 changed files with 33 additions and 9 deletions

View file

@ -14,16 +14,17 @@ concurrency:
# this should not run in parallel, so just run one at a time
group: ${{ github.workflow }}
permissions:
# requires issues AND pull-requests write permissions to edit labels on PRs!
issues: write
pull-requests: write
permissions: {}
jobs:
# add hacktoberfest-accepted label to PRs opened starting from September 30th
# till November 1st which are closed via commit reference from master branch.
merged:
runs-on: ubuntu-latest
permissions:
# requires issues AND pull-requests write permissions to edit labels on PRs!
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v3
with: