From 83ea328ef540f66fbe87a1989a95499ea906b362 Mon Sep 17 00:00:00 2001 From: naveen <172697+naveensrinivasan@users.noreply.github.com> Date: Fri, 17 Jun 2022 00:32:28 +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/build.yml | 2 ++ .github/workflows/check.yml | 3 +++ .github/workflows/lint.yml | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7775dcbf9..767afe28b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -155,6 +155,8 @@ jobs: continue-on-error: true macOS: + permissions: + contents: none runs-on: macos-10.15 needs: Fetch-Source strategy: diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index ccca43d27..da7ca7dd9 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -19,6 +19,9 @@ concurrency: group: check-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +permissions: + contents: read + jobs: check: runs-on: ubuntu-18.04 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index df35b1b7f..58c6007d2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,8 +6,14 @@ concurrency: group: lint-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +permissions: + contents: read + jobs: lint: + permissions: + contents: read # for actions/checkout to fetch code + statuses: write # for github/super-linter to mark status of each linter run name: Lint runs-on: ubuntu-latest steps: