From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a1-smtp.messagingengine.com (fhigh-a1-smtp.messagingengine.com [103.168.172.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 531DC34E777 for ; Fri, 14 Aug 2026 18:56:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.152 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786733766; cv=none; b=TwweWqqWMbo6DinbXyiuatvS+6UcF6WVvX0QkTookXPgRH2HuRprRgmpGwhD6BNpzEJJvnFfdW5wojG2WZpbBp/UvpELKQFwm/Jt9FT+K+SMbeiiS0Kq+hgFak5vl7aw4CP4ZXgm7d0Rst0gwRXGAcAt9J7DViBafs3uAN9iTJQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786733766; c=relaxed/simple; bh=iFjvOurEPNmkpEgYfIO6zmbZMryPkGkQ1kAMYOp3Bu0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=MPx4LG5eluWaKKZE/e0CUx1QWvpfp5iJuRLVB1fXa1jBlRZd+fWCNDAm2OsjP3886ZVaJb4JAOMUi5WNcaecK17GZrQKjpmek99YWRSD8tRY9Z8FKz+fhYeecOXxIrw8WzixSnzs/c1FtIxd0OGZ7kPRW3Boknvj19OF1wHJevE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=qrRW2X+9; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=OQB+/6Ty; arc=none smtp.client-ip=103.168.172.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="qrRW2X+9"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="OQB+/6Ty" Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id 567C814000DF; Fri, 14 Aug 2026 14:56:03 -0400 (EDT) Received: from phl-frontend-01 ([10.202.2.160]) by phl-compute-01.internal (MEProxy); Fri, 14 Aug 2026 14:56:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1786733763; x=1786820163; bh=SYmNrSKKxc o86QZr5xVs35C+6u897SmBlwP1MNUcRM0=; b=qrRW2X+9lrrZpZFJHzNvouJ5Sw HU8YAHcWGv6cc+6rc7xc14DGVUcLRISolJd+vxZzegBixE7vEuTSNaFZNnO2ApL3 vHG9kH3xkndOB9W88fbusnoPdevDDU8bQADEO4VddthOsmhJcwg2TNAehlD9i3PK oB4i3Q0+Nm8BfglLZCHVLzE0YptjWp1OFE7tk/xikFh7fw1aU6yVhKWv6ELwGaPI y6EadWFYMz+46FnOcOUvbODWRzNr47Hl+zKKtY06ALdmdd+IbnfjsNA4r7yP5T0p 9wD3WsAanZGwR8rdYS9+gcQwcbHol7Ks+fMxiRk6zgwA+pTg8azFgPrRtSXw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1786733763; x=1786820163; bh=SYmNrSKKxco86QZr5x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Z7GXq9uJuB3w3JoBehf0f7YFiArLiJw X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 14 Aug 2026 14:56:02 -0400 (EDT) From: Junio C Hamano To: Christian Couder Cc: git@vger.kernel.org, "brian m . carlson" , Patrick Steinhardt , Karthik Nayak , Jeff King , Elijah Newren Subject: Re: [PATCH v2 4/5] upload-pack: read uploadpack.lazyFetchTrusted In-Reply-To: <20260813154748.2378747-5-christian.couder@gmail.com> (Christian Couder's message of "Thu, 13 Aug 2026 17:47:47 +0200") References: <20260807135511.1818458-1-christian.couder@gmail.com> <20260813154748.2378747-5-christian.couder@gmail.com> Date: Fri, 14 Aug 2026 11:56:00 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Christian Couder writes: > Previous commits created and prepared the path_allowlist_apply() > function. > > Let's reuse this function for a new "uploadpack.lazyFetchTrusted" > configuration variable. > > It allows us to: > > - read an allowlist from that config variable, > - check if the current repo is in that list, and > - return the result from a new upload_pack_lazy_fetch_trusted() > function. > > The new function will be used in a following commit. > > Note that the new config variable should be read only from protected > configuration files. > > Signed-off-by: Christian Couder > --- OK. I am not sure if the idea of configuration variable is truly sound, but if it were, I agree that this is a reasonable implementation for it. Thanks. > upload-pack.c | 37 +++++++++++++++++++++++++++++++++++++ > upload-pack.h | 3 +++ > 2 files changed, 40 insertions(+) > > diff --git a/upload-pack.c b/upload-pack.c > index a52856d869..29e700e43b 100644 > --- a/upload-pack.c > +++ b/upload-pack.c > @@ -34,6 +34,8 @@ > #include "json-writer.h" > #include "strmap.h" > #include "promisor-remote.h" > +#include "setup.h" > +#include "abspath.h" > > /* Remember to update object flag allocation in object.h */ > #define THEY_HAVE (1u << 11) > @@ -1378,6 +1380,41 @@ static int upload_pack_config(const char *var, const char *value, > return parse_hide_refs_config(var, value, "uploadpack", &data->hidden_refs); > } > > +struct lazy_fetch_trusted { > + int trusted; > + char *repo_path; > +}; > + > +static int upload_pack_protected_lazy_fetch_config(const char *var, const char *value, > + const struct config_context *ctx UNUSED, > + void *cb_data) > +{ > + struct lazy_fetch_trusted *data = cb_data; > + > + if (!strcmp("uploadpack.lazyfetchtrusted", var)) { > + path_allowlist_apply(var, value, data->repo_path, > + &data->trusted, false); > + return 0; > + } > + > + return 0; > +} > + > +bool upload_pack_lazy_fetch_trusted(struct repository *r) > +{ > + struct lazy_fetch_trusted data = { 0 }; > + > + data.repo_path = real_pathdup(r->worktree ? r->worktree : r->gitdir, 0); > + if (!data.repo_path) > + return false; > + > + git_protected_config(upload_pack_protected_lazy_fetch_config, &data); > + > + free(data.repo_path); > + > + return !!data.trusted; > +} > + > static int upload_pack_protected_config(const char *var, const char *value, > const struct config_context *ctx UNUSED, > void *cb_data) > diff --git a/upload-pack.h b/upload-pack.h > index d6ee25ea98..b2212992c3 100644 > --- a/upload-pack.h > +++ b/upload-pack.h > @@ -12,4 +12,7 @@ struct strbuf; > int upload_pack_advertise(struct repository *r, > struct strbuf *value); > > +/* Is this repo trusted for lazy fetching? */ > +bool upload_pack_lazy_fetch_trusted(struct repository *r); > + > #endif /* UPLOAD_PACK_H */