Arbitrary repository URLs enable blind SSRF through Git clone
Affected versions: confirmed on main at commit d92819a9 (the project publishes no tagged release).
Summary
_path_is_url only checks the URL scheme (http/https/ftp) and that a host is present; it does not constrain the host or resolved address. Repo.download() passes the caller-supplied repo_url straight to GitPython's clone_from, regardless of the labeled repo_type.
Details
# api/repository.py
def _path_is_url(path):
result = urlparse(path)
return result.scheme in {"http", "https", "ftp"} and bool(result.netloc)
kwargs = {"remote_url": self.repo_url, ...}
...
_clone_from_github(**kwargs) # repo_type selects the helper, not the host
A caller can label an internal HTTP endpoint as repo_type=github and have the server's own git clone connect to it.
POC
(available upon request)
Impact
Blind SSRF: the server makes an outbound git clone connection to any host/port the caller supplies, enabling internal service probing and connections to internal-only infrastructure, limited in response visibility to timing/errors and git-protocol-compatible content.
Suggested fix: resolve the host and reject private/loopback/link-local/reserved addresses before connecting. A fix is included in the linked PR.
Fix: #594