diff --git a/sentinelops-backend/app/services/local_git_service.py b/sentinelops-backend/app/services/local_git_service.py index 9499ba8..6c9a40e 100644 --- a/sentinelops-backend/app/services/local_git_service.py +++ b/sentinelops-backend/app/services/local_git_service.py @@ -136,13 +136,9 @@ def _validate_repo_path_for_linking(self, repo_path: str) -> str: return "" if not os.path.isdir(normalized): return "" - git_dir = os.path.realpath(os.path.join(normalized, ".git")) - try: - if os.path.commonpath([git_dir, normalized]) != normalized: - return "" - except ValueError: - return "" - if not os.path.isdir(git_dir): + git_dir = os.path.join(normalized, ".git") + # Require a real .git directory inside the repository path and reject symlinks. + if not os.path.isdir(git_dir) or os.path.islink(git_dir): return "" return normalized