Skip to content

feat(checker): add dcmtk checker #5160

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 @@ -77,6 +77,7 @@
"darkhttpd",
"dav1d",
"davfs2",
"dcmtk",
"dbus",
"debianutils",
"dhclient",
Expand Down
20 changes: 20 additions & 0 deletions cve_bin_tool/checkers/dcmtk.py

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This regex is only going to pick up the pattern for the .rpm, it's not going to pick up debian packages which have been included. I think changing it from dcmtk-([0-9]+.[0-9]+.[0-9]+) to dcmtk(_|-)([0-9]+.[0-9]+.[0-9]+) and it should work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original regex is working perfectly fine on debian and rpm packages (i.e. LONG_TESTS=1 pytest -k dcmtk -v returns PASSED from the 3 test cases)
Moreover, there is not a single occurrence of dcmtk_ in debian package (tested by running zgrep -a dcmtk- ./test/condensed-downloads/dcmtk_3.6.4-2.1_amd64.deb.tar.gz)

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (C) 2025 Orange
# SPDX-License-Identifier: GPL-3.0-or-later


"""
CVE checker for dcmtk
https://www.cvedetails.com/product/27867/Offis-Dcmtk.html?vendor_id=13397
"""
from __future__ import annotations

from cve_bin_tool.checkers import Checker


class DcmtkChecker(Checker):
CONTAINS_PATTERNS: list[str] = []
FILENAME_PATTERNS: list[str] = []
VERSION_PATTERNS = [r"dcmtk-([0-9]+\.[0-9]+\.[0-9]+)"]
VENDOR_PRODUCT = [("offis", "dcmtk")]
Binary file not shown.
Binary file not shown.
21 changes: 21 additions & 0 deletions test/test_data/dcmtk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (C) 2025 Orange
# SPDX-License-Identifier: GPL-3.0-or-later

mapping_test_data = [
{"product": "dcmtk", "version": "3.6.4", "version_strings": ["dcmtk-3.6.4"]}
]
package_test_data = [
{
"url": "http://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/aarch64/os/Packages/d/",
"package_name": "dcmtk-3.6.9-2.fc43.aarch64.rpm",
"product": "dcmtk",
"version": "3.6.9",
"other_products": ["libjpeg"],
},
{
"url": "http://ftp.debian.org/debian/pool/main/d/dcmtk/",
"package_name": "dcmtk_3.6.4-2.1_amd64.deb",
"product": "dcmtk",
"version": "3.6.4",
},
]
Loading