From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id qE2cLDOh/WEbSAAAgWs5BA (envelope-from ) for ; Fri, 04 Feb 2022 22:57:07 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id QVcyKTOh/WFzfgEAauVa8A (envelope-from ) for ; Fri, 04 Feb 2022 22:57:07 +0100 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 2CC2B39AAB for ; Fri, 4 Feb 2022 22:57:07 +0100 (CET) Received: from localhost ([::1]:50580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nG6Zm-0002Jq-BL for larch@yhetil.org; Fri, 04 Feb 2022 16:57:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nG6Zi-0002Je-2z for guix-patches@gnu.org; Fri, 04 Feb 2022 16:57:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39175) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nG6Zh-000277-Q7 for guix-patches@gnu.org; Fri, 04 Feb 2022 16:57:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nG6Zh-00049a-PF for guix-patches@gnu.org; Fri, 04 Feb 2022 16:57:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53721] [PATCH] lint: Perform fuzzy search on package names for CVE checker. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 04 Feb 2022 21:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53721 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Efraim Flashner Cc: Maxime Devos , 53721@debbugs.gnu.org Received: via spool by 53721-submit@debbugs.gnu.org id=B53721.164401178515923 (code B ref 53721); Fri, 04 Feb 2022 21:57:01 +0000 Received: (at 53721) by debbugs.gnu.org; 4 Feb 2022 21:56:25 +0000 Received: from localhost ([127.0.0.1]:33072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nG6Z7-00048j-Iv for submit@debbugs.gnu.org; Fri, 04 Feb 2022 16:56:25 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:43910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nG6Z5-00048V-TQ for 53721@debbugs.gnu.org; Fri, 04 Feb 2022 16:56:24 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 2BB2C761; Fri, 4 Feb 2022 22:56:17 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id syzRRj_FQFyI; Fri, 4 Feb 2022 22:56:16 +0100 (CET) Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 8676815D; Fri, 4 Feb 2022 22:56:15 +0100 (CET) From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <839345988529640bb54feea0fa830f25bd5bb608.1643811188.git.efraim@flashner.co.il> Date: Fri, 04 Feb 2022 22:56:14 +0100 In-Reply-To: <839345988529640bb54feea0fa830f25bd5bb608.1643811188.git.efraim@flashner.co.il> (Efraim Flashner's message of "Wed, 2 Feb 2022 16:15:20 +0200") Message-ID: <87bkzmmh35.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: / X-Rspamd-Server: hera X-Rspamd-Queue-Id: 2BB2C761 X-Spamd-Result: default: False [-0.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] 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" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644011827; 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; bh=a4D7u4v4EXdwCKeRhlnrKXHuQRbekf51PMYV1OrCc40=; b=m/LoPEhsAxrdRkWpg1xcfGdAu/QRFNfOu/680BRGO0MypIrRMKSNg1m8D9rpOl2aMBNRMd CyAQ0mTRkq3+jHc++hWmjvBdObRcOREy0FKEnmzV5O//UCpE5Yl/lhEfxu+dGYMPkRyQRz DN8kTquzNL6/6bDwLOtmk31457/NGub2NfYVqrj8aew8ivkzFkSWAAtL6dCoVgNI0V7WUZ 0NNtmHz+u5jHKiqJAgdZq4l2Ef5+fSqwjH/jSHvRRbBeK/4UI2gxLH7OjwNl7I7DG4CRjV kQlSwvhWfQUQjaoRGmyuaHtOlNcr392r06rqiKfT3StGvUUCATzq47QsuttLdA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644011827; a=rsa-sha256; cv=none; b=szNbGoJ4JzheYe1OV1PORJwXiRu6YhKXmsZhskA878iUZn30AeIAvJflVm2StSpYjJVNCF crlxAmdVnefd9x2er8vW3h4rfIhn+yOYD1brncrdpI/9JT1RO/6+GisxE4ONRzfgug9Zuz 6bcMsdRgn17l8I6vUmEXblyRzobH7O1qv5VhBfO3+hSCd+wyHY8uqkk81SXt5ysZBfZoPN G9IJ+94KdIpoMnpyiihXOHLdAoyoYD6CDLQ7AKh6bNfPv/ty05n1Htr/tN8XDFPa5xlECk L6flkhlH3OZShPa6sesy0hIWFRckY21DkacRSbM86tYA0tRRzKNGsaP9HrnD8A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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" X-Migadu-Spam-Score: -4.93 Authentication-Results: aspmx1.migadu.com; dkim=none; 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" X-Migadu-Queue-Id: 2CC2B39AAB X-Spam-Score: -4.93 X-Migadu-Scanner: scn0.migadu.com X-TUID: 6CZYsjIeCYc5 Hello, Efraim Flashner skribis: > - (let ((name (or (assoc-ref (package-properties package) > - 'cpe-name) > - (package-name package))) > - (version (or (assoc-ref (package-properties package) > - 'cpe-version) > - (package-version package)))) > + (let* ((pkg-name (package-name package)) > + (version (or (assoc-ref (package-properties package) > + 'cpe-version) > + (package-version package))) > + (name > + (or (assoc-ref (package-properties package) > + 'cpe-name) > + (false-if-exception > + (first > + (filter string? > + (map (lambda (prefix) > + (when (string-prefix? prefix pkg-n= ame) > + (string-drop pkg-name (string-le= ngth prefix)))) > + '("java-" "perl-" "python-" "python2= -" "ruby-"))))) > + pkg-name))) I agree with Maxime=E2=80=99s suggestions. In addition, I=E2=80=99d suggest moving this code out in two procedures, =E2=80=98package-cpe-name=E2=80=99 and =E2=80=98package-cpe-version=E2=80= =99, that would honor the relevant property and fall back to stripping prefixes. Then =E2=80=98package-vulnerabilities=E2=80=99 would simply call these two = procedures. How does that sound? Longer-term, we should add a thing that proposes correct CPE names: https://issues.guix.gnu.org/42299 Thanks, Ludo=E2=80=99.