Skip to content

Lockdown mode doesn't work from GitHub Actions GITHUB_TOKEN or other S2S tokens without administration: read #2164

@dsyme

Description

@dsyme

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 hardcoded trustedBotLogins list (only copilot is trusted).
  • Bot accounts (e.g. dependabot[bot], renovate[bot]) never appear in the repository.collaborators GraphQL 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

  1. Set up the remote MCP server using a GitHub App installation token (ghs_...) or a GITHUB_TOKEN with read-all permissions targeting a public repository.
  2. Send an MCP request with the X-MCP-Lockdown: true header to call get_issue or get_issue_comments on an issue in that public repository authored by an external contributor.
  3. Observe the response: "access to issue details is restricted by lockdown mode".
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions