-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Describe the bug
When the MCP server runs in lockdown mode (triggered via the X-MCP-Lockdown HTTP header) and the authenticating token is a GitHub Actions GITHUB_TOKEN or a GitHub App server-to-server installation token (ghs_ prefix), lockdown mode incorrectly blocks all content on public repositories rather than filtering based on contributor trust.
The lockdown implementation determines whether content is safe by querying the GitHub GraphQL API for the content author's repository collaborator permission (WRITE, ADMIN, or MAINTAIN). This query requires the viewer to have admin or write access to the repository to enumerate collaborators. A GITHUB_TOKEN with read-all permissions — or any App installation token without administration: read — returns an empty collaborator list for every user queried, causing all content to be treated as unsafe and blocked.
At some level this shouldn't fail - it seems GITHUB_TOKEN has the ability to work out an arbitrary user's permission level (example in github public repo, example in githubnext public repo). These use
GET /repos/OWNER/REPO/collaborators/USER/permission
And this appears to give the necessary information, enough information for the GitHub MCP to correctly implement its "lockdown mode". It may be the GraphQL approach used is more efficient, but in practice we should fall back to an approach that works for bots as well.
Additionally:
github-actions[bot]and other GitHub App bot identities are not included in the hardcodedtrustedBotLoginslist (onlycopilotis trusted).- Bot accounts (e.g.
dependabot[bot],renovate[bot]) never appear in therepository.collaboratorsGraphQL field regardless of App installation permissions, so any content authored by bots on public repos is always blocked.
Affected version
v0.32.0
Steps to reproduce the behavior
- Set up the remote MCP server using a GitHub App installation token (
ghs_...) or aGITHUB_TOKENwithread-allpermissions targeting a public repository. - Send an MCP request with the
X-MCP-Lockdown: trueheader to callget_issueorget_issue_commentson an issue in that public repository authored by an external contributor. - Observe the response:
"access to issue details is restricted by lockdown mode". - Repeat for an issue authored by a user with push access to the repo — same error.
Expected vs actual behavior
Expected: Lockdown mode filters out content authored by untrusted external contributors (those without push access to the repository), while allowing content authored by collaborators with write/admin/maintain permissions. GitHub Actions workflows and GitHub App tokens should be able to use lockdown mode as intended.
Actual: On public repositories, lockdown mode blocks all content regardless of the author's actual permission level. The repository.collaborators GraphQL query returns an empty result when the authenticating token lacks admin/write repository access, so every author appears to have no push access and is denied. This makes lockdown mode completely unusable for the common CI/CD case of a GitHub Actions workflow token or a read-scoped App installation token.