From 12c55290a3080f22721e4ad8d60f9742e70c04aa Mon Sep 17 00:00:00 2001 From: Naveen <172697+naveensrinivasan@users.noreply.github.com> Date: Sat, 2 Jul 2022 16:58:16 -0500 Subject: [PATCH] chore: Set permissions for GitHub actions (#8117) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 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> (cherry picked from commit a8af28c99431fb62243f025cdea18099dde0c844) --- .github/workflows/run-on-pr.yaml | 3 +++ .github/workflows/run-test.yaml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/run-on-pr.yaml b/.github/workflows/run-on-pr.yaml index 2a04a1f048..352eec3abb 100644 --- a/.github/workflows/run-on-pr.yaml +++ b/.github/workflows/run-on-pr.yaml @@ -12,6 +12,9 @@ env: # global env to all steps TOX_WORKERS: -n2 +permissions: + contents: read + jobs: run-test-amd64: name: ${{ matrix.python-version }}-${{ matrix.build-type }}-${{ matrix.architecture }}-${{ matrix.os }} diff --git a/.github/workflows/run-test.yaml b/.github/workflows/run-test.yaml index 81b6799e1b..36dfce250d 100644 --- a/.github/workflows/run-test.yaml +++ b/.github/workflows/run-test.yaml @@ -16,6 +16,9 @@ env: # global env to all steps TOX_WORKERS: -n2 +permissions: + contents: read + jobs: run-test: name: ${{ matrix.python-version }}-${{ matrix.build-type }}-${{ matrix.architecture }}-${{ matrix.os }} -- 2.47.2