From 2b97cb4173e9ace6b278016aa8d497c792021db5 Mon Sep 17 00:00:00 2001 From: naveen <172697+naveensrinivasan@users.noreply.github.com> Date: Tue, 3 May 2022 01:00:08 +0000 Subject: [PATCH 1/2] chore: Set permissions for GitHub actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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> --- .github/workflows/changelog.yml | 3 +++ .github/workflows/doc.yml | 3 +++ .github/workflows/docker.yml | 3 +++ .github/workflows/fuzz.yml | 3 +++ .github/workflows/pypi_upload.yml | 3 +++ .github/workflows/upload_binary.yml | 5 +++++ .github/workflows/uvloop_test.yml | 3 +++ 7 files changed, 23 insertions(+) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 3ffdb086493..b3e1f0b9024 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 1ad4b3a7605..e2a0142cc65 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 b75ce2bb6f1..0a4848faad8 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 8fba67a5a01..d796fd50564 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 9d970592d98..ef524a8ece6 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 ed8d9fdd572..b31c0276ea5 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 14b17d68424..bbc39935f89 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 From 922d22561870b54b73f47e7a4d9b62c27ac4eb62 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 2 May 2022 21:43:58 -0600 Subject: [PATCH 2/2] Update .github/workflows/upload_binary.yml --- .github/workflows/upload_binary.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upload_binary.yml b/.github/workflows/upload_binary.yml index b31c0276ea5..6bb1d23306b 100644 --- a/.github/workflows/upload_binary.yml +++ b/.github/workflows/upload_binary.yml @@ -10,7 +10,7 @@ permissions: jobs: build: permissions: - contents: write # for actions/upload-release-asset to upload release asset + contents: write # for actions/upload-release-asset to upload release asset runs-on: ${{ matrix.os }} strategy: fail-fast: false