Skip to content

Commit 1333355

Browse files
iMicknlgithub-advanced-security[bot]Copilot
authored
Set appropriate permissions to all Github Actions workflows (#1976)
Potential fix for [https://github.com/iMicknl/python-overkiz-api/security/code-scanning/19](https://github.com/iMicknl/python-overkiz-api/security/code-scanning/19) In general, the fix is to explicitly declare a `permissions` block in the workflow, restricting the `GITHUB_TOKEN` to the minimum scope required. For this test workflow, read-only access to repository contents is sufficient, so `contents: read` at the top level is appropriate. This documents the intended permissions, avoids accidental write access if organization defaults are broad, and applies to all jobs that do not override permissions. The best concrete fix here is to add a root-level `permissions:` block just after the `name: test` line in `.github/workflows/test.yml`. This will apply `contents: read` to the entire workflow, including the `pytest` job. No existing steps need to be changed, and no additional imports or actions are required because `actions/checkout` and the other used actions work with read-only contents. Only this YAML file needs updating, and the change is limited to inserting the new `permissions` section. _Suggested fixes powered by Copilot Autofix. Review carefully before merging._ --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c2e9e1b commit 1333355

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

.github/workflows/lint.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: lint
22

3+
permissions:
4+
contents: read
5+
36
on:
47
pull_request:
58
push:

.github/workflows/pr-labeler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
name: PR Labeler
2+
permissions:
3+
contents: read
4+
pull-requests: write
25
on:
36
pull_request:
47
types: [opened]

.github/workflows/release-drafter.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
jobs:
99
update_release_draft:
1010
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pull-requests: read
1114
steps:
1215
- name: Update release draft
1316
uses: release-drafter/release-drafter@v7

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: test
22

3+
permissions:
4+
contents: read
5+
36
on:
47
pull_request:
58
push:

0 commit comments

Comments
 (0)