Skip to content

Commit d59a8d1

Browse files
authored
feat(checker): add ruby checker (#4858)
Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent a9b1eea commit d59a8d1

7 files changed

+54
-0
lines changed

cve_bin_tool/checkers/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@
339339
"rtmpdump",
340340
"rsync",
341341
"rsyslog",
342+
"ruby",
342343
"runc",
343344
"rust",
344345
"samba",

cve_bin_tool/checkers/ruby.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (C) 2025 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
5+
"""
6+
CVE checker for ruby
7+
8+
https://www.cvedetails.com/product/12215/Ruby-lang-Ruby.html?vendor_id=7252
9+
10+
"""
11+
from __future__ import annotations
12+
13+
from cve_bin_tool.checkers import Checker
14+
15+
16+
class RubyChecker(Checker):
17+
CONTAINS_PATTERNS: list[str] = []
18+
FILENAME_PATTERNS: list[str] = []
19+
VERSION_PATTERNS = [r"ruby ([0-9]+\.[0-9]+\.[0-9]+)"]
20+
VENDOR_PRODUCT = [("ruby-lang", "ruby")]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

test/test_data/ruby.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (C) 2025 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
mapping_test_data = [
5+
{"product": "ruby", "version": "2.6.8", "version_strings": ["ruby 2.6.8"]}
6+
]
7+
package_test_data = [
8+
{
9+
"url": "http://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/aarch64/os/Packages/r/",
10+
"package_name": "ruby-libs-3.4.2-23.fc43.aarch64.rpm",
11+
"product": "ruby",
12+
"version": "3.4.2",
13+
"other_products": ["rust"],
14+
},
15+
{
16+
"url": "http://ftp.debian.org/debian/pool/main/r/ruby2.5/",
17+
"package_name": "libruby2.5_2.5.5-3+deb10u4_amd64.deb",
18+
"product": "ruby",
19+
"version": "2.5.5",
20+
},
21+
{
22+
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",
23+
"package_name": "libruby2.6_2.6.10-1_x86_64.ipk",
24+
"product": "ruby",
25+
"version": "2.6.10",
26+
},
27+
{
28+
"url": "https://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/",
29+
"package_name": "ruby-libs-2.6.8-r0.apk",
30+
"product": "ruby",
31+
"version": "2.6.8",
32+
},
33+
]

0 commit comments

Comments
 (0)