From b6a76b57333ae551c40960e18c40d501cf81aabc Mon Sep 17 00:00:00 2001 From: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> Date: Thu, 7 Apr 2022 23:09:48 +0000 Subject: [PATCH] Set permissions for GitHub actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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/) 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. Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> --- .github/workflows/lock.yaml | 6 ++++++ .github/workflows/tests.yaml | 3 +++ 2 files changed, 9 insertions(+) diff --git a/.github/workflows/lock.yaml b/.github/workflows/lock.yaml index b4f76338..647fe9dd 100644 --- a/.github/workflows/lock.yaml +++ b/.github/workflows/lock.yaml @@ -4,8 +4,14 @@ on: schedule: - cron: '0 0 * * *' +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@v3 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 7ad21db9..c3819956 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -16,6 +16,9 @@ on: - 'docs/**' - '*.md' - '*.rst' +permissions: + contents: read + jobs: tests: name: ${{ matrix.name }}