fix: Workflow does not contain permissions#44
Merged
Conversation
…n 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
This PR addresses a GitHub code-scanning alert by explicitly setting minimal GITHUB_TOKEN permissions for the build-and-test job, preventing unintended elevated privileges inherited from repo/org defaults.
Changes:
- Added a
permissionsblock to thebuild-and-testjob. - Set
contents: readas the minimal required scope for checkout/build/test operations.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
BenjaminMichaelis
added a commit
that referenced
this pull request
May 17, 2026
Potential fix for [https://github.com/BenjaminMichaelis/TrxLib/security/code-scanning/3](https://github.com/BenjaminMichaelis/TrxLib/security/code-scanning/3) Add an explicit `permissions` block for the `build-and-test` job in `.github/workflows/build-and-test.yml`, with the minimum required scope: - `contents: read` This is the best fix because it preserves existing behavior (checkout/build/test still work) while ensuring `GITHUB_TOKEN` cannot get unintended write privileges from repo/org defaults. Edit only the `build-and-test` job section, directly under `runs-on`. _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>
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/BenjaminMichaelis/TrxLib/security/code-scanning/3
Add an explicit
permissionsblock for thebuild-and-testjob in.github/workflows/build-and-test.yml, with the minimum required scope:contents: readThis is the best fix because it preserves existing behavior (checkout/build/test still work) while ensuring
GITHUB_TOKENcannot get unintended write privileges from repo/org defaults.Edit only the
build-and-testjob section, directly underruns-on.Suggested fixes powered by Copilot Autofix. Review carefully before merging.