aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015, 2016, 2019 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (test-cve)
  #:use-module (guix cve)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-19)
  #:use-module (srfi srfi-64))

(define %sample
  (search-path %load-path "tests/cve-sample.json"))

(define (vulnerability id packages)
  (make-struct/no-tail (@@ (guix cve) <vulnerability>) id packages))

(define %expected-vulnerabilities
  ;; What we should get when reading %SAMPLE.
  (list
   (vulnerability "CVE-2019-0001"
                  ;; Only the "a" CPE configurations are kept; the "o"
                  ;; configurations are discarded.
                  '(("junos" (or "18.21-s4" (or "18.21-s3" "18.2")))))
   (vulnerability "CVE-2019-0005"
                  '(("junos" (or "18.11" "18.1"))))
   ;; CVE-2019-0005 has no "a" configurations.
   (vulnerability "CVE-2019-14811"
                  '(("ghostscript" (< "9.28"))))
   (vulnerability "CVE-2019-17365"
                  '(("nix" (<= "2.3"))))
   (vulnerability "CVE-2019-1010180"
                  '(("gdb" _)))                   ;any version
   (vulnerability "CVE-2019-1010204"
                  '(("binutils" (and (>= "2.21") (<= "2.31.1")))
                    ("binutils_gold" (and (>= "1.11") (<= "1.16")))))
   ;; CVE-2019-18192 has no associated configurations.
   ))


(test-begin "cve")

(test-equal "json->cve-items"
  '("CVE-2019-0001"
    "CVE-2019-0005"
    "CVE-2019-14811"
    "CVE-2019-17365"
    "CVE-2019-1010180"
    "CVE-2019-1010204"
    "CVE-2019-18192")
  (map (compose cve-id cve-item-cve)
       (call-with-input-file %sample json->cve-items)))

(test-equal "cve-item-published-date"
  '(2019)
  (delete-duplicates
   (map (compose date-year cve-item-published-date)
        (call-with-input-file %sample json->cve-items))))

(test-equal "json->vulnerabilities"
  %expected-vulnerabilities
  (call-with-input-file %sample json->vulnerabilities))

(test-equal "vulnerabilities->lookup-proc"
  (list (list (third %expected-vulnerabilities))  ;ghostscript
        (list (third %expected-vulnerabilities))
        '()

        (list (fifth %expected-vulnerabilities))  ;gdb
        (list (fifth %expected-vulnerabilities))

        (list (fourth %expected-vulnerabilities)) ;nix
        '()

        (list (sixth %expected-vulnerabilities))  ;binutils
        '()
        (list (sixth %expected-vulnerabilities))
        '())
  (let* ((vulns  (call-with-input-file %sample json->vulnerabilities))
         (lookup (vulnerabilities->lookup-proc vulns)))
    (list (lookup "ghostscript")
          (lookup "ghostscript" "9.27")
          (lookup "ghostscript" "9.28")
          (lookup "gdb")
          (lookup "gdb" "42.0")
          (lookup "nix")
          (lookup "nix" "2.4")
          (lookup "binutils" "2.31.1")
          (lookup "binutils" "2.10")
          (lookup "binutils_gold" "1.11")
          (lookup "binutils" "2.32"))))

(test-end "cve")
maxim.cournoyer@gmail.com> Bruno Victal 2024-08-29gnu: opencv: Update to 4.10.0...* gnu/packages/image-processing.scm (opencv): Update to 4.10.0. Change-Id: I4de85cdaa744386deb8162a689dca23003c150ef Signed-off-by: Zheng Junjie <zhengjunjie@iscas.ac.cn> Andy Tai 2024-07-07gnu: gmic: Update source hash....Fixes: https://issues.guix.gnu.org/71970 * gnu/packages/image-processing.scm (gmic): Update source hash. Change-Id: Id7ad742086139263d5677339f1c7b91de350a3f2 Zheng Junjie 2024-07-05gnu: gmic: Update to 3.4.0....* gnu/packages/image-processing.scm (gmic): Update to 3.4.0. Change-Id: I2c9335a96bb22625012f35b60620b9b9ad435a64 Vinicius Monego 2024-06-27gnu: vtk: Update to 9.3.0....* gnu/packages/image-processing.scm (vtk): Update to 9.3.0. Change-Id: Id31d41e7dc457d1f17c0e8e824c170942d81698c Signed-off-by: Andreas Enge <andreas@enge.fr> Lars Bilke 2024-05-23gnu: dcmtk: Update to 3.6.8. [security-fixes]...This fixes CVE-2022-43272. * gnu/packages/image-processing.scm (dcmtk): Update to 3.6.8. Change-Id: I4e0203219280a2571267f566cdfc8c2a9ea3fd18 Signed-off-by: Zheng Junjie <zhengjunjie@iscas.ac.cn> Nicolas Graves via Guix-patches via 2024-04-22gnu: Add python-pims....* gnu/packages/image-processing.scm (python-pims): New variable. Change-Id: I33e89dd865a38b526a1f766cf321a6c67a170a36 Ricardo Wurmus 2024-04-22gnu: Add python-spatial-image....* gnu/packages/image-processing.scm (python-spatial-image): New variable. Change-Id: I0e2bbfb94499aca71b33703153ad408530b60658 Ricardo Wurmus 2024-04-06gnu: opencolorio: Update to 2.3.2....* gnu/packages/image-processing.scm (opencolorio): Update to 2.3.2. [source]: Remove snippet. [arguments]: Use G-Expressions. <#:configure-flags>: Unset "-DCMAKE-CXX_FLAGS", "-DOCIO_BUILD_STATIC", "-DUSE_EXTERNAL_TINXML", "-DUSE_EXTERNAL_LCMS". Pass "-DCIO_BUILD_GPU_TESTS=false". <#:phases>: Delete the patch-test-suite phase. [native-inputs]: Remove git, pkg-config. Add openimageio, pybind11-2.10, python-wrapper. [inputs]: Remove openexr-2, tinyxml. Add expat, freeglut, glew, imath, libglvnd, minizip-ng, openexr, pystring, yaml-cpp, zlib. [license]: Simplify. * gnu/packages/patches/opencolorio-fix-build-with-gcc11.patch: Delete patch. * gnu/local.mk (dist_patch_DATA): Unregister it. Change-Id: Iafd87762df81d0f5c23089251b4241a57d414dc4 Vinicius Monego 2024-03-27gnu: insight-toolkit: Build and install Python bindings....* gnu/packages/image-processing.scm (insight-toolkit)[outputs]: Add "python" output. [arguments]: Add configure flags to build Python bindings; add phase 'ignore-warnings. [native-inputs]: Add castxml, swig, and which. (insight-toolkit-4)[outputs]: Override. [native-inputs]: Override. Change-Id: I4177d0c0239027290678a43f2ea26cb8e1e74918 Ricardo Wurmus 2024-03-25gnu: opencv: Update to 4.9.0....* gnu/packages/image-processing.scm (opencv): Update to 4.9.0. [source]: Remove non-existent "libtengine" from 3rdParty drectory list to be deleted. Change-Id: I982256730e33b418491ba2b9238c0e532cb9a7a9 Signed-off-by: Christopher Baines <mail@cbaines.net> Andy Tai 2024-03-23gnu: gmic: Update to 3.3.5....* gnu/packages/image-processing.scm (gmic): Update to 3.3.5. Change-Id: I5e5ced3044ff92bbf66bc4dde5506fac1b883f0b Vinicius Monego 2024-02-13gnu: opencv: Update to 4.8.1....* gnu/packages/image-processing.scm (opencv): Update to 4.8.1. Change-Id: Ia493896c063b32c5b42cdfee5e8e921dc957ff71 Signed-off-by: Christopher Baines <mail@cbaines.net> Andy Tai 2024-02-09gnu: vxl: Update to 3.5.0....* gnu/packages/image-processing.scm (vxl): Update to 3.5.0. Change-Id: I90eeb3659b0b208591e7eb6b2bfa19f28cb39a6f Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com> Felix Gruber