From 8c2e23ecf6f2ab4f1ce314c925f880bbd22c772c Mon Sep 17 00:00:00 2001 From: naveen <172697+naveensrinivasan@users.noreply.github.com> Date: Sat, 4 Jun 2022 00:31: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/coverity-scan.yml | 3 +++ .github/workflows/docker.yml | 3 +++ .github/workflows/generate-docs.yml | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/.github/workflows/coverity-scan.yml b/.github/workflows/coverity-scan.yml index 6a9c4e00ba..9b6a797702 100644 --- a/.github/workflows/coverity-scan.yml +++ b/.github/workflows/coverity-scan.yml @@ -4,6 +4,9 @@ on: schedule: - cron: '0 0 * * 1,3,5' +permissions: + contents: read + jobs: scan: if: github.repository == 'zeek/zeek' diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 738cbf727e..979b6938ab 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -18,6 +18,9 @@ env: IMAGE_FILE: /tmp/zeek-image.tar IMAGE_PATH: /tmp +permissions: + contents: read + jobs: docker-build: runs-on: ubuntu-latest diff --git a/.github/workflows/generate-docs.yml b/.github/workflows/generate-docs.yml index 8ddf861401..da02c79f34 100644 --- a/.github/workflows/generate-docs.yml +++ b/.github/workflows/generate-docs.yml @@ -9,8 +9,13 @@ defaults: run: shell: bash +permissions: + contents: read + jobs: generate: + permissions: + contents: write # for Git to git push if: github.repository == 'zeek/zeek' runs-on: ubuntu-latest