From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id AO8IOgfwK2eBdAAAe85BDQ:P1 (envelope-from ) for ; Wed, 06 Nov 2024 22:39:04 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id AO8IOgfwK2eBdAAAe85BDQ (envelope-from ) for ; Wed, 06 Nov 2024 23:39:04 +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=oegywKWS; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=GXiHj6iB; dmarc=pass (policy=none) header.from=gnu.org; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1730932743; a=rsa-sha256; cv=none; b=YE0E3k0uJWMGjnRy2hBjMdQ5hIS2zG+6NlHXskolArlG6KzyrlqrehH4ca9shBoXtDqde4 rohDe5AcGOQ3RuJDVyu90w4VCrEY2gPU+bp1iAdh4Og+S9wEdEjMGbFRiLJMQmJ86bFMlF skfDvanKRI1eYgMva6rSP6GL7l0fz8Po2XToQMMrVEYqcaAJH5yv4NUs4TPuH9Z0b6joRe vmQ4xYsXans6oprmp0GxgMeJ/Xkmoc0i+Iqq57D6P/mteNVKh6YRP3yaChfZb0s0u+0+4M doFNQfrMjXbP8smUshYXjZUyhGSl6ULhsrIClYJwWDV5ujScThwC4L03IOGjaQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=oegywKWS; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=GXiHj6iB; dmarc=pass (policy=none) header.from=gnu.org; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1730932743; 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=98+0RA1tBqocVTsEY8AaMThNXg6wcpuiH98Gmhton5Y=; b=D+2wDxid1sCoJG5SVaDuJdk4hpvKw7H150ca/aljQDjiYpYyOdz1QAgVID1fjiKpBQcY3R rbdul7k/jR8NQCNyDjqwGAkMgEzfcSElm2R0e350jpXO04Woey07yJ1W3zHPrcEEWr1L33 8s5FZX5578JZj2n2wsCoyuIe3H0jBhX1Ph8hKJrqe5NcoCj3k7niFVkSXehlJG5VmqQbXo i/X3U7PbmkDwY5V8XfKngfOQM/eVnV/2nyqGP8cz5LwUixq3TJEMQuNhajKaUzZpbO+UIq axIs6xuInTd2JgEGigBfvOUCLOhsDRH3dhDtNtIJXxMTUl39nCypmgylyMox2Q== 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 85ED38E319 for ; Wed, 06 Nov 2024 23:39:03 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8npp-00062G-2Z; Wed, 06 Nov 2024 16:45:05 -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 1t8npm-000626-O2 for guix-patches@gnu.org; Wed, 06 Nov 2024 16:45:02 -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 1t8npm-0008KR-Dp for guix-patches@gnu.org; Wed, 06 Nov 2024 16:45:02 -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:Date:References:In-Reply-To:From:To:Subject; bh=98+0RA1tBqocVTsEY8AaMThNXg6wcpuiH98Gmhton5Y=; b=oegywKWS627aPKqH76/KBFsb5y/JBowz5LZn0l66O++airO0d6wyDrJodWdwjFhm5YaS9MYBdfGg6EPGkbwRl07GdAoKW3KG9Ql2dkckEVV1w6a9TpiobwgUhW+mSmgU8tIMicNZm8o1Z3jGpgoOS4ocxjcFhdAqGpnffjbGTSFglMTeB7Zow03a96bCScS2luQO7/RWv+akgCuPnkndHNe/t7nJNJLEJ55Cu/VoMTZcEDLOSlDvZ0qhr1gle+YCdZ4GUw3i7FuB7M2qZ6fxZGkLghzEj4zyMd5Uu3/ScKJKLwUPoX6oSDI7KED2P3Wg8IPsiaJuzUmx041RkE3XHA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t8npm-0006ig-0M for guix-patches@gnu.org; Wed, 06 Nov 2024 16:45:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74034] [PATCH v2 01/16] guix: cve: Add cpe-vendor and lint-hidden-cpe-vendors properties. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 06 Nov 2024 21:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74034 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Nicolas Graves Cc: 74034@debbugs.gnu.org Received: via spool by 74034-submit@debbugs.gnu.org id=B74034.173092944525664 (code B ref 74034); Wed, 06 Nov 2024 21:45:01 +0000 Received: (at 74034) by debbugs.gnu.org; 6 Nov 2024 21:44:05 +0000 Received: from localhost ([127.0.0.1]:46286 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t8noq-0006fs-Fz for submit@debbugs.gnu.org; Wed, 06 Nov 2024 16:44:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54150) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t8non-0006ey-5h for 74034@debbugs.gnu.org; Wed, 06 Nov 2024 16:44:03 -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 1t8nof-00083K-Qp; Wed, 06 Nov 2024 16:43:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=98+0RA1tBqocVTsEY8AaMThNXg6wcpuiH98Gmhton5Y=; b=GXiHj6iBMjJoPw7pelWl K6XSL9RTLuGFLCDo/vLhb+xKnEFhJ8msYEf7C11dkfB/OVAUJULGer3+qZKSA3s4OuhHeVUER1xou 3ISBieCaKtiXK8K/PjMtKXfeheTAXu6y28+/jlQDBY3R1VBSr+p27mpUEl8ilyHO6fHvpjVmiXJfk 2Z0k3qQxHWeO2iHQ6HmLQcvS6bXLoPP434P26WhcXuNrkkKhohpQeXCiZ0X4DCVrvEB+FVaqFkWIX T9bkgEKJKrLw4Jqrs86LB3Bxk6uNhfmCtTuGGTunwdhXhs0EfzDxZrHbAgC9XPnB+uUng+eJheTOr zbps55K1l037aQ==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <20241027182029.25707-1-ngraves@ngraves.fr> (Nicolas Graves's message of "Sun, 27 Oct 2024 19:20:06 +0100") References: <20241026222934.25890-1-ngraves@ngraves.fr> <20241027182029.25707-1-ngraves@ngraves.fr> Date: Wed, 06 Nov 2024 22:43:51 +0100 Message-ID: <87h68kujfs.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-Spam-Score: -3.59 X-Spam-Score: -3.59 X-Migadu-Queue-Id: 85ED38E319 X-Migadu-Scanner: mx10.migadu.com X-TUID: p70jAoZXKKlI Hi, Nicolas Graves skribis: > * guix/cve.scm: Exploit cpe vendors information. > (cpe->package-name): Rename to cpe->package and use > cpe_vendor:cpe_name in place or cpe_name. > (filter-vendors): Add helper function. > (vulnerabilities->lookup-proc): Extract cpe_name for table > hashes. Add vendor and hidden-vendor arguments. Adapt condition to > pass vulnerabilities to result in the fold. > > * guix/lint.scm (package-vulnerabilities): Use additional arguments > from vulnerabilities->lookup-proc. > > * tests/cve.scm: Adapt tests. Nice! Please mention the names of tests being change in the commit log (see =E2=80=98git log=E2=80=99 for examples). > -(define (cpe->package-name cpe) > +(define (cpe->package cpe) Or =E2=80=98cpe->package-identifier=E2=80=99? It=E2=80=99s unpleasant that said identifier is an unparsed =E2=80=9Cvendor= :package=E2=80=9D string. I wonder if we should instead leave =E2=80=98%cpe-package-rx=E2=80= =99 unchanged and return three values: package, version, vendor. The downside is that it would lead to more changes down the road because we=E2=80=99d have to carry the vendor bit along. Thoughts? > +(define (filter-vendors vuln vendor hidden-vendors) > + Always add a docstring for top-level procedures. > + (define (vendor-matches? vendor+name) > + (if vendor > + (string-prefix? (string-append vendor ":") vendor+name) > + (if hidden-vendors > + (not (any (lambda (v) > + (string-prefix? (string-append v ":") vendor+nam= e)) > + hidden-vendors)) > + #t))) (if x y #t) =3D> (or (not x) y) s/v/vendor/ > + (lambda* (package #:key (version #f) (vendor #f) (hidden-vendors #f)) I=E2=80=99d keep =E2=80=98version=E2=80=99 option rather than keyword, for = compatibility and because it=E2=80=99s more commonly useful than the others. =E2=80=98hidden-vendors=E2=80=99 should always be a list, the empty list by= default (rule of thumb: avoid =E2=80=9C#f | list=E2=80=9D polymorphism if a list is= as expressive.) > + (vhash-fold* > + (lambda (pair result) > + (match pair > + ((vuln sexp) > + (if (and (or (not (or vendor hidden-vendors)) > + (and (or vendor hidden-vendors) > + (filter-vendors vuln vendor hidden-vendors))) > + (or (not version) > + (and version (version-matches? version sexp)))) (or (not x) (and x y)) =3D> (or (not x) y) Thanks, Ludo=E2=80=99.