git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] curl: anonymize URLs in error messages and warnings

From
Jeff King <peff@peff.net>
Date
Mar 5, 2019, 05:11 UTC
Message-ID
<20190305051126.GL19800@sigill.intra.peff.net>
In-Reply-To
<ab6f4032cb8cbbe77dbfad4660c30acd7ba688bb.1551713624.git.gitgitgadget@gmail.com>
On Mon, Mar 04, 2019 at 07:33:46AM -0800, Johannes Schindelin via GitGitGadget wrote:
Show 7 quoted lines
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> 
> Just like 47abd85ba0 (fetch: Strip usernames from url's before storing
> them, 2009-04-17) and later 882d49ca5c (push: anonymize URL in status
> output, 2016-07-13), this change anonymizes URLs (read: strips them of
> user names and especially passwords) in user-facing error messages and
> warnings.

Yeah, these all look obviously correct. I suspect most people haven't noticed them because it's pretty easy to use a real password helper these days instead of shoving it into the URL.

Show 6 quoted lines
> @@ -251,7 +252,7 @@ static struct ref *parse_info_refs(struct discovery *heads)
>  		if (data[i] == '\n') {
>  			if (mid - start != 40)
>  				die("%sinfo/refs not valid: is this a git repository?",
> -				    url.buf);
> +				    transport_anonymize_url(url.buf));

Looking at the code, I think we'd keep the trailing slash during the anonymization. Good.

Show 7 quoted lines
> @@ -442,17 +443,23 @@ static struct discovery *discover_refs(const char *service, int for_push)
>  		break;
>  	case HTTP_MISSING_TARGET:
>  		show_http_message(&type, &charset, &buffer);
> -		die("repository '%s' not found", url.buf);
> +		die("repository '%s' not found",
> +		    transport_anonymize_url(url.buf));

Sort of orthogonal to your patch, but these could probably stand to be marked for translation (I'm happy for that to come on top later, though).

Show 7 quoted lines
> -	if (options.verbosity && !starts_with(refs_url.buf, url.buf))
> -		warning(_("redirecting to %s"), url.buf);
> +	if (options.verbosity && !starts_with(refs_url.buf, url.buf)) {
> +		char *u = transport_anonymize_url(url.buf);
> +		warning(_("redirecting to %s"), u);
> +		free(u);
> +	}
Good attention to detail here.
-Peff
Previous: Johannes Schindelin via GitGitGadgetNext: Johannes Schindelin
Message 3 of 4 in “Anonymize URLs in error messages and warnings of git-remote-curl”
  1. 0/1 Anonymize URLs in error messages and warnings of git-remote-curlJohannes Schindelin via GitGitGadget, Mar 4, 2019
  2. 1/1 curl: anonymize URLs in error messages and warningsJohannes Schindelin via GitGitGadget, Mar 4, 2019
  3. Jeff KingMar 5, 2019
  4. Johannes SchindelinMar 5, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.