From patchwork Tue Apr 28 10:52:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= X-Patchwork-Id: 11514263 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A1F03112C for ; Tue, 28 Apr 2020 10:53:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 89E79206E2 for ; Tue, 28 Apr 2020 10:53:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GGUSZn1Z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726432AbgD1KxM (ORCPT ); Tue, 28 Apr 2020 06:53:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726348AbgD1KxM (ORCPT ); Tue, 28 Apr 2020 06:53:12 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EACF5C03C1A9 for ; Tue, 28 Apr 2020 03:53:11 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id 7so1021632pjo.0 for ; Tue, 28 Apr 2020 03:53:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SMnq80ir0pmXq55o9vdOaKi28e7FzsW0VG0+CIoKZMk=; b=GGUSZn1ZmcKOB3GUH0d6ObeiNpWmMI+wmn3a6N6ldEH7SJlIf4A4PSpfRdI1xpsWWX 2MPIH5grIxlYibp6IMXLw9+okI+ViLllR46aGTOKGf6I+RbAi94pAOVgSrESx4B89k8y 8g/u+sY8A0qqOIiBMR6/Nnea8U/Qu7FDAAGVrpBOeuBekUvPNVjmcrtMqadg/vbLi8Hd GhZijOb45JU5kVw7qc66899gIt0yYSlBBzryReDnx1YX75QY9ltPKuzlTyVRNaIDU/Z2 GgDTSHuWlmhrvzpJlz69UDAC5yh3Jd71itCEA3beIOK1NnhCrpFq/KFB3GrzJgCt4SWU x1cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SMnq80ir0pmXq55o9vdOaKi28e7FzsW0VG0+CIoKZMk=; b=A11MMC9diogc54BGbXfsZ8aURrMTtTJqFaUbjDZQoRxsfCppg/+tNlhQEGav9KVx2s nCkAGegMCL1FE3wXAVDQp9SKmi2ZC4bV9vXWy+asqAJ+ox0aulpzir6bFt6Ej2wuzQVV wkXFeME2zNLy0CycKgs9G3R4suyQuA16dcxm/2bGqowvaloCXEeocvyTwSr41vbPz+iY LwPowXqejl/98A/y8jWuSa2yZ3LImZC5a51B35n4qqtJQb3DIKKCvYxF55mYSB4MWzkY xYZZzJYGb3dJw5s3Ph5pe5EfPKFs0h9dHDQubLpWO4EPRT0ZK7tGN4ZjTFsJuP9gXKV3 ZTgw== X-Gm-Message-State: AGi0PuZceZ4P5EeV8WFy5Uh4PqS8GJ7gBeVzBIAekFS4LhX5ZvO3TqGr WMW193RBBZfuHNM8mmcSV3hIyKXOtsg= X-Google-Smtp-Source: APiQypJLjO9qM4zOKqJw+YKA2R8xg0Kpm8QWZNiA0S58dHofHx07+0fLFaByolixJbwT4GXwOn7eiw== X-Received: by 2002:a17:90a:498a:: with SMTP id d10mr4581518pjh.194.1588071190944; Tue, 28 Apr 2020 03:53:10 -0700 (PDT) Received: from localhost.localdomain (c-67-188-192-166.hsd1.ca.comcast.net. [67.188.192.166]) by smtp.gmail.com with ESMTPSA id e11sm12513436pfl.85.2020.04.28.03.53.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 03:53:10 -0700 (PDT) From: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= To: git@vger.kernel.org Cc: dirk@ed4u.de, sunshine@sunshineco.com, peff@peff.net, gitster@pobox.com, jrnieder@gmail.com Subject: [PATCH v4 1/4] credential-store: document the file format a bit more Date: Tue, 28 Apr 2020 03:52:51 -0700 Message-Id: <20200428105254.28658-1-carenas@gmail.com> X-Mailer: git-send-email 2.26.2.569.g1d74ac4d14 In-Reply-To: <20200428104858.28573-1-carenas@gmail.com> References: <20200428104858.28573-1-carenas@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Junio C Hamano Reading a malformed credential URL line and silently ignoring it does not mean that we promise to torelate and/or keep empty lines and "# commented" lines forever. Some people seem to take anything that is not explicitly forbidden as allowed, but the world does not work that way. Signed-off-by: Junio C Hamano Signed-off-by: Junio C Hamano --- Documentation/git-credential-store.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/git-credential-store.txt b/Documentation/git-credential-store.txt index 693dd9d9d7..76b0798856 100644 --- a/Documentation/git-credential-store.txt +++ b/Documentation/git-credential-store.txt @@ -94,6 +94,10 @@ stored on its own line as a URL like: https://user:pass@example.com ------------------------------ +No other kinds of lines (e.g. empty lines or comment lines) are +allowed in the file, even though some may be silently ignored. Do +not view or edit the file with editors. + When Git needs authentication for a particular URL context, credential-store will consider that context a pattern to match against each entry in the credentials file. If the protocol, hostname, and From patchwork Tue Apr 28 10:52:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= X-Patchwork-Id: 11514265 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C8856112C for ; Tue, 28 Apr 2020 10:53:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1A682072A for ; Tue, 28 Apr 2020 10:53:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cbrKIj4N" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726454AbgD1KxO (ORCPT ); Tue, 28 Apr 2020 06:53:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726348AbgD1KxO (ORCPT ); Tue, 28 Apr 2020 06:53:14 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44F0FC03C1A9 for ; Tue, 28 Apr 2020 03:53:14 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id hi11so983689pjb.3 for ; Tue, 28 Apr 2020 03:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HfxT5LCtKtXerLxR9EJu7IhmeEMoXx77a1PYqO3Kt1k=; b=cbrKIj4NfVtKoAJrWaawPhZifVYy3q5u9XWsi1RjOTN4XBuiL2JZKThNwRPS2ulGeA Xn1aw7jwsH7sPiDsCNbqUpaaaT0tp8ZJ/Ns4wXoMd9TF7IA/CBxAuTR9EpszBsnwJex/ r9GygTc11N5rwjtrZQ4c9hMePAkhD1/gdewViINjCHias4tZFp6PPkweNNwv4Pw9vxlE 2VgSK3CsDL6lK9jUTRxC7ES/w6J4TWVY8qlzQy4FZ4EgmY0ZsVCT/M6xx1vD9edLbjCc omkqYVsGp55S6QhsMYSLZYBO0bG/eZMX0lu8OiYuzkLfU7nUOJGz33VfTPEvVTSWWprH hSPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HfxT5LCtKtXerLxR9EJu7IhmeEMoXx77a1PYqO3Kt1k=; b=sNCZTV+MOG07AKVnY0R77Ts+L0IfkrUbKrvgKv1/VZ0lIsJj3GoxVgquIIOIQDeV/U YSRpm5VMlmeLK9e7HulUwwpeh3PJCPDH1K/uDI7yv3YP5Un3oE0fEN9DJcbOQxlDbKZg CvTdYKxtNUGzix8fsD75S8SBzbMxRwwVg3KcO+v7prOWBNFZQZfAds5TgY5I/MjlrVW1 62lvCZRuKK9uoAcCjupD8mO96/hVEpa9tEkpdtPriSfm5L1D9vUXfqs0yaDKV8KCs2L2 gnW5TbC5Drt4/ng9fcvNbsS7hIsp9Ip6FAZUqqTpBC7w4eLejowXpznegNqoorgnTpHx djIA== X-Gm-Message-State: AGi0Pubwruj7BpebUlQWyOJFIV6/NoyNGqq94/A0h5wlN/C6A+QQqmHy lt77gJv3Jd++98UOjwgAPNj2cAG+a8M= X-Google-Smtp-Source: APiQypKl5koCknORgcKJWnAg7gm7vBiod28ykZUyKWoW4gT06DH3VZz7HSnJ4+s6B3HuNGFrZNwpyw== X-Received: by 2002:a17:90a:4fc5:: with SMTP id q63mr4196121pjh.70.1588071193505; Tue, 28 Apr 2020 03:53:13 -0700 (PDT) Received: from localhost.localdomain (c-67-188-192-166.hsd1.ca.comcast.net. [67.188.192.166]) by smtp.gmail.com with ESMTPSA id e11sm12513436pfl.85.2020.04.28.03.53.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 03:53:13 -0700 (PDT) From: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= To: git@vger.kernel.org Cc: dirk@ed4u.de, sunshine@sunshineco.com, peff@peff.net, gitster@pobox.com, jrnieder@gmail.com, =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= Subject: [PATCH v4 2/4] git-credential-store: skip empty lines and comments from store Date: Tue, 28 Apr 2020 03:52:52 -0700 Message-Id: <20200428105254.28658-2-carenas@gmail.com> X-Mailer: git-send-email 2.26.2.569.g1d74ac4d14 In-Reply-To: <20200428105254.28658-1-carenas@gmail.com> References: <20200428104858.28573-1-carenas@gmail.com> <20200428105254.28658-1-carenas@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org with the added checks for invalid URLs in credentials, any locally modified store files which might have empty lines or even comments were reported[1] failing to parse as valid credentials. add corresponding failing cases [1] https://stackoverflow.com/a/61420852/5005936 Reported-by: Dirk Helped-by: Eric Sunshine Signed-off-by: Carlo Marcelo Arenas Belón --- t/t0302-credential-store.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/t/t0302-credential-store.sh b/t/t0302-credential-store.sh index d6b54e8c65..94cdcb9e56 100755 --- a/t/t0302-credential-store.sh +++ b/t/t0302-credential-store.sh @@ -120,4 +120,19 @@ test_expect_success 'erase: erase matching credentials from both xdg and home fi test_must_be_empty "$HOME/.config/git/credentials" ' +test_expect_failure 'get: store file can contain empty/bogus lines' ' + test_write_lines "#comment" " " "" \ + https://user:pass@example.com >"$HOME/.git-credentials" && + check fill store <<-\EOF + protocol=https + host=example.com + -- + protocol=https + host=example.com + username=user + password=pass + -- + EOF +' + test_done From patchwork Tue Apr 28 10:52:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= X-Patchwork-Id: 11514267 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3D3D813B2 for ; Tue, 28 Apr 2020 10:53:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 249D3206E2 for ; Tue, 28 Apr 2020 10:53:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k0eAz3My" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726489AbgD1KxS (ORCPT ); Tue, 28 Apr 2020 06:53:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726481AbgD1KxQ (ORCPT ); Tue, 28 Apr 2020 06:53:16 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAD2DC03C1A9 for ; Tue, 28 Apr 2020 03:53:16 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id n11so2031492pgl.9 for ; Tue, 28 Apr 2020 03:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vbZPo6+Z6Jy5bqNmnxr4gauO3cCT1QRZ2xCgTc+iCpI=; b=k0eAz3My/33APph0Meq5E04q0ymIuHo+EKi2znbf3tjPgIY56as086WU8gx/TJrTEw 2l2nyp5eEE8zFRsggqu8/eGF3HjIEqQS0Y0WbzVV3rSXW7KvYXzVIIMl9tzA0t7hJ5Bg d5Gmp/Imei6VRCBgGUqH6x9qWCOV5q6NUAFkW99IH+svF3RBEbie4T+n93nWoqweNqVh HOBoWXSat6WC4dc21xFLnBMwRwRhVooEMUxHt/y7/s2JC9j3zovEF5W1nmDGj0pP2ESN Hkk42StwsAKwDVD2T9JrJX2QTwX7vIYa3CfoceLcZngCMTi2D+5IuRs+zUYNsEwA7TnU QeDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vbZPo6+Z6Jy5bqNmnxr4gauO3cCT1QRZ2xCgTc+iCpI=; b=rxwCBx9WxDxuTW+DiKPAoMjZKPKBsRn01WPtTCjTHiFJ4tv5Txk5bNBpwo2zwR2fOd CfwZVugVrcEUK5uoIaY2+xaxf6iyJy1zzJ8nC3PD4nZwEf+5FGm82h66fShjTYnAKmzN Ue4R/WAcsZQpEQhlkcAJIoTP4R5sxgsaM0PXTykxb3wtIP7Ws7fOiNjeMGDg4bQeOgXA dY/ZBg9QHMhxBQCL+iFw3EQPdPRBjSyscQowLSBCj34pUC44RYkclU0SYfkuu6bd/A2O gO1RMwj2de2UgHxKosWzgmlltOc6C2Cch6izF02QkJqDsd5cxA4ndBA4ehkIqaOSN3tK pZGQ== X-Gm-Message-State: AGi0PuZPPVWAC4eTA+OhGDUzzqo0jZitflHKqed/gAyWDvcd37G8mtzY vjSFX08BJpDRC9k4XqenaR3QmUTaS8A= X-Google-Smtp-Source: APiQypKAKQqiN7nOPlknhhLmlotoiqGDMSO+cxJNTjWQIKu/HVx9tSGzMX8p136mjR/MCTlHfZAm0g== X-Received: by 2002:a62:6dc3:: with SMTP id i186mr27485784pfc.273.1588071196202; Tue, 28 Apr 2020 03:53:16 -0700 (PDT) Received: from localhost.localdomain (c-67-188-192-166.hsd1.ca.comcast.net. [67.188.192.166]) by smtp.gmail.com with ESMTPSA id e11sm12513436pfl.85.2020.04.28.03.53.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 03:53:15 -0700 (PDT) From: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= To: git@vger.kernel.org Cc: dirk@ed4u.de, sunshine@sunshineco.com, peff@peff.net, gitster@pobox.com, jrnieder@gmail.com, Carlo Marcelo Arenas Belon Subject: [PATCH v4 3/4] git-credential-store: fix (WIP) Date: Tue, 28 Apr 2020 03:52:53 -0700 Message-Id: <20200428105254.28658-3-carenas@gmail.com> X-Mailer: git-send-email 2.26.2.569.g1d74ac4d14 In-Reply-To: <20200428105254.28658-1-carenas@gmail.com> References: <20200428104858.28573-1-carenas@gmail.com> <20200428105254.28658-1-carenas@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jonathan Nieder Helped-by: Carlo Marcelo Arenas Belon --- credential-store.c | 4 ++-- t/t0302-credential-store.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/credential-store.c b/credential-store.c index c010497cb2..294e771681 100644 --- a/credential-store.c +++ b/credential-store.c @@ -24,8 +24,8 @@ static int parse_credential_file(const char *fn, } while (strbuf_getline_lf(&line, fh) != EOF) { - credential_from_url(&entry, line.buf); - if (entry.username && entry.password && + if (!credential_from_url_gently(&entry, line.buf, 1) && + entry.username && entry.password && credential_match(c, &entry)) { found_credential = 1; if (match_cb) { diff --git a/t/t0302-credential-store.sh b/t/t0302-credential-store.sh index 94cdcb9e56..4e5a73cb99 100755 --- a/t/t0302-credential-store.sh +++ b/t/t0302-credential-store.sh @@ -120,7 +120,7 @@ test_expect_success 'erase: erase matching credentials from both xdg and home fi test_must_be_empty "$HOME/.config/git/credentials" ' -test_expect_failure 'get: store file can contain empty/bogus lines' ' +test_expect_success 'get: store file can contain empty/bogus lines' ' test_write_lines "#comment" " " "" \ https://user:pass@example.com >"$HOME/.git-credentials" && check fill store <<-\EOF From patchwork Tue Apr 28 10:52:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= X-Patchwork-Id: 11514269 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D515213B2 for ; Tue, 28 Apr 2020 10:53:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BAE6A206D6 for ; Tue, 28 Apr 2020 10:53:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RiIII3AU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726499AbgD1KxW (ORCPT ); Tue, 28 Apr 2020 06:53:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726481AbgD1KxT (ORCPT ); Tue, 28 Apr 2020 06:53:19 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06693C03C1A9 for ; Tue, 28 Apr 2020 03:53:19 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id f8so8230357plt.2 for ; Tue, 28 Apr 2020 03:53:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OfTLxPUjVx3SGdliiAClev868/pywPFGiDsywRIhhbs=; b=RiIII3AU71DzvktiskBzH7oj9uMjgCSdXkxwaXky0jPxK/92XITgbcEljgw+Fy+HrB wqXwHMooD/EKnuPijtUiVNLPaozckEEB5rtZQmRFxrrwPtxsxMm9Zx24I2CwDRRfOtF8 z4s+/7eut8PcJcgA+diOko9jgvRJh+mE2p/f6QzALpLaQRffVeHErKCmYMxEnWhFYqxB g3RL3q0nLCEbpZQhHkqXP4jPgVHUatgDYqjc07hzor6KNSW+Pz5EmzvG3QXVSzPJRXuq 27LNEXrAWkE4IeB8viA519+VGQOs/VgLgsUqGKDE8pLcIoJ9Hjbdfl7dBpMPBrJ9LV7j VxIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OfTLxPUjVx3SGdliiAClev868/pywPFGiDsywRIhhbs=; b=DsGkSieL6v/WzEpr3HUNeuhZ17nOR3W9lAKm4KXxFID6XAERUx7DTqcYCv5cYjIdEU tp55lHtiXaiOX7TGmurQuQgR5Q9g20zxZGn/VqHAgBk449BNdExY8gQzW9hwcDYo2glX e/nGfMo0qNFSXONuaPjqQW/EBkPcJNO/nUus8+QNVQn8MvBIuCUaiM2/UQjjIoPVqVcY zNqaKuh0ClfVssMl2Ijzj93PuUxve4LdqQ6NuI/Wrfa0EMgHjmbSToEPuyZ9Wjr9oLE+ E1o1eZmHabOA9OjJapRyJQEC+EjyqslHtE64100je76tbOC8BYCa0YCw3qyYpm/UXvuQ sPhA== X-Gm-Message-State: AGi0PuYzl72ZHBY24gwEP+OHxz155pHIFEEKQJsTO7WjlAPpanh1cacs elnMMud9KjxEWwEKPZIgxOJlce3tsHo= X-Google-Smtp-Source: APiQypKX2XOfABL+KuvgpsnG1Ys2GEKD5R6XqrbpVYBECVY+B102Dhqfea/wQw/EVsxEu1V4aLqfMg== X-Received: by 2002:a17:902:9697:: with SMTP id n23mr1193743plp.150.1588071198318; Tue, 28 Apr 2020 03:53:18 -0700 (PDT) Received: from localhost.localdomain (c-67-188-192-166.hsd1.ca.comcast.net. [67.188.192.166]) by smtp.gmail.com with ESMTPSA id e11sm12513436pfl.85.2020.04.28.03.53.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 03:53:17 -0700 (PDT) From: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= To: git@vger.kernel.org Cc: dirk@ed4u.de, sunshine@sunshineco.com, peff@peff.net, gitster@pobox.com, jrnieder@gmail.com, =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= Subject: [PATCH v4 4/4] credential-store: make sure there is no regression with missing scheme Date: Tue, 28 Apr 2020 03:52:54 -0700 Message-Id: <20200428105254.28658-4-carenas@gmail.com> X-Mailer: git-send-email 2.26.2.569.g1d74ac4d14 In-Reply-To: <20200428105254.28658-1-carenas@gmail.com> References: <20200428104858.28573-1-carenas@gmail.com> <20200428105254.28658-1-carenas@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org c44088ecc4 (credential: treat URL without scheme as invalid, 2020-04-18) made scheme (AKA protocol) mandatory so make sure that still fails. Suggested-by: Jeff King Signed-off-by: Carlo Marcelo Arenas Belón --- t/t0302-credential-store.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/t/t0302-credential-store.sh b/t/t0302-credential-store.sh index 4e5a73cb99..7c7a48303f 100755 --- a/t/t0302-credential-store.sh +++ b/t/t0302-credential-store.sh @@ -135,4 +135,21 @@ test_expect_success 'get: store file can contain empty/bogus lines' ' EOF ' +test_expect_success 'get: ignore credentials without scheme' ' + echo "://user:pass@example.com" >"$HOME/.git-credentials" && + check fill store <<-\EOF + protocol=https + host=example.com + -- + protocol=https + host=example.com + username=askpass-username + password=askpass-password + -- + askpass: Username for '\''https://example.com'\'': + askpass: Password for '\''https://askpass-username@example.com'\'': + -- + EOF +' + test_done