From 356c1f833641c139b554548edbcd33bfbbc44540 Mon Sep 17 00:00:00 2001 From: neilnaveen <42328488+neilnaveen@users.noreply.github.com> Date: Tue, 7 Jun 2022 01:08:13 +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: neilnaveen <42328488+neilnaveen@users.noreply.github.com> --- .github/workflows/configs-build.yml | 3 +++ .github/workflows/coverity-scan.yml | 3 +++ .github/workflows/linux-ci.yml | 3 +++ .github/workflows/macos-ci.yml | 3 +++ .github/workflows/msvc-ci.yml | 3 +++ .github/workflows/msys2-ci.yml | 3 +++ 6 files changed, 18 insertions(+) diff --git a/.github/workflows/configs-build.yml b/.github/workflows/configs-build.yml index ee84145e9..1f73306f2 100644 --- a/.github/workflows/configs-build.yml +++ b/.github/workflows/configs-build.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ main ] +permissions: + contents: read + jobs: build: runs-on: ubuntu-18.04 diff --git a/.github/workflows/coverity-scan.yml b/.github/workflows/coverity-scan.yml index 1561e8f76..0343a9441 100644 --- a/.github/workflows/coverity-scan.yml +++ b/.github/workflows/coverity-scan.yml @@ -4,6 +4,9 @@ on: schedule: - cron: '0 10 * * *' # Daily at 10:00 UTC +permissions: + contents: read + jobs: latest: runs-on: ubuntu-latest diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index 012d5125c..e77fee6d9 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ main ] +permissions: + contents: read + jobs: build: runs-on: ubuntu-18.04 diff --git a/.github/workflows/macos-ci.yml b/.github/workflows/macos-ci.yml index 96853d71e..e19924e78 100644 --- a/.github/workflows/macos-ci.yml +++ b/.github/workflows/macos-ci.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ main ] +permissions: + contents: read + jobs: build: runs-on: macos-10.15 diff --git a/.github/workflows/msvc-ci.yml b/.github/workflows/msvc-ci.yml index 77ffed056..b513154bc 100644 --- a/.github/workflows/msvc-ci.yml +++ b/.github/workflows/msvc-ci.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ main ] +permissions: + contents: read + jobs: msvc: runs-on: ${{ matrix.os }} diff --git a/.github/workflows/msys2-ci.yml b/.github/workflows/msys2-ci.yml index b8b2fc390..5cdc1e0f1 100644 --- a/.github/workflows/msys2-ci.yml +++ b/.github/workflows/msys2-ci.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ main ] +permissions: + contents: read + jobs: msys2: runs-on: windows-latest