File tree Expand file tree Collapse file tree
mcp/servers/git-mcp-server/src/mcp_server_git Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments