From bd50c4e7b011af192f1b77e34e1aefd8452276bf Mon Sep 17 00:00:00 2001 From: naveen <172697+naveensrinivasan@users.noreply.github.com> Date: Tue, 28 Jun 2022 00:29:16 +0000 Subject: [PATCH] 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/ci.yml | 5 +++++ .github/workflows/shepherd.yml | 3 +++ .github/workflows/windows-ci.yml | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1347724d..4dcae6d29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,9 @@ name: Run unit tests on: [push, pull_request] +permissions: + contents: read + jobs: lint: name: Check PHP syntax @@ -42,6 +45,8 @@ jobs: - run: | git ls-files | grep \\\.php$ | grep -v ^dictionaries/scripts/* | ./vendor/bin/parallel-lint --stdin chunk-matrix: + permissions: + contents: none name: Generate Chunk Matrix runs-on: ubuntu-latest diff --git a/.github/workflows/shepherd.yml b/.github/workflows/shepherd.yml index 1ff141958..b60bca06d 100644 --- a/.github/workflows/shepherd.yml +++ b/.github/workflows/shepherd.yml @@ -2,6 +2,9 @@ name: Run Shepherd on: [push, pull_request] +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index dc5fd77c5..b901fcdf8 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -2,8 +2,13 @@ name: Run unit tests on Windows on: [push, pull_request] +permissions: + contents: read + jobs: chunk-matrix: + permissions: + contents: none name: Generate Chunk Matrix runs-on: ubuntu-latest