Repository navigation
Drop unnecessary pull-requests: write scope from the Maven CI job - #187
AndreasIgel merged 5 commits into
Conversation
The build job's steps never use GITHUB_TOKEN to write to PRs (SonarCloud and Codecov decorate PRs via their own GitHub Apps), so pull-requests: write is unneeded. Reduce to least privilege: contents: read + checks: write. Refs java-helpers#165 Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Please check the description of the commit and the pullrequest, which introduced this permission. I guess this has been done on purpose because something did not work without! |
Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
|
I checked the origin of On current |
| # Least privilege: the build job only reads the repo and writes check | ||
| # output. No step uses the workflow token to write to pull requests, and | ||
| # SonarCloud/Codecov PR decoration is done server-side using tokens | ||
| # configured in their project settings (not the workflow GITHUB_TOKEN). | ||
| # This permission predates those integrations and is unused, so drop it. |
There was a problem hiding this comment.
Comment for a removed permission should be removed. There should be only a comment about the still demanded permissions here and there background.
Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
|
Addressed. The code comment now only documents the retained permissions and their rationale ( |
Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
Summary
Applies least-privilege to the
buildjob'sGITHUB_TOKEN.Fixes #165
The
buildjob grantedpull-requests: write, but no step uses the workflow token to write to PRs — SonarCloud and Codecov PR decoration/comments are done by their GitHub Apps with their own tokens. Removed the scope:This limits blast radius if a build step or third-party action is compromised.
pull-requests: writeremains where it is genuinely needed (thedependency-reviewworkflow's PR summary comment).Validation
actionlintpasses.Red
build/dependency-reviewchecks on the fork are the missingSONAR_TOKEN/CODECOV_TOKENand disabled Dependency graph (unrelated to permission scope).