[BUILD]: Add least privilege principle to build workflow - #899
Merged
MacOS merged 3 commits intoJul 29, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the GitHub Actions build workflow to follow least-privilege by defaulting GITHUB_TOKEN permissions to none at the workflow level, then re-enabling only the required permission(s) for specific jobs to improve OpenSSF Scorecard results.
Changes:
- Set workflow-level
permissions: {}(no default token permissions). - Add job-level
permissions: contents: readto thetestjob.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (4)
.github/workflows/build.yml:114
- Same as the
testjob: this job usesactions/cache, but itspermissionsonly grantcontents: read. Addactions: writeso cache save/update can work. This also removes the stray whitespace-only line under the permissions block.
permissions:
contents: read
.github/workflows/build.yml:113
- The PR description says
contents: readis added only for thetestjob, but the workflow also grants it toassemble. Either update the PR description to match the actual change, or clarify that both jobs need repo read access foractions/checkout.
permissions:
contents: read
.github/workflows/build.yml:45
actions/cacheneeds theactionspermission to save/update caches. With workflow-levelpermissions: {}and job-levelpermissionsonly grantingcontents: read, the cache step will be unable to write caches (and may fail or degrade CI performance). Addactions: write(or at leastactions: readif you intentionally only want restores) to this job’s permissions.
This issue also appears on line 112 of the same file.
permissions:
contents: read
.github/workflows/build.yml:14
- Minor: the comment
# Set all permissions to nonecan be misleading since this config specifically sets the default GITHUB_TOKEN permissions to none at the workflow level (job overrides follow). Consider rewording to make it explicit what is being limited.
# Set all permissions to none
permissions: {}
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.
This
PRadds the least privilege principle to thebuild.ymlworkflow by setting all permissions tononeat the workflow level, and then adding the permission forcontentstoreadfor the ``test´` job (#898).The OpenSSF Score should increase after this
PRhas been merged.