Skip to content

Revalidate git roots on each request#3614

Open
davidahmann wants to merge 1 commit intomodelcontextprotocol:mainfrom
davidahmann:codex/git-roots-runtime-invalidation
Open

Revalidate git roots on each request#3614
davidahmann wants to merge 1 commit intomodelcontextprotocol:mainfrom
davidahmann:codex/git-roots-runtime-invalidation

Conversation

@davidahmann
Copy link

Closes #3613

Problem

The git server resolves the repository allowlist once and can keep accepting paths from roots that were later removed at runtime.

What changed

  • rebuild the allowed repository list from the current runtime roots on every tool call
  • validate the requested repo path against that live allowlist before dispatching the tool
  • add regression tests for exact matches, removed roots, and empty-root handling

Validation

  • uv run --python 3.11 pytest tests/test_server.py in src/git

@davidahmann
Copy link
Author

This closes the stale-root gap in the git server, so repo paths removed from the live roots set stop being accepted on later tool calls.

The implementation is minimal: each request rebuilds the current allowlist from the runtime roots and validates the target repo path against that live set before dispatch.

Validation:

  • uv run --python 3.11 pytest tests/test_server.py (pass)

Inspired by research context: CAISI publishes independent, reproducible AI agent governance research: https://caisi.dev

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.

Enforce current roots on every git tool call

1 participant