Potential fix for code scanning alert no. 13: Workflow does not contain permissions#4
Merged
Potential fix for code scanning alert no. 13: Workflow does not contain permissions#4
Conversation
…in permissions 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/aurabx/harmony/security/code-scanning/13
In general, the fix is to explicitly restrict the
GITHUB_TOKENpermissions for this workflow or job, rather than relying on repository defaults. Since thebuild-binariesjob only reads the repository and uploads build artifacts, it should only needcontents: read. We can either set permissions at the workflow root (applying to all jobs that don’t override them) or directly on thebuild-binariesjob. Because thedockerjob already has its own explicit permissions, adding a workflow‑rootpermissionsblock withcontents: readis safe:dockerwill continue to use its own, more permissive block, andbuild-binarieswill get minimal read-only access.The best minimal change without affecting existing behavior is therefore to add a
permissions:block at the top level of the workflow, just aftername: Releases(or just beforeenv:), specifyingcontents: read. This constrainsGITHUB_TOKENforbuild-binaries(the job flagged by CodeQL) while leaving the existingdockerjob permissions intact. No imports or external dependencies are needed; this is purely a YAML configuration change within.github/workflows/build.yml.Suggested fixes powered by Copilot Autofix. Review carefully before merging.
Note
Tightens default token scope for the Releases workflow.
permissionsblock withcontents: readin.github/workflows/build.yml, ensuring jobs without overrides use read-onlyGITHUB_TOKEN.Written by Cursor Bugbot for commit 42a2535. This will update automatically on new commits. Configure here.