-
Notifications
You must be signed in to change notification settings - Fork 0
Apply least-privilege permissions to GitHub Actions workflow #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,7 +23,7 @@ concurrency: | |||||||
| cancel-in-progress: true | ||||||||
|
|
||||||||
| permissions: | ||||||||
| contents: write | ||||||||
| contents: read | ||||||||
|
|
||||||||
| jobs: | ||||||||
| # 1. 测试任务 | ||||||||
|
|
@@ -100,6 +100,8 @@ jobs: | |||||||
| needs: build | ||||||||
| if: startsWith(github.ref, 'refs/tags/v') | ||||||||
| runs-on: ubuntu-latest | ||||||||
| permissions: | ||||||||
| contents: write | ||||||||
|
||||||||
| contents: write | |
| contents: write | |
| actions: read |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting workflow-level
permissionsto onlycontents: readimplicitly sets all otherGITHUB_TOKENpermissions tonone. This workflow usesactions/cache@v4andactions/upload-artifact@v4/actions/download-artifact@v4, which requireactions: write(cache save/upload) and at leastactions: read(download). As-is, thetest/build/releasejobs may start failing with permission errors. Add the minimal requiredactions:permission at workflow level and/or per job (e.g., grantactions: writeto jobs that save cache/upload artifacts, andactions: readto jobs that only download).