From 1331b65023b2f8b73a30224fb3ee538624f53528 Mon Sep 17 00:00:00 2001 From: naveen <172697+naveensrinivasan@users.noreply.github.com> Date: Sun, 5 Jun 2022 00:29: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/lockthreads.yml | 6 ++++++ .github/workflows/main.yml | 3 +++ 2 files changed, 9 insertions(+) diff --git a/.github/workflows/lockthreads.yml b/.github/workflows/lockthreads.yml index e2988122f..65ff08d0f 100644 --- a/.github/workflows/lockthreads.yml +++ b/.github/workflows/lockthreads.yml @@ -7,8 +7,14 @@ on: # min 0-59 ┘ │ │ │ └ weekday 0-6 # hour 0-23 ┘ │ └ month 1-12 # └ day 1-31 +permissions: + contents: read + jobs: lock: + permissions: + issues: write # for dessant/lock-threads to lock issues + pull-requests: write # for dessant/lock-threads to lock PRs runs-on: ubuntu-latest steps: - uses: dessant/lock-threads@v2 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b3c15688b..38ffbf481 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,6 +6,9 @@ env: CTEST_PARALLEL_LEVEL: "1" CMAKE_BUILD_PARALLEL_LEVEL: "4" +permissions: + contents: read + jobs: ubuntu: