Skip to content

Commit

Permalink
build: Set permissions for GitHub actions (#1369)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
naveensrinivasan committed May 3, 2022
1 parent 420c013 commit 9ef7d3c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/cancel.yml
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/kit.yml
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/quality.yml
Expand Up @@ -18,6 +18,9 @@ defaults:
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1

permissions:
contents: read

jobs:
lint:
name: "Pylint etc"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/testsuite.yml
Expand Up @@ -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 }}"
Expand Down

0 comments on commit 9ef7d3c

Please sign in to comment.