summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaveen <172697+naveensrinivasan@users.noreply.github.com>2022-05-03 04:33:34 -0500
committerGitHub <noreply@github.com>2022-05-03 02:33:34 -0700
commit9ef7d3c4b1fc451bee5a18b10b74f4cabb1e048d (patch)
treedf31c49c9ed493c53c4c4595b5ed289f5f67b765
parent420c01394a31415d7a7cbb80be196bcfca48482c (diff)
downloadpython-coveragepy-git-9ef7d3c4b1fc451bee5a18b10b74f4cabb1e048d.tar.gz
build: Set permissions for GitHub actions (#1369)
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>
-rw-r--r--.github/workflows/cancel.yml5
-rw-r--r--.github/workflows/kit.yml3
-rw-r--r--.github/workflows/quality.yml3
-rw-r--r--.github/workflows/testsuite.yml3
4 files changed, 14 insertions, 0 deletions
diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml
index 3061a083..7eb92afd 100644
--- a/.github/workflows/cancel.yml
+++ b/.github/workflows/cancel.yml
@@ -9,8 +9,13 @@ name: "Cancel"
on:
push:
+permissions:
+ contents: read
+
jobs:
cancel:
+ permissions:
+ actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows
runs-on: ubuntu-latest
steps:
- name: "Cancel Previous Runs"
diff --git a/.github/workflows/kit.yml b/.github/workflows/kit.yml
index 3538eb09..61701b5d 100644
--- a/.github/workflows/kit.yml
+++ b/.github/workflows/kit.yml
@@ -32,6 +32,9 @@ defaults:
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
+permissions:
+ contents: read
+
jobs:
wheels:
name: "Build ${{ matrix.os }} ${{ matrix.py }} ${{ matrix.arch }} wheels"
diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml
index d6388ff9..33d73b79 100644
--- a/.github/workflows/quality.yml
+++ b/.github/workflows/quality.yml
@@ -18,6 +18,9 @@ defaults:
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
+permissions:
+ contents: read
+
jobs:
lint:
name: "Pylint etc"
diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml
index bd6ca847..ca37146c 100644
--- a/.github/workflows/testsuite.yml
+++ b/.github/workflows/testsuite.yml
@@ -19,6 +19,9 @@ env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
COVERAGE_IGOR_VERBOSE: 1
+permissions:
+ contents: read
+
jobs:
tests:
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }}"