ci(FixPR): add explicit least-privilege permissions block#13402
Merged
Conversation
FixPR.yml had no permissions block, so GITHUB_TOKEN got the repo default. It commits Cargo.lock back to main, so scope it to contents: write only. Mirrors the hardening accepted in uutils#12655.
Contributor
|
there was still massive supply chain security prs, i open importantly #13286, but step by step security |
|
GNU testsuite comparison: |
Contributor
|
Thanks for your PR! |
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.
What this does
FixPR.ymlis the only workflow of the 21 in.github/workflows/with nopermissions:block, so itsGITHUB_TOKENgets the repository's default scopes. This adds an explicit least-privilege block.Why
contents: write(not read)The workflow runs on
pull_request: [closed]whenmerged == trueand its final step (EndBug/add-and-commit@v10) commitsCargo.lockback tomainusingGITHUB_TOKEN. So it genuinely needscontents: write— but nothing else. Making that explicit drops the other default token scopes (packages, actions, etc.) while keeping the auto-commit working.This mirrors the hardening you already accepted in #12655 (adding an explicit permissions block to a workflow that CodeQL flagged).
Verification
Single-block addition, no behavior change.
Disclosure: I used an AI tool to help spot this and prepare the change; I verified it against the workflow and the #12655 precedent myself and take responsibility for it.