Skip to content

Commit 4fdeadb

Browse files
refactor: condense lockdown comments in pull_request_read get_commits
Trim the GetPullRequestCommits doc comment to a single terse sentence and remove a test comment that only restated the test name. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 769340d commit 4fdeadb

2 files changed

Lines changed: 3 additions & 9 deletions

File tree

pkg/github/pullrequests.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,9 @@ func GetPullRequestFiles(ctx context.Context, client *github.Client, deps ToolDe
412412
return MarshalledTextResult(minimalFiles), nil
413413
}
414414

415-
// GetPullRequestCommits returns the commits on a pull request. Commit messages
416-
// are user-authored content like the PR diff and files, so under lockdown mode
417-
// this applies the same PR-author check as GetPullRequestDiff/GetPullRequestFiles
418-
// rather than filtering individual commits: all commits on a pull request are
419-
// part of the same untrusted head branch, so a single check on the PR author is
420-
// sufficient and avoids an extra permission lookup per commit.
415+
// GetPullRequestCommits returns the commits on a pull request. Under lockdown
416+
// mode it checks the PR author once rather than per commit, since every
417+
// commit on the PR belongs to the same untrusted head branch.
421418
func GetPullRequestCommits(ctx context.Context, client *github.Client, deps ToolDependencies, owner, repo string, pullNumber int, pagination PaginationParams) (*mcp.CallToolResult, error) {
422419
if restricted, err := enforcePullRequestLockdown(ctx, client, deps, owner, repo, pullNumber); restricted != nil || err != nil {
423420
return restricted, err

pkg/github/pullrequests_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,9 +1539,6 @@ func Test_GetPullRequestCommits(t *testing.T) {
15391539
expectedCommits: mockCommits,
15401540
},
15411541
{
1542-
// Trusted bot logins (e.g. github-actions[bot], copilot) are treated as
1543-
// safe content sources regardless of push access, matching the
1544-
// intentional exception documented for lockdown mode.
15451542
name: "lockdown enabled - trusted bot author lacks push access",
15461543
mockedClient: MockHTTPClientWithHandlers(map[string]http.HandlerFunc{
15471544
GetReposPullsByOwnerByRepoByPullNumber: mockResponse(t, http.StatusOK, &github.PullRequest{

0 commit comments

Comments
 (0)