Skip to content

Commit 6250772

Browse files
committed
fix(mcp): update git mcp server implementation
1 parent 26aee58 commit 6250772

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • mcp/servers/git-mcp-server/src/mcp_server_git

mcp/servers/git-mcp-server/src/mcp_server_git/server.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,19 @@ def git_add(repo: git.Repo, files: list[str]) -> str:
393393
if not file_path.startswith(repo_path):
394394
raise ValueError(f"Invalid file path: {file}")
395395

396+
# Check for company-notes patterns (security: prevent accidental leaks)
397+
import fnmatch
398+
blocked_patterns = []
399+
for file in files:
400+
# Normalize path separators
401+
normalized_file = file.replace('\\', '/')
402+
# Check if file matches *-notes/* pattern (e.g., company-notes/, flywire-notes/, etc.)
403+
if fnmatch.fnmatch(normalized_file, "*-notes/*") or fnmatch.fnmatch(normalized_file, "*-notes"):
404+
blocked_patterns.append(file)
405+
406+
if blocked_patterns:
407+
raise ValueError(f"Cannot add *-notes/ files (no-leaks principle): {', '.join(blocked_patterns)}")
408+
396409
# Find missing files using list comprehension
397410
missing_files = [
398411
file for file in files

0 commit comments

Comments
 (0)