Skip to content

Commit

Permalink
feat(checker): add apr checker
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrice Fontaine <[email protected]>
  • Loading branch information
ffontaine committed Jan 29, 2025
1 parent 3029cb0 commit b42754a
Show file tree
Hide file tree
Showing 7 changed files with 60 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 @@ -28,6 +28,7 @@
"apache_http_server",
"apcupsd",
"apparmor",
"apr",
"asn1c",
"assimp",
"asterisk",
Expand Down
23 changes: 23 additions & 0 deletions cve_bin_tool/checkers/apr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (C) 2025 Orange
# SPDX-License-Identifier: GPL-3.0-or-later


"""
CVE checker for apr
https://www.cvedetails.com/product/17804/Apache-Portable-Runtime.html?vendor_id=45
"""
from __future__ import annotations

from cve_bin_tool.checkers import Checker


class AprChecker(Checker):
CONTAINS_PATTERNS: list[str] = []
FILENAME_PATTERNS: list[str] = []
VERSION_PATTERNS = [
r"apr_initialize\r?\n([0-9]+\.[0-9]+\.[0-9]+)",
r"([0-9]+\.[0-9]+\.[0-9]+)\r?\n/tmp/apr",
]
VENDOR_PRODUCT = [("apache", "portable_runtime")]
Binary file added test/condensed-downloads/apr-1.7.0-r0.apk.tar.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
36 changes: 36 additions & 0 deletions test/test_data/apr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (C) 2025 Orange
# SPDX-License-Identifier: GPL-3.0-or-later

mapping_test_data = [
{
"product": "portable_runtime",
"version": "1.6.5",
"version_strings": ["apr_initialize\n1.6.5"],
}
]
package_test_data = [
{
"url": "http://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/aarch64/os/Packages/a/",
"package_name": "apr-1.7.5-2.fc42.aarch64.rpm",
"product": "portable_runtime",
"version": "1.7.5",
},
{
"url": "http://ftp.debian.org/debian/pool/main/a/apr/",
"package_name": "libapr1_1.6.5-1+b1_amd64.deb",
"product": "portable_runtime",
"version": "1.6.5",
},
{
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",
"package_name": "libapr_1.7.0-2_x86_64.ipk",
"product": "portable_runtime",
"version": "1.7.0",
},
{
"url": "https://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/",
"package_name": "apr-1.7.0-r0.apk",
"product": "portable_runtime",
"version": "1.7.0",
},
]

0 comments on commit b42754a

Please sign in to comment.