From patchwork Sat Jan 30 01:04:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Leo Famulari X-Patchwork-Id: 26721 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1A70127BC1E; Sat, 30 Jan 2021 01:05:31 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D410727BC1D for ; Sat, 30 Jan 2021 01:05:28 +0000 (GMT) Received: from localhost ([::1]:33900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5ehb-0003IX-Sk for patchwork@mira.cbaines.net; Fri, 29 Jan 2021 20:05:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5ehC-0003IB-4R for guix-patches@gnu.org; Fri, 29 Jan 2021 20:05:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:41689) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5ehB-0001oF-T4 for guix-patches@gnu.org; Fri, 29 Jan 2021 20:05:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l5ehB-0005rr-Nr for guix-patches@gnu.org; Fri, 29 Jan 2021 20:05:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#46182] [PATCH] lint: Add 'check-git-protocol' checker. Resent-From: Leo Famulari Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 30 Jan 2021 01:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46182 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 46182@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161196866222391 (code B ref -1); Sat, 30 Jan 2021 01:05:01 +0000 Received: (at submit) by debbugs.gnu.org; 30 Jan 2021 01:04:22 +0000 Received: from localhost ([127.0.0.1]:53235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5egW-0005p0-K7 for submit@debbugs.gnu.org; Fri, 29 Jan 2021 20:04:22 -0500 Received: from lists.gnu.org ([209.51.188.17]:56264) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5egT-0005oj-Oh for submit@debbugs.gnu.org; Fri, 29 Jan 2021 20:04:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36332) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5egT-0003EJ-IW for guix-patches@gnu.org; Fri, 29 Jan 2021 20:04:17 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:41245) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5egQ-0001Up-Qx for guix-patches@gnu.org; Fri, 29 Jan 2021 20:04:17 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 2025E5C00F0; Fri, 29 Jan 2021 20:04:14 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 29 Jan 2021 20:04:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=famulari.name; h=from:to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=mesmtp; bh=wELDlHTBwBQZhGY4nITAAcL z6f+rcmgcByX/CabMoJo=; b=J9ZfW6BSmOBCUbU2jsKJWuwEKSAb1szgSzZ7YOy EbIsaCZegZ8TX20omKq1OuvzU6dgk4vzmd+A2BEfAVVFnCz3fSxX15rEnjAQ3Dsb a5Wm1qmqommfzmxOwdJFcI8G0q+HfkMtiHe0typGyt+aZdM8ls0oISHJ5JH/SzKp 7uUw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=wELDlH TBwBQZhGY4nITAAcLz6f+rcmgcByX/CabMoJo=; b=EkNvm+UG4kWDQ3HkmXYuuY LSIrMvjAgaXODebob8aDu3ZE6zW8O+vW/Y3Unxpfk5RdfyoddFi8oBnMovjCCFMx pElGXiHUqVuQ6jMMrGdNCNnDkzzoVjFmdqXqGId6JMTmnZHPvUACe6N3fq4b+JC7 9aBsG1Tgyga+egl5KRHGlxsQi82M9qFuFh9PLL5g8StJF5BV7cdissjpu7CLlhvU CIkjpWKJ3QUDvsiA4eOzj9AKHyVt28uXgS6Mb5cgb92LQrA4Bdj2uwD28q++by6H pPz0KcFSXXmX4GGBa2X7rGRAK3wGya4aXv2Csp3PJ0YFigbuz+kDl0ftNDQ9nQpw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffogggtgfesthekredtre dtjeenucfhrhhomhepnfgvohcuhfgrmhhulhgrrhhiuceolhgvohesfhgrmhhulhgrrhhi rdhnrghmvgeqnecuggftrfgrthhtvghrnhepjeduveefledvveeikeetieekudevgeevue dujeetvdekgfevieejieetgfehtdejnecuffhomhgrihhnpehstghmtghhvggtkhdqghhi thdqphhrohhtohgtohhlnhgvfihprhhotggvughurhgvrdhlohgtrghlnecukfhppedutd dtrdduuddrudeiledruddukeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpehlvghosehfrghmuhhlrghrihdrnhgrmhgv X-ME-Proxy: Received: from jasmine.lan (pool-100-11-169-118.phlapa.fios.verizon.net [100.11.169.118]) by mail.messagingengine.com (Postfix) with ESMTPA id B543E24005C for ; Fri, 29 Jan 2021 20:04:13 -0500 (EST) From: Leo Famulari Date: Fri, 29 Jan 2021 20:04:06 -0500 Message-Id: X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Received-SPF: pass client-ip=66.111.4.25; envelope-from=leo@famulari.name; helo=out1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches We could also make it warn about use of the HTTP protocol (as opposed to HTTPS). Your thoughts? * guix/lint.scm (check-git-protocol): New procedure. (%local-checkers): Add 'git-protocol' checker. * doc/guix.texi (Invoking guix lint): Document it. --- doc/guix.texi | 6 +++++- guix/lint.scm | 25 ++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index ff9e8da2e0..d17e2f2e96 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -28,7 +28,7 @@ Copyright @copyright{} 2014, 2015, 2016 Alex Kost@* Copyright @copyright{} 2015, 2016 Mathieu Lirzin@* Copyright @copyright{} 2014 Pierre-Antoine Rault@* Copyright @copyright{} 2015 Taylan Ulrich Bayırlı/Kammer@* -Copyright @copyright{} 2015, 2016, 2017, 2019, 2020 Leo Famulari@* +Copyright @copyright{} 2015, 2016, 2017, 2019, 2020, 2021 Leo Famulari@* Copyright @copyright{} 2015, 2016, 2017, 2018, 2019, 2020 Ricardo Wurmus@* Copyright @copyright{} 2016 Ben Woodcroft@* Copyright @copyright{} 2016, 2017, 2018 Chris Marusich@* @@ -11736,6 +11736,10 @@ Parse the @code{source} URL to determine if a tarball from GitHub is autogenerated or if it is a release tarball. Unfortunately GitHub's autogenerated tarballs are sometimes regenerated. +@item git-protocol +Check if the package's source code is fetched using the insecure @code{git://} +protocol. + @item derivation Check that the derivation of the given packages can be successfully computed for all the supported systems (@pxref{Derivations}). diff --git a/guix/lint.scm b/guix/lint.scm index 311bc94cc3..5a609b0454 100644 --- a/guix/lint.scm +++ b/guix/lint.scm @@ -11,6 +11,7 @@ ;;; Copyright © 2018, 2019 Arun Isaac ;;; Copyright © 2020 Chris Marusich ;;; Copyright © 2020 Timothy Sample +;;; Copyright © 2021 Leo Famulari ;;; ;;; This file is part of GNU Guix. ;;; @@ -51,7 +52,7 @@ #:use-module (guix gnu-maintenance) #:use-module (guix cve) #:use-module ((guix swh) #:hide (origin?)) - #:autoload (guix git-download) (git-reference? + #:autoload (guix git-download) (git-reference? git-fetch git-reference-url git-reference-commit) #:use-module (guix import stackage) #:use-module (ice-9 match) @@ -84,6 +85,7 @@ check-source check-source-file-name check-source-unstable-tarball + check-git-protocol check-mirror-url check-github-url check-license @@ -918,6 +920,23 @@ descriptions maintained upstream." (origin-uris origin)) '()))) +(define (check-git-protocol package) + "Emit a warning if PACKAGE's source URI protocol is 'git://'." + (define (check-source-uri-scheme uri) + (if (eqv? (uri-scheme uri) 'git) + (list + (make-warning package + (G_ "the source URI should not use the git:// protocol") + #:field 'source)) + '())) + + (let ((origin (package-source package))) + (if (and (origin? origin) + (eqv? (origin-method origin) git-fetch)) + (check-source-uri-scheme + (string->uri (git-reference-url (origin-uri origin)))) + '()))) + (define (check-mirror-url package) "Check whether PACKAGE uses source URLs that should be 'mirror://'." (define (check-mirror-uri uri) ;XXX: could be optimized @@ -1476,6 +1495,10 @@ or a list thereof") (name 'source-unstable-tarball) (description "Check for autogenerated tarballs") (check check-source-unstable-tarball)) + (lint-checker + (name 'git-protocol) + (description "Check for use of the git:// protocol") + (check check-git-protocol)) (lint-checker (name 'derivation) (description "Report failure to compile a package to a derivation")