Skip to content

Commit 9ef7d3c

Browse files
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 <[email protected]>
1 parent 420c013 commit 9ef7d3c

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

.github/workflows/cancel.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ name: "Cancel"
99
on:
1010
push:
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
cancel:
17+
permissions:
18+
actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows
1419
runs-on: ubuntu-latest
1520
steps:
1621
- name: "Cancel Previous Runs"

.github/workflows/kit.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ defaults:
3232
env:
3333
PIP_DISABLE_PIP_VERSION_CHECK: 1
3434

35+
permissions:
36+
contents: read
37+
3538
jobs:
3639
wheels:
3740
name: "Build ${{ matrix.os }} ${{ matrix.py }} ${{ matrix.arch }} wheels"

.github/workflows/quality.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ defaults:
1818
env:
1919
PIP_DISABLE_PIP_VERSION_CHECK: 1
2020

21+
permissions:
22+
contents: read
23+
2124
jobs:
2225
lint:
2326
name: "Pylint etc"

.github/workflows/testsuite.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ env:
1919
PIP_DISABLE_PIP_VERSION_CHECK: 1
2020
COVERAGE_IGOR_VERBOSE: 1
2121

22+
permissions:
23+
contents: read
24+
2225
jobs:
2326
tests:
2427
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }}"

0 commit comments

Comments
 (0)