Skip to content

Commit

Permalink
feat(checker): New checker request - GNU emacs (#2941)
Browse files Browse the repository at this point in the history
* feat(checker): New checker request - GNU emacs

* feat(checker): New checker request - GNU emacs
* closes #2921

Signed-off-by: Bartlomiej Cieszkowski <bartlomiej.cieszkowski@intel.com>
Signed-off-by: Przemyslaw Romaniak <przemyslaw.romaniak@intel.com>

* feat(checker): update test/test_data/emacs.py

workaround for false detection

Co-authored-by: Terri Oda <terri.oda@intel.com>
Signed-off-by: Bartlomiej Cieszkowski <bartlomiej.cieszkowski@intel.com>

* fix: remove libtiff, pango as checkers have been improved.

---------

Signed-off-by: Bartlomiej Cieszkowski <bartlomiej.cieszkowski@intel.com>
Signed-off-by: Przemyslaw Romaniak <przemyslaw.romaniak@intel.com>
Co-authored-by: Terri Oda <terri.oda@intel.com>
  • Loading branch information
bcieszko and terriko committed May 22, 2023
1 parent b0e5f67 commit f008d77
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions cve_bin_tool/checkers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"e2fsprogs",
"elfutils",
"enscript",
"emacs",
"exim",
"exiv2",
"expat",
Expand Down
27 changes: 27 additions & 0 deletions cve_bin_tool/checkers/emacs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: GPL-3.0-or-later


"""
CVE checker for emacs
https://www.cvedetails.com/vulnerability-list/vendor_id-72/product_id-741/GNU-Emacs.html
"""
from cve_bin_tool.checkers import Checker


class EmacsChecker(Checker):
CONTAINS_PATTERNS = [
r"Bare Emacs (standard Lisp code not loaded)",
r"Run M-x info RET m emacs RET m emacs invocation RET inside Emacs to",
# Alternate optional contains patterns,
# see https://github.com/intel/cve-bin-tool/tree/main/cve_bin_tool/checkers#helper-script for more details
# r"Run Emacs, the extensible, customizable, self-documenting real-time",
]
FILENAME_PATTERNS = [r"emacs"]
VERSION_PATTERNS = [
r"Id: GNU Emacs ([0-9]+\.[0-9]+)"
] # this version string is extracted from "$Id: GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.14) of 2020-03-26, modified by Debian $"

VENDOR_PRODUCT = [("gnu", "emacs")]
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions test/test_checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ def setup_class(cls):
("bzip2", "bzip2.so", ["bzip2"]),
("cups", "cupsd.so", ["cups"]),
("curl", "libcurl.so.4", ["curl"]),
("emacs", "emacs", ["emacs"]),
("emacs", "emacs-nox", ["emacs"]),
("emacs", "emacs-gtk", ["emacs"]),
("expat", "libexpat.so", ["expat"]),
("ffmpeg", "libffmpeg.so", ["ffmpeg"]),
("gnutls_cli", "libgnutls.so", ["gnutls-cli"]),
Expand Down
34 changes: 34 additions & 0 deletions test/test_data/emacs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: GPL-3.0-or-later

mapping_test_data = [
{
"product": "emacs",
"version": "28.2",
"version_strings": [r"$Id: GNU Emacs 28.2"],
},
{
"product": "emacs",
"version": "25.2",
"version_strings": [r"$Id: GNU Emacs 25.2"],
},
{
"product": "emacs",
"version": "26.1",
"version_strings": [r"$Id: GNU Emacs 26.1"],
},
]
package_test_data = [
{
"url": "http://ports.ubuntu.com/pool/main/e/emacs25/",
"package_name": "emacs25_25.2+1-6_arm64.deb",
"product": "emacs",
"version": "25.2",
},
{
"url": "http://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/",
"package_name": "emacs-26.1-7.el8.x86_64.rpm",
"product": "emacs",
"version": "26.1",
},
]

0 comments on commit f008d77

Please sign in to comment.