fix: add explicit permissions to GitHub Actions workflow jobs#401
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix code scanning alerts #1, #2, #5, and #50
fix: add explicit permissions to GitHub Actions workflow jobs
Jul 21, 2026
MaStr
approved these changes
Jul 21, 2026
MaStr
marked this pull request as ready for review
July 21, 2026 09:33
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the repository’s GitHub Actions security posture by explicitly scoping GITHUB_TOKEN permissions on jobs that only need to read repository contents, avoiding reliance on potentially broader default permissions.
Changes:
- Added
permissions: contents: readto thetestjob inpytest.yml. - Added
permissions: contents: readto thelintjob inpylint.yml. - Added
permissions: contents: readto bothbuildandmergejobs indocker-image.yml.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| .github/workflows/docker-image.yml | Restricts token permissions for Docker build/merge jobs to read-only repo access. |
| .github/workflows/pylint.yml | Restricts token permissions for the lint job to read-only repo access. |
| .github/workflows/pytest.yml | Restricts token permissions for the test job to read-only repo access. |
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.
GitHub Actions jobs in three workflows were running without explicit
permissionsblocks, leaving them subject to potentially over-broad defaultGITHUB_TOKENpermissions (read-write on older repos/orgs).Changes
.github/workflows/docker-image.yml— addedpermissions: contents: readto both thebuildandmergejobs (alerts Lastprofil #1, Battery is force charged after being below minimum #50).github/workflows/pylint.yml— addedpermissions: contents: readto thelintjob (alert Problem beim Start #2).github/workflows/pytest.yml— addedpermissions: contents: readto thetestjob (alert Adding new variables and additional flexibility for config (FC Solar, Fronius) #5)All affected jobs only need to read repo contents; Docker Hub pushes use external secrets and don't require any GITHUB_TOKEN write scope.