ci: grant contents:read to PR labeler so domain labels apply#35
Open
bryanbeverly wants to merge 1 commit into
Open
ci: grant contents:read to PR labeler so domain labels apply#35bryanbeverly wants to merge 1 commit into
bryanbeverly wants to merge 1 commit into
Conversation
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.
Summary
Add
contents: readto the PR labeler caller workflow'spermissionsblock.When a workflow declares a
permissions:block, every scope not listed defaults tonone. This caller declared onlypull-requests: write, socontentswasnone. The labeler's domain-labeling step reads CODEOWNERS via the GitHub Contents API usingGITHUB_TOKEN; withcontents: nonethat read is denied and the script logs "No CODEOWNERS found; skipping domain labeling." As a result thedomain/*labels added org-wide in trufflesecurity/.github#13 were never applied. Grantingcontents: readrestores CODEOWNERS access; no other scope is required.Review guidance
.github/workflows/pr-labeler.ymlTesting
A labeler dry-run backfill on thog logged "No CODEOWNERS found; skipping domain labeling" under the current permissions, despite a valid CODEOWNERS file.
contents: readis the documented scope for the Contents API read the labeler performs. After merge,gh workflow run pr-labeler.yml -f pr_number=all -f dry_run=truewill show planneddomain/*labels.Deployment notes
Takes effect on the next labeler run (event-driven, or a workflow_dispatch backfill). No application/runtime impact.
Note
Low Risk
Single workflow permission scope change with no application or runtime impact; least privilege is preserved aside from the required Contents API read.
Overview
The PR labeler workflow now grants
contents: readalongsidepull-requests: write.Because an explicit
permissionsblock leaves unlisted scopes atnone, the labeler could not read CODEOWNERS via the Contents API and skipped domain labeling. This restores that read so org-widedomain/*labels can be applied again.Reviewed by Cursor Bugbot for commit e0f6721. Bugbot is set up for automated code reviews on this repo. Configure here.