From 92742f9cc82dfd7405dea255ac8fff1d9c6b6d8e Mon Sep 17 00:00:00 2001 From: Alex <93376818+sashashura@users.noreply.github.com> Date: Wed, 31 Aug 2022 22:17:49 +0100 Subject: [PATCH] GitHub Workflows security hardening This commit adds explicit permissions section to workflows. This is a security best practice because by default workflows run with extended set of permissions (except from on: pull_request from external forks). By specifying any permission explicitly all others are set to none. By using the principle of least privilege the damage a compromised workflow can do (because of an injection or compromised third party tool or action) is restricted. It is recommended to have most strict permissions on the top level and grant write permissions on job level case by case. Refs #2810 --- .github/workflows/maven.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 5475d431c4..e5e64fa6a0 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -6,6 +6,8 @@ on: push: branches: - release/* +permissions: + contents: read jobs: build: runs-on: ${{ matrix.os }}