From fe3add2ab8fb87fc21dd540fc574e03765dd1986 Mon Sep 17 00:00:00 2001 From: neilnaveen <42328488+neilnaveen@users.noreply.github.com> Date: Wed, 8 Jun 2022 01:08:12 +0000 Subject: [PATCH] chore: Set permissions for GitHub actions 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: neilnaveen <42328488+neilnaveen@users.noreply.github.com> --- .github/workflows/build.yml | 3 +++ .github/workflows/coverity.yml | 3 +++ .github/workflows/sanitizers.yml | 3 +++ .github/workflows/static-analysis.yml | 3 +++ 4 files changed, 12 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 291fa5822..be62af3f2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,6 +2,9 @@ name: Simple test build on: - push - pull_request +permissions: + contents: read + jobs: test: strategy: diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 9ea82a350..0fc981726 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -3,6 +3,9 @@ on: push: branches: - master +permissions: + contents: read + jobs: test: runs-on: ubuntu-latest diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml index 76339e19c..dad5c11d7 100644 --- a/.github/workflows/sanitizers.yml +++ b/.github/workflows/sanitizers.yml @@ -2,6 +2,9 @@ name: Sanitizers build on: - push - pull_request +permissions: + contents: read + jobs: sanitizers: strategy: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 0317559ad..4144371e2 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -2,6 +2,9 @@ name: Static analysis on: - push - pull_request +permissions: + contents: read + jobs: test: runs-on: ubuntu-18.04 -- 2.47.2