From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id EJAHMIjQWGeklAAAe85BDQ:P1 (envelope-from ) for ; Tue, 10 Dec 2024 23:36:40 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id EJAHMIjQWGeklAAAe85BDQ (envelope-from ) for ; Wed, 11 Dec 2024 00:36:40 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=n7cIVxXW; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=bJow8Pum; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1733873800; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=p17ggAbyAeGglmwSyQVAFYFphqkimWtTXp9aVZjSqgQ=; b=Fm8a8PqALfXaasaoLk5ygpplifbHZuNSehUb982EDpWPCfmUYKyDhVGqwtkeiANE488l4Q WDSIT3c3BfBsxs5MfGjLE0I1OZx+qXcspZGgfaxiwHQJMouTIrSTQCnTLN4iba6BKadVAf kGaDd3fN7gzeBrMgIsVgqGI3nrE2NMD1506hD7z7PYAl0MGeTIuLvPXh7bfknbHaLs7d6w QOhyNbOl7Yj+DT2lA55fyZ6feMLWGQk4UjFjqr8szVVj35+i+EPTjHESrNxsbbwyk7O6YX m4i4rJIOUr58tpuTznvNvZJaxywe+/jXIS6pPHaWTMP0Q+AScqrMLnO2DkkPCw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=n7cIVxXW; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=bJow8Pum; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1733873800; a=rsa-sha256; cv=none; b=bpRzVlDzTuFEPgjPTx603xwf/Mw+KmBmbaCpwc5ooA8cOB/JBVzMGlbBUfuIY7XPmb0w/R u09HqmYsyXSJnrhDi0lMmP2nyuvEidg8ihjMlAQo4fCldialJJJ1xVmrRbjpBzDvnO63td 058HCNR44D36iKXsdK8Cwd79+9ZMG08N3cgKV6mXbm8DB8tQJ1tbU4nqYgp65Xq1xwuvob AevcQQ3ITStAEC6f6ZaeQsDEJYvCC7MaMGCWPUNvuMtRI0fO9sV3Q73MVjJZuSaQZQfbv7 +8K8Jp5nLlPWdMwyYER4fzUNLFTpqhV6tbFgxT1uWLA1aWnnNNkMoKuWhKe/Ig== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9B9917EBBD for ; Wed, 11 Dec 2024 00:36:40 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL9lw-0007qV-Mn; Tue, 10 Dec 2024 18:36:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tL9lv-0007pu-45 for guix-patches@gnu.org; Tue, 10 Dec 2024 18:36:07 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL9lu-0002ej-J5; Tue, 10 Dec 2024 18:36:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=p17ggAbyAeGglmwSyQVAFYFphqkimWtTXp9aVZjSqgQ=; b=n7cIVxXWEKdgq3TGyspgTHpEH7/CGw3Liu2VW/SKNPUuPshRjZcZtrV60T13lZyEMjsIumRj22zl689LzE9qp+i3RtTNf+pCgDB+y+nDZTlvfLh2Q47Tv87Kl1RObtPk+XaaNxS1YRnp4YRjjS6+LdAftGWK9OfePriZ5UhfI4Z+EU2n2yRN1j2ptZQd+C1c7tNltFHi1NknfD2afxwqhI5PVFcfVFjQozQRM5vMe3rhb/8ruzWfCNzVC7HFR4g6wTa62Kgy3rzoiFPXKMdZBUvq/JwN0fOjiXHfP0tYaTSsuPpESTrYPvtTeEeRxScwZSjZ01c3EckYEDCTgDziyg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tL9ls-0005e7-P3; Tue, 10 Dec 2024 18:36:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74776] [PATCH 6/7] inferior: Add #:verify-certificate? to =?UTF-8?Q?=E2=80=98cached-channel-instance=E2=80=99.?= Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Tue, 10 Dec 2024 23:36:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74776 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74776@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 74776-submit@debbugs.gnu.org id=B74776.173387371721422 (code B ref 74776); Tue, 10 Dec 2024 23:36:04 +0000 Received: (at 74776) by debbugs.gnu.org; 10 Dec 2024 23:35:17 +0000 Received: from localhost ([127.0.0.1]:60065 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL9l6-0005Y7-8t for submit@debbugs.gnu.org; Tue, 10 Dec 2024 18:35:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39866) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL9ky-0005TH-FJ for 74776@debbugs.gnu.org; Tue, 10 Dec 2024 18:35:09 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tL9kt-0002Uw-1n; Tue, 10 Dec 2024 18:35:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=p17ggAbyAeGglmwSyQVAFYFphqkimWtTXp9aVZjSqgQ=; b=bJow8PumT09De7hiiR9H Y+j7LBxZNZqr8pzkWvY1bAsc+9FGyrBoItbf0aI+1pqe+Ba+ctyJfAdkz3aYagQ66zKS0Fmxjp+Ot 0wZVGX066/qEM0nR2eOPq4+VVWOuK+0xzuCwul3jJRvOv0g7iEaA15snwwOQ+yAiIPuzxDQXrDozu 816mj/UtiqfF3QzpBBIz3mIUN6QtZYcyx1Rn9xK+R3t2OqSK+bYXN7AWfNd6Ggk6vW0xrbnsNP9vy a65z4yZ5z4P0+udv3XnZBwPSMaRsWHaldeo/rTyGOnZDEUvn0FnvLpTYK9XtbobZY2E8GVb09xonY QesOsrw81QKN3g==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Wed, 11 Dec 2024 00:34:45 +0100 Message-ID: <2ca2cc830049e38f4ef6dde25da3a111ca99e8d1.1733873391.git.ludo@gnu.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -0.86 X-Spam-Score: -0.86 X-Migadu-Queue-Id: 9B9917EBBD X-TUID: X/t0pJz/EKJt * guix/inferior.scm (channel-full-commit): Add #:verify-certificate? and pass it on. (cached-channel-instance): Likewise. Change-Id: I9882660ac9eee2c4d9bb5e227979fd8de10555b1 --- guix/inferior.scm | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/guix/inferior.scm b/guix/inferior.scm index b60bf1ab01..8066cce2fc 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2018-2023 Ludovic Courtès +;;; Copyright © 2018-2024 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -864,7 +864,7 @@ (define %inferior-cache-directory (make-parameter (string-append (cache-directory #:ensure? #f) "/inferiors"))) -(define (channel-full-commit channel) +(define* (channel-full-commit channel #:key (verify-certificate? #t)) "Return the commit designated by CHANNEL as quickly as possible. If CHANNEL's 'commit' field is a full SHA1, return it as-is; if it's a SHA1 prefix, resolve it; and if 'commit' is unset, fetch CHANNEL's branch tip." @@ -876,7 +876,8 @@ (define (channel-full-commit channel) (cache commit relation (update-cached-checkout (channel-url channel) #:ref ref - #:check-out? #f))) + #:check-out? #f + #:verify-certificate? verify-certificate?))) commit)))) (define* (cached-channel-instance store @@ -886,7 +887,8 @@ (define* (cached-channel-instance store (cache-directory (%inferior-cache-directory)) (ttl (* 3600 24 30)) (reference-channels '()) - (validate-channels (const #t))) + (validate-channels (const #t)) + (verify-certificate? #t)) "Return a directory containing a guix filetree defined by CHANNELS, a list of channels. The directory is a subdirectory of CACHE-DIRECTORY, where entries can be reclaimed after TTL seconds. This procedure opens a new connection to the @@ -895,12 +897,18 @@ (define* (cached-channel-instance store VALIDATE-CHANNELS must be a four-argument procedure used to validate channel instances against REFERENCE-CHANNELS; it is passed as #:validate-pull to 'latest-channel-instances' and should raise an exception in case a target -channel commit is deemed \"invalid\"." +channel commit is deemed \"invalid\". + +When VERIFY-CERTIFICATE? is true, raise an error when encountering an invalid +X.509 host certificate; otherwise, warn about the problem and keep going." (define commits ;; Since computing the instances of CHANNELS is I/O-intensive, use a ;; cheaper way to get the commit list of CHANNELS. This limits overhead ;; to the minimum in case of a cache hit. - (map channel-full-commit channels)) + (map (lambda (channel) + (channel-full-commit channel + #:verify-certificate? verify-certificate?)) + channels)) (define key (bytevector->base32-string @@ -951,7 +959,9 @@ (define* (cached-channel-instance store #:current-channels reference-channels #:validate-pull - validate-channels)) + validate-channels + #:verify-certificate? + verify-certificate?)) (profile (channel-instances->derivation instances))) (mbegin %store-monad -- 2.46.0