Set appropriate permissions to all Github Actions workflows#1976
Merged
Set appropriate permissions to all Github Actions workflows#1976
Conversation
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…in permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…in permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…in permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds explicit permissions blocks to GitHub Actions workflows to address code scanning alert #19 by restricting the default GITHUB_TOKEN scope to the minimum required.
Changes:
- Set workflow-level
permissions: contents: readfortestandlintworkflows. - Set workflow-level permissions for
pr-labelerto allow PR labeling while keeping repo contents read-only. - Add job-level permissions for
release-drafterto allow updating release drafts.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/test.yml | Adds top-level permissions with contents: read for the test workflow. |
| .github/workflows/lint.yaml | Adds top-level permissions with contents: read for the lint workflow. |
| .github/workflows/pr-labeler.yml | Adds top-level permissions (contents: read, pull-requests: write) for PR labeling. |
| .github/workflows/release-drafter.yml | Adds job-level permissions to allow release draft updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/iMicknl/python-overkiz-api/security/code-scanning/19
In general, the fix is to explicitly declare a
permissionsblock in the workflow, restricting theGITHUB_TOKENto the minimum scope required. For this test workflow, read-only access to repository contents is sufficient, socontents: readat 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 thename: testline in.github/workflows/test.yml. This will applycontents: readto the entire workflow, including thepytestjob. No existing steps need to be changed, and no additional imports or actions are required becauseactions/checkoutand the other used actions work with read-only contents. Only this YAML file needs updating, and the change is limited to inserting the newpermissionssection.Suggested fixes powered by Copilot Autofix. Review carefully before merging.