Skip to content

Centralise lockdown author checks#2881

Open
kerobbi wants to merge 2 commits into
mainfrom
kerobbi/lockdown-shared-enforcement
Open

Centralise lockdown author checks#2881
kerobbi wants to merge 2 commits into
mainfrom
kerobbi/lockdown-shared-enforcement

Conversation

@kerobbi

@kerobbi kerobbi commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Extracts a single shared helper for lockdown mode author checks and routes GetIssue and GetPullRequest through it, failing closed when the author can't be verified.

Why

Part of https://github.com/github/copilot-mcp-core/issues/1798

What changed

  • Added authorLockdownResult (pkg/github/lockdown.go) - one place that resolves the lockdown decision for content authored by a given login, with shared restriction messages - and routed GetIssue and GetPullRequest through it.
  • Fail closed when the author login is empty (previously an empty login skipped the check); normalised GetPullRequest's error path to a tool-result error to match GetIssue.
  • Added unit tests for the helper and a lockdown test for GetPullRequest.

MCP impact

  • Tool schema or behavior changed - no schema change; behaviour differs only under lockdown mode (empty-author content is now withheld, matching the existing per-item filters).

Prompts tested (tool changes only)

  • "Get issue X from Y" with lockdown mode enabled/disabled
  • "Get PR X from Y" with lockdown mode enabled/disabled

Security / limits

  • Data exposure, filtering, or token/size limits considered - consolidates the lockdown content filtering decision; no change outside this.

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed

Copilot AI review requested due to automatic review settings July 14, 2026 11:56
@kerobbi kerobbi requested a review from a team as a code owner July 14, 2026 11:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Centralizes lockdown author verification for issue and pull-request reads, failing closed when authors cannot be verified.

Changes:

  • Added a shared lockdown decision helper and restriction messages.
  • Routed issue and pull-request retrieval through the helper.
  • Added helper and pull-request lockdown tests.
Show a summary per file
File Description
pkg/github/lockdown.go Adds shared author lockdown logic.
pkg/github/lockdown_test.go Tests missing-cache and empty-author handling.
pkg/github/issues.go Uses the shared helper for issue reads.
pkg/github/pullrequests.go Uses the shared helper for pull-request reads.
pkg/github/pullrequests_test.go Adds lockdown allow/deny cases.

Review details

  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread pkg/github/lockdown.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants