From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 90A9D1F9E0 for ; Wed, 22 Apr 2020 22:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726006AbgDVWNg (ORCPT ); Wed, 22 Apr 2020 18:13:36 -0400 Received: from cloud.peff.net ([104.130.231.41]:36658 "HELO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1725839AbgDVWNg (ORCPT ); Wed, 22 Apr 2020 18:13:36 -0400 Received: (qmail 11825 invoked by uid 109); 22 Apr 2020 22:13:36 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with SMTP; Wed, 22 Apr 2020 22:13:36 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 3284 invoked by uid 111); 22 Apr 2020 22:24:42 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Wed, 22 Apr 2020 18:24:42 -0400 Authentication-Results: peff.net; auth=none Date: Wed, 22 Apr 2020 18:13:34 -0400 From: Jeff King To: Johannes Schindelin via GitGitGadget Cc: git@vger.kernel.org, "brian m. carlson" , Jonathan Nieder , Ilya Tretyakov , Johannes Schindelin Subject: Re: [PATCH 0/3] credential: handle partial URLs in config settings again Message-ID: <20200422221334.GA571740@coredump.intra.peff.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Wed, Apr 22, 2020 at 08:51:02PM +0000, Johannes Schindelin via GitGitGadget wrote: > This fixes the problem illustrated by Peff's example > [https://lore.kernel.org/git/20200422040644.GC3559880@coredump.intra.peff.net/] > , in maint-2.17: > > $ echo url=https://example.com | > git -c credential.example.com.username=foo credential fill > warning: url has no scheme: example.com > fatal: credential url cannot be parsed: example.com > > The fix is necessarily different than what was proposed by brian > [https://lore.kernel.org/git/20200422012344.2051103-1-sandals@crustytoothpaste.net/] > because that fix targets v2.26.x which has 46fd7b390034 (credential: allow > wildcard patterns when matching config, 2020-02-20). > > This patch series targets maint-2.17 instead (and might actually not be able > to fix maint due to that wildcard pattern patch; I haven't had the time to > check yet). Yes, this will remove the die() in all versions, but in v2.26.0 and up, that config would be silently ignored (and your new test will fail). > Please note that Git v2.17.4 will not do what we would expect here: if any > host name (without protocol) is specified, e.g. -c > credential.golli.wog.username = boo, it will actually ignore the host name. > That is, this will populate the username: > > $ echo url=https://example.com | > git -c credential.totally.bog.us.username=foo credential fill That seems scary. What if it is not .username, but: [credential "example.com"] username = foo helper = "!echo password=bar" ? (Or you can imagine a helper that is pulling from a read-only store, like "pass"). That would send the credential to the wrong host. I think any fix we do here needs to make sure we are not any reintroducing wrong-host problems (though I do admit that the usage like my example above is probably way less common than vanilla helpers that do the host-selection themselves). -Peff