chore(ci): 为工作流声明最小权限 (contents: read)#96
Merged
Merged
Conversation
修复 CodeQL actions/missing-workflow-permissions 告警:ci.yml 未显式声明 GITHUB_TOKEN 权限,默认可写。构建/测试仅需读取仓库内容,故收敛为 contents: read。
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.
背景
修复仓库 CodeQL 的两处
actions/missing-workflow-permissions告警(.github/workflows/ci.yml:11、:31):工作流未显式声明permissions,GITHUB_TOKEN默认携带可写权限。改动
在
ci.yml顶层声明最小权限permissions: contents: read——构建/测试 job 仅需检出与读取仓库内容,无需写权限。影响
纯 CI 配置加固,不影响构建/测试逻辑;同时清掉本仓库剩余的两个未决 CodeQL 告警(其余 6 个已按误报/设计预期完成三态化)。