-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(ci): let the PR labeler actually write labels #566
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 |
|---|---|---|
|
|
@@ -17,8 +17,14 @@ concurrency: | |
|
|
||
| permissions: | ||
| contents: read | ||
| # pulls.get only needs read; label mutations use the issues API. | ||
| pull-requests: read | ||
| # pulls.get only needs read, but the issues label endpoints are shared with | ||
| # pull requests: adding or removing a label on a PR number is rejected with | ||
| # "Resource not accessible by integration" unless the token also carries | ||
| # pull_requests=write (the API reports `issues=write; pull_requests=write` | ||
| # in x-accepted-github-permissions). Read-only here silently worked while | ||
| # every run happened to be a no-op sync, and failed on the first PR that | ||
| # actually needed a label written. | ||
| pull-requests: write | ||
|
Comment on lines
+20
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Scope The write permission is required for the label mutations, but granting it at workflow scope gives every job and future step a token capable of modifying pull requests. Move this permission under only the job that calls Proposed fix permissions:
- pull-requests: write
jobs:
<labeler-job>:
+ permissions:
+ pull-requests: write🧰 Tools🪛 zizmor (1.26.1)[error] 27-27: overly broad permissions (excessive-permissions): pull-requests: write is overly broad at the workflow level (excessive-permissions) [warning] 27-27: permissions without explanatory comments (undocumented-permissions): needs an explanatory comment (undocumented-permissions) 🤖 Prompt for AI AgentsSources: Path instructions, Linters/SAST tools There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Changing this permission to Useful? React with 👍 / 👎. |
||
| issues: write | ||
|
|
||
| jobs: | ||
|
|
||
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.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Assert the effective top-level permissions map, not arbitrary workflow text.
The unanchored regexes search the entire YAML document, so a comment or unrelated job-level block could satisfy
pull-requests: writeandcontents: readwithout proving the labeler job receives those permissions. Conversely, an unrelatedcontents: writeoccurrence could fail the test. Parse the workflow or extract its top-levelpermissionsblock and assert the exact contract:contents: read,pull-requests: write, andissues: write, with nocontents: write.As per path instructions,
.github/**is a security boundary and workflow permission changes require explicit security review.🤖 Prompt for AI Agents
Source: Path instructions