Skip to content

Commit

Permalink
feat(checker): add ghostscript checker (intel#4379)
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrice Fontaine <[email protected]>
  • Loading branch information
ffontaine authored Aug 23, 2024
1 parent fa6da29 commit 153ab71
Show file tree
Hide file tree
Showing 5 changed files with 55 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 @@ -107,6 +107,7 @@
"gdal",
"gdb",
"gdk_pixbuf",
"ghostscript",
"gimp",
"git",
"gmp",
Expand Down
24 changes: 24 additions & 0 deletions cve_bin_tool/checkers/ghostscript.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (C) 2024 Orange
# SPDX-License-Identifier: GPL-3.0-or-later


"""
CVE checker for ghostscript
https://www.cvedetails.com/product/12939/Ghostscript-Ghostscript.html?vendor_id=7640
https://www.cvedetails.com/product/36469/Artifex-Ghostscript.html?vendor_id=10846
"""
from __future__ import annotations

from cve_bin_tool.checkers import Checker


class GhostscriptChecker(Checker):
CONTAINS_PATTERNS: list[str] = []
FILENAME_PATTERNS: list[str] = []
VERSION_PATTERNS = [
r"ghostscript/([0-9]+\.[0-9]+)",
r"([0-9]+\.[0-9]+\.[0-9]+)\r?\n[a-z:/]*ghostscript",
]
VENDOR_PRODUCT = [("artifex", "ghostscript"), ("ghostscript", "ghostscript")]
Binary file not shown.
Binary file not shown.
30 changes: 30 additions & 0 deletions test/test_data/ghostscript.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (C) 2024 Orange
# SPDX-License-Identifier: GPL-3.0-or-later

mapping_test_data = [
{
"product": "ghostscript",
"version": "9.27",
"version_strings": ["ghostscript/9.27"],
},
{
"product": "ghostscript",
"version": "10.03.1",
"version_strings": ["10.03.1\nghostscript"],
},
]
package_test_data = [
{
"url": "http://ftp.fr.debian.org/debian/pool/main/g/ghostscript/",
"package_name": "libgs9_9.27~dfsg-2+deb10u5_amd64.deb",
"product": "ghostscript",
"version": "9.27",
},
{
"url": "https://eu.mirror.archlinuxarm.org/aarch64/extra/",
"package_name": "ghostscript-10.03.1-1-aarch64.pkg.tar.xz",
"product": "ghostscript",
"version": "10.03.1",
"other_products": ["gcc"],
},
]

0 comments on commit 153ab71

Please sign in to comment.