From: Naveen <172697+naveensrinivasan@users.noreply.github.com> Date: Tue, 3 May 2022 13:08:33 +0000 (-0500) Subject: chore: Set permissions for GitHub actions (#3043) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/c940f75d5b646777427aef1beb18a0d2c391f5e2?ds=inline chore: Set permissions for GitHub actions (#3043) 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: naveen <172697+naveensrinivasan@users.noreply.github.com> --- diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 3ffdb08..b3e1f0b 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -4,6 +4,9 @@ on: pull_request: types: [opened, synchronize, labeled, unlabeled, reopened] +permissions: + contents: read + jobs: build: name: Changelog Entry Check diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 1ad4b3a..e2a0142 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -2,6 +2,9 @@ name: Documentation Build on: [push, pull_request] +permissions: + contents: read + jobs: build: # We want to run on external PRs, but not on our own internal PRs as they'll be run diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b75ce2b..0a4848f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -7,6 +7,9 @@ on: release: types: [published] +permissions: + contents: read + jobs: docker: if: github.repository == 'psf/black' diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 8fba67a..d796fd5 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -2,6 +2,9 @@ name: Fuzz on: [push, pull_request] +permissions: + contents: read + jobs: build: # We want to run on external PRs, but not on our own internal PRs as they'll be run diff --git a/.github/workflows/pypi_upload.yml b/.github/workflows/pypi_upload.yml index 9d97059..ef524a8 100644 --- a/.github/workflows/pypi_upload.yml +++ b/.github/workflows/pypi_upload.yml @@ -4,6 +4,9 @@ on: release: types: [published] +permissions: + contents: read + jobs: build: name: PyPI Upload diff --git a/.github/workflows/upload_binary.yml b/.github/workflows/upload_binary.yml index ed8d9fd..6bb1d23 100644 --- a/.github/workflows/upload_binary.yml +++ b/.github/workflows/upload_binary.yml @@ -4,8 +4,13 @@ on: release: types: [published] +permissions: + contents: read + jobs: build: + permissions: + contents: write # for actions/upload-release-asset to upload release asset runs-on: ${{ matrix.os }} strategy: fail-fast: false diff --git a/.github/workflows/uvloop_test.yml b/.github/workflows/uvloop_test.yml index 14b17d6..bbc3993 100644 --- a/.github/workflows/uvloop_test.yml +++ b/.github/workflows/uvloop_test.yml @@ -11,6 +11,9 @@ on: - "docs/**" - "*.md" +permissions: + contents: read + jobs: build: # We want to run on external PRs, but not on our own internal PRs as they'll be run