From a47e4359bacfb430b30a7c8a4756ed7f4bff0bee Mon Sep 17 00:00:00 2001 From: naveen <172697+naveensrinivasan@users.noreply.github.com> Date: Tue, 14 Jun 2022 00:30:10 +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/update-catch.yaml | 6 ++++++ .github/workflows/update-cli11.yaml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/update-catch.yaml b/.github/workflows/update-catch.yaml index c29b0ca1e4..1fe7d2c603 100644 --- a/.github/workflows/update-catch.yaml +++ b/.github/workflows/update-catch.yaml @@ -3,8 +3,14 @@ on: workflow_dispatch: schedule: - cron: '0 10 1/16 * *' +permissions: + contents: read + jobs: updateCatch: + permissions: + contents: write # for peter-evans/create-pull-request to create branch + pull-requests: write # for peter-evans/create-pull-request to create a PR if: ${{ github.repository == 'mlpack/mlpack' }} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/update-cli11.yaml b/.github/workflows/update-cli11.yaml index bb44ca0727..21d3f917ed 100644 --- a/.github/workflows/update-cli11.yaml +++ b/.github/workflows/update-cli11.yaml @@ -3,8 +3,14 @@ on: workflow_dispatch: schedule: - cron: '0 10 1/16 * *' +permissions: + contents: read + jobs: updateCLI11: + permissions: + contents: write # for peter-evans/create-pull-request to create branch + pull-requests: write # for peter-evans/create-pull-request to create a PR if: ${{ github.repository == 'mlpack/mlpack' }} runs-on: ubuntu-latest steps: