git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH 1/1] curl: anonymize URLs in error messages and warnings
Date: Tue, 5 Mar 2019 00:11:27 -0500	[thread overview]
Message-ID: <20190305051126.GL19800@sigill.intra.peff.net> (raw)
In-Reply-To: <ab6f4032cb8cbbe77dbfad4660c30acd7ba688bb.1551713624.git.gitgitgadget@gmail.com>

On Mon, Mar 04, 2019 at 07:33:46AM -0800, Johannes Schindelin via GitGitGadget wrote:

> 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.

> @@ -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.

> @@ -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).

> -	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

  reply	other threads:[~2019-03-05  5:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04 15:33 [PATCH 0/1] Anonymize URLs in error messages and warnings of git-remote-curl Johannes Schindelin via GitGitGadget
2019-03-04 15:33 ` [PATCH 1/1] curl: anonymize URLs in error messages and warnings Johannes Schindelin via GitGitGadget
2019-03-05  5:11   ` Jeff King [this message]
2019-03-05 22:55     ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190305051126.GL19800@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).