The root cause of the vulnerability was the improper validation of a user-provided URL in the ProjectScanner.scan_remote function. The code used a blind string replacement (url.replace("github", "raw.githubusercontent")) to create the URL for fetching remote files. This did not account for crafted URLs that could manipulate the host part of the URL, leading to an SSRF vulnerability. An attacker could trick the application into sending sensitive credentials (GH_TOKEN) to an attacker-controlled server. The patch resolves this by introducing a dedicated function, _build_raw_github_url, which properly parses the URL using urllib.parse, validates that the hostname is github.com, and rejects URLs containing userinfo or explicit ports before constructing the final URL. The primary vulnerable function is ProjectScanner.scan_remote as it contained the logic that processed the malicious input and constructed the unsafe request.