From 8384c321fc2f62ae52146d0a53ca749de6e94a36 Mon Sep 17 00:00:00 2001 From: Naveen <172697+naveensrinivasan@users.noreply.github.com> Date: Wed, 1 Jun 2022 22:02:45 -0500 Subject: [PATCH] chore: Set permissions for GitHub actions (#6063) 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/android-build.yml | 3 +++ .github/workflows/coverage.yml | 3 +++ .github/workflows/cross-build.yml | 3 +++ .github/workflows/docker-image.yml | 3 +++ .github/workflows/wip.yml | 3 +++ 5 files changed, 15 insertions(+) diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index b3a17f301..57a1860f9 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -7,6 +7,9 @@ on: env: BUILD_TYPE: Release +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 75a866233..00ca4d3ae 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -6,6 +6,9 @@ on: schedule: - cron: "0 11 * * *" +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/cross-build.yml b/.github/workflows/cross-build.yml index 5efd00329..5586f936a 100644 --- a/.github/workflows/cross-build.yml +++ b/.github/workflows/cross-build.yml @@ -4,6 +4,9 @@ on: push: pull_request: +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 843b1c75e..e2a1d2f1f 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -5,6 +5,9 @@ on: - cron: "0 1 * * 0" # every Sunday at 1 am workflow_dispatch: # on button click +permissions: + contents: read + jobs: push_to_registry: name: Push Docker image to GitHub Docker registry diff --git a/.github/workflows/wip.yml b/.github/workflows/wip.yml index e0129757b..81986ebc2 100644 --- a/.github/workflows/wip.yml +++ b/.github/workflows/wip.yml @@ -7,6 +7,9 @@ on: env: BUILD_TYPE: Debug +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest