From: Junio C Hamano Date: Fri, 10 Jan 2025 21:32:44 GMT Subject: Re: transfer.credentialsInUrl should warn about personal access tokens in user field #leftoverbits Message-ID: In-Reply-To: <20250110210500.675629-1-mirth.hickford@gmail.com> M Hickford writes: > It would be neat to warn similarly if the user includes a personal access token in the *user* field of the remote URL: > > git clone https://@github.com/... > > This is a popular practice according to StackOverflow > https://stackoverflow.com/a/70320541/284795 (800k views). > > GitHub personal access tokens are easily recognised by their > prefixes "ghp_" and "github_pat_" Curious. I do not think we have *any* code to special case such a "token", so to Git itself, https://@github.com/... should look as it (assuming does not have any colon in it) is trying to access the site with as the username. How do we _know_ that this request with do not need a password? I ask because I'd prefer not to see us hardcoding any hosting-site specific heuristics in the code, and these users apparently are doing fine without any such hardcoding. If we can reuse the mechanism that is letting them do so when deciding if we should warn, it would be great. Are users expected to configure their credential helpers know that it is a (perhaps with authtype=Bearer)? Sorry for not giving any answer and piling more questions on top.