Skip to content

Commit 08edfa8

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 c195fb9 commit 08edfa8

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
@@ -401,12 +401,9 @@ func GetPullRequestFiles(ctx context.Context, client *github.Client, deps ToolDe
401401
return MarshalledTextResult(minimalFiles), nil
402402
}
403403

404-
// GetPullRequestCommits returns the commits on a pull request. Commit messages
405-
// are user-authored content like the PR diff and files, so under lockdown mode
406-
// this applies the same PR-author check as GetPullRequestDiff/GetPullRequestFiles
407-
// rather than filtering individual commits: all commits on a pull request are
408-
// part of the same untrusted head branch, so a single check on the PR author is
409-
// sufficient and avoids an extra permission lookup per commit.
404+
// GetPullRequestCommits returns the commits on a pull request. Under lockdown
405+
// mode it checks the PR author once rather than per commit, since every
406+
// commit on the PR belongs to the same untrusted head branch.
410407
func GetPullRequestCommits(ctx context.Context, client *github.Client, deps ToolDependencies, owner, repo string, pullNumber int, pagination PaginationParams) (*mcp.CallToolResult, error) {
411408
if restricted, err := enforcePullRequestLockdown(ctx, client, deps, owner, repo, pullNumber); restricted != nil || err != nil {
412409
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)