fix(scopes): allow public_repo scope for public repository write tools - #3150
Open
CAOShurong wants to merge 1 commit into
Open
fix(scopes): allow public_repo scope for public repository write tools#3150CAOShurong wants to merge 1 commit into
CAOShurong wants to merge 1 commit into
Conversation
Several repository write tools declared the broad `repo` scope, which hid them from tokens limited to `public_repo` and forced public-only OAuth deployments to request private-repository access. Lower the required scope to public_repo for tools that only operate on repositories the token can already reach: - add_issue_comment - issue_write - create_branch - push_files - create_pull_request - fork_repository Because RequiredScopes are expanded through the scope hierarchy, a full repo token remains accepted for every tool. GitHub continues to enforce actual per-repository permissions at the API layer. Fixes github#3136
CAOShurong
force-pushed
the
codex/3136-public-repo-scope
branch
from
August 27, 2026 13:59
a65e4bb to
660bd4f
Compare
Author
|
Rebased onto current AI assistance disclosure: Codex assisted with the rebase and verification; I checked the resulting diff and results. |
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
Fixes #3136 by lowering the required OAuth scope from
repotopublic_repofor the six repository write tools the issue identifies as public-repo-safe:add_issue_commentissue_writecreate_branchpush_filescreate_pull_requestfork_repositoryAn OAuth deployment that only needs to contribute to public repositories can now request least-privilege
public_repoinstead of the broadreposcope, which also grants private-repository access.Why this is safe
repotoken satisfypublic_repo, so existing deployments retain access.main@febc3293,push_fileskeeps the newer dynamic workflow-path policy: ordinary files requirepublic_repo, while.github/workflows/*additionally challenges forworkflow.Testing
Exact head:
660bd4f1go build ./...— passgo vet ./pkg/github/ ./pkg/scopes/— passgo test ./pkg/scopes -count=1— passgo test ./pkg/github/ -count=1has the same six Windows icon-order snapshot failures on pristinemain@febc3293and this branch; the branch adds no failure.AI assistance disclosure: Codex assisted with the rebase, conflict adaptation, tests, and drafting; I verified the resulting diff and reported results and take responsibility for the contribution.