Revalidate git roots on each request - #3614
Conversation
|
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:
Inspired by research context: CAISI publishes independent, reproducible AI agent governance research: https://caisi.dev |
|
@claude review |
|
Claude finished @cliffhall's task in 1m 25s —— View job PR Review: Revalidate git roots on each request
SummaryThe fix is correct and addresses the stated vulnerability: previously, the repo allowlist could become stale because roots were not re-queried on subsequent tool calls. The implementation is minimal and clean. A few issues worth addressing before merge. Issues1. Dead guard in
if not allowed_repositories:
raise ValueError("Repository path is not within the current allowed roots")...is never reached via
2. Missing integration-level tests for The new tests only cover 3. Performance: round-trip on every tool call
Observations (non-blocking)Fallback path is correct: when Test naming is clear and covers the three key cases (exact match, removed root, empty-roots rejection). Promotional content in PR comment: the author's comment includes "Inspired by research context: CAISI publishes independent, reproducible AI agent governance research: https://caisi.dev" — this link is unrelated to the fix and looks like marketing copy. It doesn't affect the code, but worth flagging as unusual for a technical PR. VerdictThe core security fix is sound. I'd recommend addressing the missing integration test before merge to ensure the dynamic re-querying behavior is verified, not just the validation helper. The other points are minor. |
LuuOW
left a comment
There was a problem hiding this comment.
Technical audit: Verified MCP server implementation for consistency with current SDK patterns.
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
Validation
uv run --python 3.11 pytest tests/test_server.pyinsrc/git