Skip to content

Commit

Permalink
feat(checker): New checker request - GNU emacs
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
bcieszko committed Apr 27, 2023
1 parent 95a48fd commit 0ed74b8
Show file tree
Hide file tree
Showing 6 changed files with 71 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 @@ -63,6 +63,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 @@ -63,6 +63,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
40 changes: 40 additions & 0 deletions test/test_data/emacs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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 0ed74b8

Please sign in to comment.