From f3d8206a0780a4d91f914dd8ad43f4a8e99bef31 Mon Sep 17 00:00:00 2001 From: neilnaveen <42328488+neilnaveen@users.noreply.github.com> Date: Sat, 9 Apr 2022 05:54:32 -0500 Subject: [PATCH] Set permissions for GitHub actions (#1228) 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: neilnaveen <42328488+neilnaveen@users.noreply.github.com> --- .github/workflows/branch_build.yml | 3 +++ .github/workflows/pr_build.yml | 3 +++ .github/workflows/release.yml | 2 ++ 3 files changed, 8 insertions(+) diff --git a/.github/workflows/branch_build.yml b/.github/workflows/branch_build.yml index 36b07f929..0174d81d4 100644 --- a/.github/workflows/branch_build.yml +++ b/.github/workflows/branch_build.yml @@ -5,6 +5,9 @@ on: - main - develop - release/* +permissions: + contents: read + jobs: install-notest: if: "github.repository != 'WebGoat/WebGoat'" diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index b6c982097..bfd0d43ea 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -20,6 +20,9 @@ on: - 'LICENSE' - 'docs/**' +permissions: + contents: read + jobs: build: runs-on: ${{ matrix.os }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b2f134c76..7f73a10fa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -104,6 +104,8 @@ jobs: - name: "Image digest" run: echo ${{ steps.docker_build.outputs.digest }} new_version: + permissions: + contents: write # for Git to git push if: github.repository == 'WebGoat/WebGoat' name: Update development version needs: [ release ]