🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #2513

Re: [PATCH v3 2/3] remote: do not show credentials when relative_url() fails

#2513
From: Derrick Stolee
Date: Fri, 06 Nov 2026 14:43
55 lines
13400 bytes
On 11/5/2026 10:28 AM, Aniket Gupta wrote:
> When relative_url() cannot resolve a URL, it names the URL in its error
> message. If the URL contains a user name and password, both end up in
> the message, and from there in terminal output and logs.
> 
> Pass the URL through transport_anonymize_url() first. Also name the
> URL that was passed in rather than what is left of it after some
> components have already been stripped off, which is what a user would
> recognize.

I'm less convinced on this factor. I understand anonymizing the URL if
we are sending it to a location that is perhaps "less trusted" (like
trace logs) but the user asked us to operate on a given URL that caused
problems, so they should know the string that caused problems.

In environments that store stdout/stderr logs, those systems already
need to be careful about such strings in the commands themselves, let
alone the output strings.

And back to the bundle-URI application: if the bundle list uses such
URIs for its child bundles, then that's not a safe mechanism for
communicating those credentials. This isn't going to protect secrets
like that from being exposed.

This is just my opinion on the necessity of this change. If we _do_
want this change, then I continued my review: the patch accomplishes
its goal.
> @@ -3078,9 +3078,12 @@ char *relative_url_gently(const char *remote_url, const char *url,
>  			url += 3;
>  			chopped = chop_last_dir(&remoteurl, is_relative);
>  			if (chopped < 0) {
> +				char *anon = transport_anonymize_url(remote_url);
> +
>  				strbuf_addf(err,
>  					    _("cannot strip one component off url '%s'"),
> -					    remoteurl);
> +					    anon);
> +				free(anon);
>  				free(remoteurl);

This code looks good, assuming taht we want to make this change.

> +test_expect_success 'relative_url() does not show credentials when it fails' '
> +	cat >expect <<-\EOF &&
> +	fatal: cannot strip one component off url '\''https://host.example/a'\''
> +	EOF
> +	test_must_fail test-tool submodule resolve-relative-url "" \
> +		"https://user:secret@host.example/a" ../../../../../../x 2>actual &&
> +	test_cmp expect actual
> +'
Thank you for including a test that demonstrates this change.

Thanks,
-Stolee
Technical Details
Message-ID: <85924f20-298f-401e-88f7-7fb3f949d0fe@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74676-linux-kernel-git=dewy.ru
References: <20261105152842.566318-1-aniketgupta3001@gmail.com> <20261105152842.566318-3-aniketgupta3001@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74676-linux-kernel-git=dewy.ru
From: stolee@gmail.com (Derrick Stolee)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v3 2/3] remote: do not show credentials when
 relative_url() fails
Date: Fri, 6 Nov 2026 09:43:50 -0500
Organization: Usenet Network
Message-ID: <85924f20-298f-401e-88f7-7fb3f949d0fe@gmail.com>
References: <20261105152842.566318-1-aniketgupta3001@gmail.com>
 <20261105152842.566318-3-aniketgupta3001@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3906170"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ZJbKGnbgxYcuwasdGMD7x0wO7Dw= sha256:8aCmWk851xhJlwQYEAFhHGbADkVm7+/i3/cLxjXz0VA=
	sha1:zJykFClHUeHPd5pGfQUuKvNO0do= sha256:/nPey2miaIrmMEcKFEq0uRJlFjUbOTAWjmVAu8ZnHoA=
Content-Language: en-US
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 056C3113288; Fri,  6 Nov 2026 17:55:19 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.949
X-Spam-Status: No, score=-1.949 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 370-tojS7EEJ;
	Fri,  6 Nov 2026 17:55:15 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-74676-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id B38AC11327D; Fri,  6 Nov 2026 17:55:04 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 73DA33E09C; Fri,  6 Nov 2026 14:45:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793976233;
	b=CQcTbI2B/gZGIrvcajK3q4LEQNE/Q8hifc//LE/OILgsogPvPhN9c6HZZrMUeH2H22u3
	 HfL6x/kw9bGAhJ1qkkSTjpY9U8TnJ0XGSHSnwmeD9zERVAEwS4LlluFOuMkT8/8Fbr1yC
	 34nTn261/8bv/Mz4CRgMtYVV0yOrxNBMotlkPUpi3kPrVzzleCd7+XXiRnZuIh5YaVeYk
	 m//ScOj1vZwumnW9rDZ2S2AMnBmo3TO9auYHOKaAUtAsedH5uPc3TFZ4Su02DhNm1/L2h
	 R9qoWJtVfUxOQ0jRZ2suH6on9TuYbEJ1yKa0yQcQIrUjhFLGmqM8zZIfysuXpTeIgrw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793976233;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:Message-ID:Date:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:User-Agent:Subject:To:Cc:References:
	 Content-Language:From:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding;
	bh=Wl+Z0fUh7rzm76vXOj6kXjgtPeVu5w4qnQhtV/8J4wY=;
	b=gpOthCo5ikA4RvlJBByjek+wMsbz1YjFgXGg4PgLfATgWTV3/VsbJeaiLlY44F7FtukY
	 IMg+9qdvvM9tC0G75CbxwWm22JrYhelDV2lazsoYN51sK3gHZe3j3fvN35CzyUUwrNReR
	 519XO5dP+TvL7o34PbSFbMMyPy4/zUKYjvYSd6XH4w7tIHJhbCOkFRe7EBHDOVU2U3bR4
	 1w7hMynye7gW13usXfXnUXR7WOkdL/hW2rkGU3O/D55YVm29z7ADPC0x/thSg3UpTx+pi
	 8TQTX+7uXpS0q8KbCcSO3T/zVHUDJYX+AT8cxIlgeuk34CBJ76NdPapa8bj5hc6doBQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=CKUuC6S5;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id BF077606A33A;
	Fri,  6 Nov 2026 14:43:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=CKUuC6S5
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.52
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793976232;
	b=aeb1HX0CWvvIt5EfKAKJbxQbERDYtMBCQMtSspAhmxk+Kw7TsxT7gBHeTStmrh00/3Vj
	 VPHdXpZRFahAwGgZ03HWwXqNhH02uFWLsVgn1htYtzDTzWA1aALWxrjk0Hk5JdaPpdQDQ
	 gVzh0InCK1DjHryZuG1wUvbSDgOcrV6SEXdgZXXKqMUHD4W5ztjJdtabbDNDZ7N7MBtlq
	 XKZ9tjGoWCcuz0zn5gECOrSMYCORaP+7/hqaNgpf6aqNIJU6pkzbxh2pjQuG52lkIKVXL
	 1qGnYo6sZNxeZ3k1As6o0gCS+jyBExdbSGWm7W4ntCEv5qrNW9ELQ+sw81Os7rdhTEA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793976232;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:
	 Content-Language:From:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding;
	bh=Wl+Z0fUh7rzm76vXOj6kXjgtPeVu5w4qnQhtV/8J4wY=;
	b=tLLBMwr4eM50qltvPsXvO+E2yNT8dXOqYZhAopyYUAKXosRZSEzQL87leQQMsZ79FWaC
	 GRf40HX+HwXTGL+ZNcxA5Eq38IVQbbZuDBsYgjk7aqyFY+rwJH/GUzuWMLS0QLa73cl35
	 GeQYxJYIUfnkhKcp0nygk6kvwqpVVDKHsf9jQ8j+t11HU4+dxJ2WHrBOZJ7gLuEwJiGlU
	 T1J1Dol4TXL6+HDrkDkn3B1W8NOah27vanvoo2RGKqfMuosg0msJQmkDgtSoQI/rka2aj
	 QtDGwjn4trUBhJ+cThViMBwABQPbn4Ziyaxr7tjqo3Q4lGGTPnyjR+7vdlcEpSCOwJw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=CKUuC6S5;
	arc=none smtp.remote-ip=209.85.219.52
X-Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8432C606A326
	for <git@vger.kernel.org>; Fri,  6 Nov 2026 14:43:52 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8432C606A326
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-91791ec1b83so5172246d6.1
        for <git@vger.kernel.org>; Fri, 06 Nov 2026 06:43:52 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793976231; x=1794581031; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=Wl+Z0fUh7rzm76vXOj6kXjgtPeVu5w4qnQhtV/8J4wY=;
        b=CKUuC6S5PJ5jA9jcmMvGpwqdDd1mx6jxBpePyk0/dfd7gSLn1x9K3VKLau0qLTRiVE
         H8YLiP+3j4ruS24Y8PgzhU0otg+J38fSpOOxDBsAOBQtIfrtbfcBurHCfkAknW45V2gk
         lpbqt5yZ3Zw/e0tB79wocKh+UjzcIMp5LUAhckwYtNUYfmnQ2TESfFeY0nSJ4SVaWtop
         aIN6gXwFSc2OSZV776EN1zhRP3YRPrbcH7R5PoZd5zTVCHdd9ePp77PmxH+0ALg5lnmb
         8olVKKJg/5222ITijoPds1kXMHQdB3DTzuVwFkNSJvl09Grw9k8xfHsLIXjO+Mf3cREd
         2BEg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793976231; x=1794581031;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=Wl+Z0fUh7rzm76vXOj6kXjgtPeVu5w4qnQhtV/8J4wY=;
        b=NPlkW0mESTPEl8g6NZQMKv71w+L0PwYrFSc/bZKylLXAeK1S/195vWR4+jdMdfw57D
         m4U+c4/VVQt9yLnPDUZ0dKK5lMoC0HQn4YXqzIR3z061G9b6CB5xh99s7Few095VwaA0
         Xgx0GzRJePG3Zl8g09L1KWq/R9wGg6BvVO6pKlSp5DeExfTkKF/5ZwfIp5PUSYqIL96T
         muFRv41A2xz2TnsFUQtFfpRC0mTf32CmtJCY/aTT5AEvfobmCfjd6UxA5iu21D8ddGu+
         sJbSL6w2zgvg8d0S6PT9W4ogp2wlCHK7ah9wq2ZV9bWPsbkzhoSmMiIbFGXpZphVMmr9
         Pu8w==
X-Forwarded-Encrypted: i=1; AKwUvByXD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SMTP id af79cd13be357-945f355a8f1mr398652885a.54.1793976231310;
        Fri, 06 Nov 2026 06:43:51 -0800 (PST)
X-Received: from [192.168.1.109] ([136.61.86.144])
        by smtp.gmail.com with ESMTPSA id af79cd13be357-945f5bb9bfesm156498685a.19.2026.11.06.06.43.50
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Fri, 06 Nov 2026 06:43:50 -0800 (PST)
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-Cc: Junio C Hamano <gitster@pobox.com>, Patrick Steinhardt <ps@pks.im>
X-In-Reply-To: <20261105152842.566318-3-aniketgupta3001@gmail.com>