diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2016-05-17 18:04:13 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2016-05-17 18:15:53 +0200 |
| commit | 99effc8faa43d478371eb06aee5df8ae1383c51a (patch) | |
| tree | 6e01a04c76f80f4707c56c12bdb6cad80d410b20 | |
| parent | 1c29f3ef8452860c4301d7ae57c89ac5956d1663 (diff) | |
lint: Honor 'cpe-name' and 'cpe-version' package properties.
* guix/scripts/lint.scm (package-name->cpe-name): Remove.
(package-vulnerabilities): Honor 'cpe-name' and 'cpe-version'
properties.
* gnu/packages/grub.scm (grub)[properties]: New field.
* gnu/packages/gnuzilla.scm (icecat)[properties]: Add 'cpe-name' and
'cpe-version'.
* doc/guix.texi (Invoking guix lint): Mention 'cpe-name'.
| -rw-r--r-- | doc/guix.texi | 13 | ||||
| -rw-r--r-- | gnu/packages/gnuzilla.scm | 6 | ||||
| -rw-r--r-- | gnu/packages/grub.scm | 5 | ||||
| -rw-r--r-- | guix/scripts/lint.scm | 21 |
4 files changed, 30 insertions, 15 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 0e63ecadfdc..3f0106be027 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -4961,6 +4961,19 @@ To view information about a particular vulnerability, visit pages such as: | |||
| 4961 | where @code{CVE-YYYY-ABCD} is the CVE identifier---e.g., | 4961 | where @code{CVE-YYYY-ABCD} is the CVE identifier---e.g., |
| 4962 | @code{CVE-2015-7554}. | 4962 | @code{CVE-2015-7554}. |
| 4963 | 4963 | ||
| 4964 | Package developers can specify in package recipes the | ||
| 4965 | @uref{https://nvd.nist.gov/cpe.cfm,Common Platform Enumeration (CPE)} | ||
| 4966 | name and version of the package when they differ from the name that Guix | ||
| 4967 | uses, as in this example: | ||
| 4968 | |||
| 4969 | @example | ||
| 4970 | (package | ||
| 4971 | (name "grub") | ||
| 4972 | ;; @dots{} | ||
| 4973 | ;; CPE calls this package "grub2". | ||
| 4974 | (properties '((cpe-name . "grub2")))) | ||
| 4975 | @end example | ||
| 4976 | |||
| 4964 | @item formatting | 4977 | @item formatting |
| 4965 | Warn about obvious source code formatting issues: trailing white space, | 4978 | Warn about obvious source code formatting issues: trailing white space, |
| 4966 | use of tabulations, etc. | 4979 | use of tabulations, etc. |
diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm index df1075c3701..7e52534b8f8 100644 --- a/gnu/packages/gnuzilla.scm +++ b/gnu/packages/gnuzilla.scm | |||
| @@ -517,4 +517,8 @@ standards.") | |||
| 517 | software, which does not recommend non-free plugins and addons. It also | 517 | software, which does not recommend non-free plugins and addons. It also |
| 518 | features built-in privacy-protecting features.") | 518 | features built-in privacy-protecting features.") |
| 519 | (license license:mpl2.0) ;and others, see toolkit/content/license.html | 519 | (license license:mpl2.0) ;and others, see toolkit/content/license.html |
| 520 | (properties '((ftp-directory . "/gnu/gnuzilla"))))) | 520 | (properties |
| 521 | `((ftp-directory . "/gnu/gnuzilla") | ||
| 522 | (cpe-name . "firefox_esr") | ||
| 523 | (cpe-version . ,(string-drop-right version | ||
| 524 | (string-length "-gnu1"))))))) | ||
diff --git a/gnu/packages/grub.scm b/gnu/packages/grub.scm index 5fc7ee83866..ec2feebbf43 100644 --- a/gnu/packages/grub.scm +++ b/gnu/packages/grub.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> | 3 | ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> |
| 4 | ;;; Copyright © 2015 Leo Famulari <leo@famulari.name> | 4 | ;;; Copyright © 2015 Leo Famulari <leo@famulari.name> |
| 5 | ;;; | 5 | ;;; |
| @@ -132,4 +132,5 @@ then goes on to load the rest of the operating system. As a multiboot | |||
| 132 | bootloader, GRUB handles the presence of multiple operating systems installed | 132 | bootloader, GRUB handles the presence of multiple operating systems installed |
| 133 | on the same computer; upon booting the computer, the user is presented with a | 133 | on the same computer; upon booting the computer, the user is presented with a |
| 134 | menu to select one of the installed operating systems.") | 134 | menu to select one of the installed operating systems.") |
| 135 | (license gpl3+))) | 135 | (license gpl3+) |
| 136 | (properties '((cpe-name . "grub2"))))) | ||
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index 06001d3eaec..b4fdb6f9050 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm | |||
| @@ -600,15 +600,6 @@ be determined." | |||
| 600 | ((? origin?) | 600 | ((? origin?) |
| 601 | (and=> (origin-actual-file-name patch) basename)))) | 601 | (and=> (origin-actual-file-name patch) basename)))) |
| 602 | 602 | ||
| 603 | (define (package-name->cpe-name name) | ||
| 604 | "Do a basic conversion of NAME, a Guix package name, to the corresponding | ||
| 605 | Common Platform Enumeration (CPE) name." | ||
| 606 | (match name | ||
| 607 | ("icecat" "firefox") ;or "firefox_esr" | ||
| 608 | ("grub" "grub2") | ||
| 609 | ;; TODO: Add more. | ||
| 610 | (_ name))) | ||
| 611 | |||
| 612 | (define (current-vulnerabilities*) | 603 | (define (current-vulnerabilities*) |
| 613 | "Like 'current-vulnerabilities', but return the empty list upon networking | 604 | "Like 'current-vulnerabilities', but return the empty list upon networking |
| 614 | or HTTP errors. This allows network-less operation and makes problems with | 605 | or HTTP errors. This allows network-less operation and makes problems with |
| @@ -635,9 +626,15 @@ from ~s: ~a (~s)~%") | |||
| 635 | (current-vulnerabilities*))))) | 626 | (current-vulnerabilities*))))) |
| 636 | (lambda (package) | 627 | (lambda (package) |
| 637 | "Return a list of vulnerabilities affecting PACKAGE." | 628 | "Return a list of vulnerabilities affecting PACKAGE." |
| 638 | ((force lookup) | 629 | ;; First we retrieve the Common Platform Enumeration (CPE) name and |
| 639 | (package-name->cpe-name (package-name package)) | 630 | ;; version for PACKAGE, then we can pass them to LOOKUP. |
| 640 | (package-version package))))) | 631 | (let ((name (or (assoc-ref (package-properties package) |
| 632 | 'cpe-name) | ||
| 633 | (package-name package))) | ||
| 634 | (version (or (assoc-ref (package-properties package) | ||
| 635 | 'cpe-version) | ||
| 636 | (package-version package)))) | ||
| 637 | ((force lookup) name version))))) | ||
| 641 | 638 | ||
| 642 | (define (check-vulnerabilities package) | 639 | (define (check-vulnerabilities package) |
| 643 | "Check for known vulnerabilities for PACKAGE." | 640 | "Check for known vulnerabilities for PACKAGE." |
