Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(checker): new vim checker> #2958

Merged
merged 1 commit into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cve_bin_tool/checkers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@
"varnish",
"vorbis_tools",
"vsftpd",
"vim",
"webkitgtk",
"wget",
"wireshark",
Expand Down
26 changes: 26 additions & 0 deletions cve_bin_tool/checkers/vim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: GPL-3.0-or-later


"""
CVE checker for vim:

https://www.cvedetails.com/vulnerability-list/vendor_id-8218/product_id-14270/Vim-Vim.html

"""

from cve_bin_tool.checkers import Checker


class VimChecker(Checker):
CONTAINS_PATTERNS = [
r"# This viminfo file was generated by Vim %s.",
r"-u <vimrc> Use <vimrc> instead of any .vimrc",
r"- append vim.VIM_SPECIAL_PATH to sys.path",
]
FILENAME_PATTERNS = [r"vim"]
VERSION_PATTERNS = [
r"vim-([0-9]+\.[0-9]+\.[0-9]{4})",
r"VIM - Vi IMproved ([0-9]\.[0-9] (?:\([1-9]\d{3,} [A-Z][a-z]{2} [0-9]{1,2}\))?)",
]
VENDOR_PRODUCT = [("vim", "vim")]
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions test/test_checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ def setup_class(cls):
("syslogng", "syslog-ng.so", ["syslog-ng"]),
("systemd", "libsystemd.so.0", ["systemd"]),
("varnish", "varnish", ["varnish"]),
("vim", "vim", ["vim"]),
("vim", "vim-enhanced", ["vim"]),
("wireshark", "rawshark", ["wireshark"]),
("xerces", "libxerces-c.so", ["xerces"]),
("xml2", "libxml2.so.0", ["xml2"]),
Expand Down
44 changes: 44 additions & 0 deletions test/test_data/vim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: GPL-3.0-or-later

mapping_test_data = [
{
"product": "vim",
"version": "9.0.1429",
"version_strings": ["vim-9.0.1429"],
},
{
"product": "vim",
"version": "8.2.2434",
"version_strings": ["vim-8.2.2434"],
},
{
"product": "vim",
"version": "8.1.2269",
"version_strings": [
"vim-8.1.2269",
"E136: viminfo: Too many errors, skipping rest of file",
],
},
]
package_test_data = [
{
"url": "https://dl.fedoraproject.org/pub/fedora/linux/releases/38/Everything/aarch64/os/Packages/v/",
"package_name": "vim-enhanced-9.0.1429-1.fc38.aarch64.rpm",
"product": "vim",
"version": "9.0.1429",
"other_products": ["lua"],
},
{
"url": "http://ftp.de.debian.org/debian/pool/main/v/vim/",
"package_name": "vim_8.2.2434-3+deb11u1_amd64.deb",
"product": "vim",
"version": "8.2.2434",
},
{
"url": "http://archive.ubuntu.com/ubuntu/pool/main/v/vim/",
"package_name": "vim_8.1.2269-1ubuntu5_amd64.deb",
"product": "vim",
"version": "8.1.2269",
},
]