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")
opy-basebrowser-locales’, ‘copy-torbrowser-locales’ and ‘build-locales’ phases. Change-Id: Ia5b28fa5d885f24140893dc270e57e83b0250c67 Clément Lassieur 2024-01-19gnu: torbrowser: Remove useless inputs....One should never change assets, so no point being an input. * gnu/packages/tor.scm (torbrowser)[arguments]: In the ‘deploy-assets’ phase, directly refer to ‘torbrowser-assets’. [inputs]: Remove ‘torbrowser-assets’ and ‘bash-minimal’. Change-Id: I096f430e8277021462afffa65983ed2a8af08ed2 Clément Lassieur 2024-01-12gnu: torbrowser: Add bridges....* gnu/packages/tor.scm (torbrowser)[arguments]: Add an 'add-bridges' phase, update the 'deploy-assets' phase so to fix the lyrebird path. [inputs]: Add go-gitlab-torproject-org-tpo-anti-censorship-pluggable-transports-lyrebird. Change-Id: I17c85486ab44178be9eab31a078f6392857a044f Clément Lassieur 2023-12-28gnu: torbrowser: Change version to 13.0.8....* gnu/packages/tor.scm (%torbrowser-version): New variable. (%torbrowser-firefox-version): New variable. (torbrowser-assets)[version]: Use %torbrowser-version. (torbrowser)[version]: Use %torbrowser-version. [source]: Use %torbrowser-firefox-version. [arguments]: Use the package version. Change-Id: I4d262e0a9528ff515da89c31589d88201dcdf941 Clément Lassieur 2023-12-27gnu: Add torbrowser....* gnu/packages/tor.scm (torbrowser): New variable. (torbrowser-assets): New variable. * gnu/packages/browser-extensions.scm (noscript): New variable. (noscript/icecat): New variable. Co-authored-by: André Batista <nandre@riseup.net> Change-Id: I73dc53905e4a028108bb34aae07e44256cf16c85 Clément Lassieur 2023-12-10gnu: tor: Update to 0.4.8.10....* gnu/packages/tor.scm (tor): Update to 0.4.8.10. Change-Id: Ibc11c83c3fea920c6b876a22cb4c96d5c927beb5 Efraim Flashner 2023-11-15gnu: tor: Update to 0.4.8.9 [security fixes]....* gnu/packages/tor.scm (tor): Update to 0.4.8.9. This release fixes two high severity security vulnerabilities. The first one affects client connections to Guard relays and the other one affects Onion Services (TROVE-2023-006). See https://gitlab.torproject.org/tpo/core/tor/-/issues/40876 and https://gitlab.torproject.org/tpo/core/tor/-/issues/40883 Signed-off-by: Ludovic Courtès <ludo@gnu.org> André Batista 2023-11-09gnu: tor: Update to 0.4.8.8 [fixes TROVE-2023-004]....* gnu/packages/tor.scm (tor): Update to 0.4.8.8. Fixes TROVE-2023-004 which affects tor relays. See https://gitlab.torproject.org/tpo/core/tor/-/issues/40880 Signed-off-by: Efraim Flashner <efraim@flashner.co.il> André Batista 2023-10-24gnu: tor: Update to 0.4.8.7....* gnu/packages/tor.scm (tor): Update to 0.4.8.7. Signed-off-by: Ludovic Courtès <ludo@gnu.org> André Batista