Skip to content
Merged
Prev Previous commit
Next Next commit
Use repo scope for star/unstar tools instead of public_repo
public_repo is implicit - the GitHub API handles the distinction between
public and private repos. Using repo as the required scope is more
consistent with our enforcement model:
- PATs: tools visible if token has repo scope
- OAuth: scope challenge requests repo scope
  • Loading branch information
SamMorrowDrums committed Jan 5, 2026
commit eb57a9d8d24c496e68e3c5ec95f354dc5f38b6e3
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ The following sets of tools are available:

- **get_team_members** - Get team members
- **Required OAuth Scopes**: `read:org`
- **Accepted OAuth Scopes**: `read:org`, `admin:org`, `write:org`
- **Accepted OAuth Scopes**: `write:org`, `read:org`, `admin:org`
- `org`: Organization login (owner) that contains the team. (string, required)
- `team_slug`: Team slug (string, required)

Expand Down Expand Up @@ -946,7 +946,7 @@ The following sets of tools are available:

- **get_project** - Get project
- **Required OAuth Scopes**: `read:project`
- **Accepted OAuth Scopes**: `project`, `read:project`
- **Accepted OAuth Scopes**: `read:project`, `project`
- `owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
- `owner_type`: Owner type (string, required)
- `project_number`: The project's number (number, required)
Expand Down Expand Up @@ -1265,7 +1265,7 @@ The following sets of tools are available:

- **get_secret_scanning_alert** - Get secret scanning alert
- **Required OAuth Scopes**: `security_events`
- **Accepted OAuth Scopes**: `security_events`, `repo`
- **Accepted OAuth Scopes**: `repo`, `security_events`
- `alertNumber`: The number of the alert. (number, required)
- `owner`: The owner of the repository. (string, required)
- `repo`: The name of the repository. (string, required)
Expand Down Expand Up @@ -1337,14 +1337,12 @@ The following sets of tools are available:
- `username`: Username to list starred repositories for. Defaults to the authenticated user. (string, optional)

- **star_repository** - Star repository
- **Required OAuth Scopes**: `public_repo`
- **Accepted OAuth Scopes**: `public_repo`, `repo`
- **Required OAuth Scopes**: `repo`
- `owner`: Repository owner (string, required)
- `repo`: Repository name (string, required)

- **unstar_repository** - Unstar repository
- **Required OAuth Scopes**: `public_repo`
- **Accepted OAuth Scopes**: `public_repo`, `repo`
- **Required OAuth Scopes**: `repo`
- `owner`: Repository owner (string, required)
- `repo`: Repository name (string, required)

Expand Down
4 changes: 2 additions & 2 deletions pkg/github/repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -1995,7 +1995,7 @@ func StarRepository(t translations.TranslationHelperFunc) inventory.ServerTool {
Required: []string{"owner", "repo"},
},
},
[]scopes.Scope{scopes.PublicRepo},
[]scopes.Scope{scopes.Repo},

Copilot AI Jan 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the PR description's scope mapping, star_repository should require the public_repo scope (not repo). The mapping shows:

  • required_scopes: public_repo
  • accepted_scopes: public_repo, repo

This should use []scopes.Scope{scopes.PublicRepo} instead of []scopes.Scope{scopes.Repo}.

Suggested change
[]scopes.Scope{scopes.Repo},
[]scopes.Scope{scopes.PublicRepo},

Copilot uses AI. Check for mistakes.
func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
owner, err := RequiredParam[string](args, "owner")
if err != nil {
Expand Down Expand Up @@ -2060,7 +2060,7 @@ func UnstarRepository(t translations.TranslationHelperFunc) inventory.ServerTool
Required: []string{"owner", "repo"},
},
},
[]scopes.Scope{scopes.PublicRepo},
[]scopes.Scope{scopes.Repo},

Copilot AI Jan 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the PR description's scope mapping, unstar_repository should require the public_repo scope (not repo). The mapping shows:

  • required_scopes: public_repo
  • accepted_scopes: public_repo, repo

This should use []scopes.Scope{scopes.PublicRepo} instead of []scopes.Scope{scopes.Repo}.

Suggested change
[]scopes.Scope{scopes.Repo},
[]scopes.Scope{scopes.PublicRepo},

Copilot uses AI. Check for mistakes.
func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
owner, err := RequiredParam[string](args, "owner")
if err != nil {
Expand Down