From d9aa5985331ae0cb8fb70c38a3159bf313fdc9d1 Mon Sep 17 00:00:00 2001 From: naveen <172697+naveensrinivasan@users.noreply.github.com> Date: Sun, 3 Jul 2022 00:29:45 +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/ci.yml | 3 +++ .github/workflows/news-file.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e467b3e50b1..8010769f72c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,6 +32,9 @@ jobs: - run: nox -s docs determine-changes: + permissions: + contents: read # for dorny/paths-filter to fetch a list of changed files + pull-requests: read # for dorny/paths-filter to read pull requests runs-on: ubuntu-latest outputs: tests: ${{ steps.filter.outputs.tests }} diff --git a/.github/workflows/news-file.yml b/.github/workflows/news-file.yml index da7119a5573..517be7d477d 100644 --- a/.github/workflows/news-file.yml +++ b/.github/workflows/news-file.yml @@ -4,6 +4,9 @@ on: pull_request: types: [labeled, unlabeled, opened, reopened, synchronize] +permissions: + contents: read + jobs: check-news-entry: name: news entry