Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions pkg/github/pullrequests.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,9 @@ func GetPullRequestFiles(ctx context.Context, client *github.Client, deps ToolDe
return MarshalledTextResult(minimalFiles), nil
}

// GetPullRequestCommits returns the commits on a pull request. Commit messages
// are user-authored content like the PR diff and files, so under lockdown mode
// this applies the same PR-author check as GetPullRequestDiff/GetPullRequestFiles
// rather than filtering individual commits: all commits on a pull request are
// part of the same untrusted head branch, so a single check on the PR author is
// sufficient and avoids an extra permission lookup per commit.
// GetPullRequestCommits returns the commits on a pull request. Under lockdown
// mode it checks the PR author once rather than per commit, since every
// commit on the PR belongs to the same untrusted head branch.
func GetPullRequestCommits(ctx context.Context, client *github.Client, deps ToolDependencies, owner, repo string, pullNumber int, pagination PaginationParams) (*mcp.CallToolResult, error) {
if restricted, err := enforcePullRequestLockdown(ctx, client, deps, owner, repo, pullNumber); restricted != nil || err != nil {
return restricted, err
Expand Down
3 changes: 0 additions & 3 deletions pkg/github/pullrequests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1539,9 +1539,6 @@ func Test_GetPullRequestCommits(t *testing.T) {
expectedCommits: mockCommits,
},
{
// Trusted bot logins (e.g. github-actions[bot], copilot) are treated as
// safe content sources regardless of push access, matching the
// intentional exception documented for lockdown mode.
name: "lockdown enabled - trusted bot author lacks push access",
mockedClient: MockHTTPClientWithHandlers(map[string]http.HandlerFunc{
GetReposPullsByOwnerByRepoByPullNumber: mockResponse(t, http.StatusOK, &github.PullRequest{
Expand Down
Loading