Fix for code scanning alert: Workflow does not contain permissions#19
Open
ScottBrenner wants to merge 2 commits intorender-oss:mainfrom
Open
Fix for code scanning alert: Workflow does not contain permissions#19ScottBrenner wants to merge 2 commits intorender-oss:mainfrom
ScottBrenner wants to merge 2 commits intorender-oss:mainfrom
Conversation
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Author
|
Hey @metonym spare a moment to review? |
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.
In general, this issue is fixed by explicitly defining a
permissionsblock for the workflow or individual jobs to restrict theGITHUB_TOKENto the minimal scope needed. For read-only CI jobs like tests and linting,contents: readis typically sufficient, since they only need to clone the repo and read files.The best fix here without changing existing functionality is to add a workflow-level
permissionsblock that applies to bothtestandlintjobs. Both jobs only check out the repository and run local Go commands; they do not require write access to any GitHub resources. Therefore, we can add:near the top of
.github/workflows/checks.yaml, for example immediately after theon:block (or aftername:), so that it applies to all jobs. No other code changes or imports are needed, and behavior of the workflow remains the same except that its token is now scoped down.Concretely: in
.github/workflows/checks.yaml, insert apermissions:section between the existingon:block (lines 3–8) and theenv:block (line 9), leaving all existing keys and job definitions unchanged.Suggested fixes powered by Copilot Autofix. Review carefully before merging.