From: "Ludovic Courtès" <ludo@gnu.org>
To: 74776@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>,
"Christopher Baines" <guix@cbaines.net>,
"Josselin Poiret" <dev@jpoiret.xyz>,
"Ludovic Courtès" <ludo@gnu.org>,
"Mathieu Othacehe" <othacehe@gnu.org>,
"Simon Tournier" <zimon.toutoune@gmail.com>,
"Tobias Geerinckx-Rice" <me@tobias.gr>
Subject: [bug#74776] [PATCH 6/7] inferior: Add #:verify-certificate? to ‘cached-channel-instance’.
Date: Wed, 11 Dec 2024 00:34:45 +0100 [thread overview]
Message-ID: <2ca2cc830049e38f4ef6dde25da3a111ca99e8d1.1733873391.git.ludo@gnu.org> (raw)
In-Reply-To: <cover.1733873391.git.ludo@gnu.org>
* 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 <ludo@gnu.org>
+;;; Copyright © 2018-2024 Ludovic Courtès <ludo@gnu.org>
;;;
;;; 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
next prev parent reply other threads:[~2024-12-10 23:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 23:33 [bug#74776] [PATCH 0/7] Adding '--no-check-certificate' to 'pull' and 'time-machine' Ludovic Courtès
2024-12-10 23:34 ` [bug#74776] [PATCH 1/7] git: Remove Guile-Git < 0.4.0 compatibility fallback Ludovic Courtès
2024-12-10 23:34 ` [bug#74776] [PATCH 2/7] git: Allow X.509 certificate verification to be disabled Ludovic Courtès
2024-12-10 23:34 ` [bug#74776] [PATCH 3/7] guix download: Honor ‘--no-check-certificate’ for ‘--git’ Ludovic Courtès
2024-12-10 23:34 ` [bug#74776] [PATCH 4/7] channels: Add #:verify-certificate? and honor it Ludovic Courtès
2024-12-10 23:34 ` [bug#74776] [PATCH 5/7] pull: Add ‘--no-check-certificate’ Ludovic Courtès
2024-12-11 2:45 ` Maxim Cournoyer
2024-12-10 23:34 ` Ludovic Courtès [this message]
2024-12-10 23:34 ` [bug#74776] [PATCH 7/7] time-machine: " Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2ca2cc830049e38f4ef6dde25da3a111ca99e8d1.1733873391.git.ludo@gnu.org \
--to=ludo@gnu.org \
--cc=74776@debbugs.gnu.org \
--cc=dev@jpoiret.xyz \
--cc=guix@cbaines.net \
--cc=me@tobias.gr \
--cc=othacehe@gnu.org \
--cc=zimon.toutoune@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).