[FLINK-34332][ci] Follow the principle of least privilege for GITHUB_TOKEN#28182
[FLINK-34332][ci] Follow the principle of least privilege for GITHUB_TOKEN#28182Kaixuan-Duan wants to merge 2 commits into
Conversation
|
can you share a link to GHA passing for this commit? |
|
Hi, @snuyanzin |
|
Hi @Kaixuan-Duan , thanks for promoting this PR and let me leave some comments followed. |
| # Required to add/remove labels on PRs via the GitHub API. | ||
| pull-requests: write | ||
| # Required for the script to manage its execution state. | ||
| actions: write |
There was a problem hiding this comment.
Need double check if community-review.sh requires action: write permission. From my understanding, only read-only PR query and issue API permissions are needed
| issues: write | ||
| # Required to add/remove labels on PRs via the GitHub API. | ||
| pull-requests: write | ||
| # Required for the script to manage its execution state. |
There was a problem hiding this comment.
Could you explain why it is necessary to manage the execution state
|
Hi @Au-Miner , thanks for the reviews! I've removed the unnecessary actions: write permission. The remaining issues: write and pull-requests: write are required for creating repository-level labels and adding/removing labels on PRs respectively. docs |
What is the purpose of the change
This pull request limits the scope of
GITHUB_TOKENpermissions in GitHub Actions workflowsand documents why each permission is needed, as requested in FLINK-34332.
Previously, several workflows used
permissions: read-all, which grants broader read accessthan necessary. This change replaces
read-allwith the more restrictivecontents: readwherever possible, and adds comments explaining the purpose of each permission.
Brief change log
permissions: read-allwithcontents: readinci.yml,nightly.yml,template.flink-ci.yml, andtemplate.pre-compile-checks.ymlpermissions: contents: readtodocs.ymlanddocs-legacy.yml(previouslyrelying on default, potentially broader permissions)
permissions: {}at workflow level innightly-trigger.yml, keepingactions: writeonly at the job level with documented reasonstale.ymland
community-review.ymlVerifying this change
This change is a trivial rework / code cleanup without any test coverage.
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation
Was generative AI tooling used to co-author this PR?