]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
chore: Set permissions for GitHub actions (#10399)
authorNaveen <172697+naveensrinivasan@users.noreply.github.com>
Mon, 13 Jun 2022 14:25:56 +0000 (09:25 -0500)
committerGitHub <noreply@github.com>
Mon, 13 Jun 2022 14:25:56 +0000 (10:25 -0400)
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
.github/workflows/compressed-size.yml
.github/workflows/deploy-docs.yml
.github/workflows/release-drafter.yml
.github/workflows/release.yml

index 3d45319759a0968f5b3feab6af4edb574fda7e70..2e3139957986f329d6a9805f445aca818dd7fdf4 100644 (file)
@@ -10,8 +10,15 @@ on:
       - master
       - "2.9"
   workflow_dispatch:
+permissions:
+  contents: read
+
 jobs:
   build:
+    permissions:
+      checks: write  # for coverallsapp/github-action to create new checks
+      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: ${{ matrix.os }}
 
     outputs:
@@ -94,6 +101,8 @@ jobs:
           parallel: true
 
   finish:
+    permissions:
+      checks: write  # for coverallsapp/github-action to create new checks
     needs: build
     runs-on: ubuntu-latest
     steps:
index ed9f8723b23495af876f1cd03f8d7b37b7ff5033..a999a7535556ef7f07e4b6c051a02370b76e14ac 100644 (file)
@@ -2,9 +2,17 @@ name: Compressed Size
 
 on: [pull_request]
 
+permissions:
+  contents: read
+
 jobs:
   build:
 
+    permissions:
+      checks: write  # for preactjs/compressed-size-action to create and update the checks
+      contents: read  # for actions/checkout to fetch code
+      issues: write  # for preactjs/compressed-size-action to create comments
+      pull-requests: write  # for preactjs/compressed-size-action to write a PR review
     runs-on: ubuntu-latest
 
     steps:
index e73bb894d70a89a19b5026a3c31d9acd172c7ea1..219bc87a474e2d597ffb407221045e19339fc67e 100644 (file)
@@ -6,8 +6,13 @@ on:
     branches:
       - master
 
+permissions:
+  contents: read
+
 jobs:
   correct_repository:
+    permissions:
+      contents: none
     runs-on: ubuntu-latest
     steps:
       - name: fail on fork
index 183c7174639479f5db22cc786af6b66a52226261..1bf557b652a3b6e07979bc1d2d753651f025e670 100644 (file)
@@ -6,8 +6,13 @@ on:
       - master
   workflow_dispatch:
 
+permissions:
+  contents: read
+
 jobs:
   correct_repository:
+    permissions:
+      contents: none
     runs-on: ubuntu-latest
     steps:
     - name: fail on fork
@@ -15,6 +20,9 @@ jobs:
       run: exit 1
 
   update_release_draft:
+    permissions:
+      contents: write  # for release-drafter/release-drafter to create a github release
+      pull-requests: write  # for release-drafter/release-drafter to add label to PR
     needs: correct_repository
     runs-on: ubuntu-latest
     steps:
index aaaeb415fa3b7d42d3b2e0234f90f4c913fbe92b..c5b3f3bd87e47ba2a8c19b31d4f10a166d2443c9 100644 (file)
@@ -2,10 +2,17 @@ name: Release
 
 on:
   release:
+    permissions:
+      contents: write  # for actions/upload-release-asset to upload release asset
     types: [published]
 
+permissions:
+  contents: read
+
 jobs:
   setup:
+    permissions:
+      contents: none
     runs-on: ubuntu-latest
     outputs:
       version: ${{ steps.trim.outputs.version }}