Repository navigation
Declare least-privilege workflow token permissions - #1652
Open
Ryan Shepherd (DefaultRyan) wants to merge 2 commits into
Open
Ryan Shepherd (DefaultRyan) wants to merge 2 commits into
Ryan Shepherd (DefaultRyan) wants to merge 2 commits into
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No actionable issues were found in the reviewed workflow permission changes.
No open issues 🎉
What changed in this PR
Explicitly limits workflow token permissions to repository read access in CI Tests and Check Line Endings.
Changes:
- Adds workflow-level
permissions: contents: readto both workflows. - Leaves triggers, jobs, and steps unchanged.
| File | Description |
|---|---|
.github/workflows/ci.yml |
Sets explicit read-only repository permissions for CI jobs. |
.github/workflows/check-line-endings.yml |
Sets explicit read-only repository permissions for line-ending checks. |
Review effort: Balanced
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's this all about?
Declare workflow-level
permissions: contents: readin both CI Tests and Check Line Endings. All seven jobs inherit the explicit read-only token permissions, addressing the sevenactions/missing-workflow-permissionsalerts without granting unnecessary write access.Checkout requires repository read access; the existing artifact uploads and same-run downloads do not require additional
GITHUB_TOKENpermissions. Triggers, jobs, and steps are unchanged.Validation:
git diff --checkpassed. A Python standard-library comparison against HEAD passed for both workflows, confirming that the permissions block is the only change, there are no job-level overrides, and LF line endings are preserved. Full workflow execution was not run locally. YAML parser validation was unavailable because PyYAML is not installed and installing it was denied.Fixes: code-scanning alerts 1-7. No associated issue.