Skip to content

[GHSA-9vjp-x34c-xg6v follow-up] - git: repeat the --repository confinement check after a tool writes the working tree #5599

Open

Description

@cliffhall

Follow-up to the fix for GHSA-9vjp-x34c-xg6v, which is published and fixed in v2.5.0.

Problem

Under --repository, the git server checks the directories git will use (working tree, git directory, common directory) once per tool call, when it opens the repository. A tool call that rewrites the working tree partway through (merge, checkout, merge abort, autostash apply) can change the repository's effective configuration for the rest of that call; the fix for this advisory re-applies the configuration hardening after each such write, but does not re-run the confinement check. Configuration that changes where git operates (for example core.worktree) could therefore differ from what was validated for the remaining git commands in that call.

Options

  1. Re-run validate_opened_repo after each tree-writing command (inside the same helper that re-hardens), refusing to continue if the repository no longer validates.
  2. Pin the location keys (e.g. core.worktree) at command scope to the values validated at open, so later configuration cannot move them.

Acceptance criteria

  • After any tree-writing command in a tool call, no later git command in that call operates outside the allowed repository.
  • A regression test covers a configuration change made by a tree write during a single call.
  • Behavior for ordinary repositories is unchanged.

Activity

  1. added
    bugSomething isn't working
    server-gitReference implementation for the Git MCP server - src/git
    on Nov 18, 2026
  2. changed the title [-][GHSA-9vjp-x34c-xg6v follow-up][/-] [+][GHSA-9vjp-x34c-xg6v follow-up] - git: repeat the --repository confinement check after a tool writes the working tree[/+] on Nov 18, 2026
  3. added this to the v2.6.0 milestone on Nov 18, 2026
  4. self-assigned this
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingserver-gitReference implementation for the Git MCP server - src/gitv2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions