From 11316b29af5a3c17f01a13e350a002316af6b14f Mon Sep 17 00:00:00 2001 From: nathannaveen <42319948+nathannaveen@users.noreply.github.com> Date: Mon, 30 May 2022 00:58:11 +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: nathannaveen <42319948+nathannaveen@users.noreply.github.com> --- .github/workflows/doc.yml | 3 +++ .github/workflows/linux.yml | 3 +++ .github/workflows/macos.yml | 3 +++ .github/workflows/windows.yml | 3 +++ 4 files changed, 12 insertions(+) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 5f154a92..47c09774 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -2,6 +2,9 @@ name: doc on: [push, pull_request] +permissions: + contents: read + jobs: build: # Use Ubuntu 20.04 because doxygen 1.8.13 from Ubuntu 18.04 is broken. diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 5467cd8f..1d0181ce 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -2,6 +2,9 @@ name: linux on: [push, pull_request] +permissions: + contents: read + jobs: build: runs-on: ${{ matrix.os }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index e300a22b..24dd5958 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -2,6 +2,9 @@ name: macos on: [push, pull_request] +permissions: + contents: read + jobs: build: runs-on: macos-10.15 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index c060f8b9..34bd57be 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -2,6 +2,9 @@ name: windows on: [push, pull_request] +permissions: + contents: read + jobs: build: runs-on: ${{matrix.os}}