Skip to content

Commit 96f98b3

Browse files
b31ngd3vterriko
andauthored
feat(checker): add Apache commons-compress checker (#1040) (#1666)
* feat(checker): add Apache commons-compress checker * fix: version signature of commons_compress Co-authored-by: Terri Oda <[email protected]>
1 parent 4d0eea2 commit 96f98b3

File tree

8 files changed

+92
-34
lines changed

8 files changed

+92
-34
lines changed

.github/actions/spelling/allow.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ cleartext
5858
clnt
5959
cmdline
6060
codecov
61+
commons
62+
compress
6163
conda
6264
config
6365
conventionalcommits

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -244,24 +244,24 @@ The following checkers are available for finding components in binary files:
244244

245245
<!--CHECKERS TABLE BEGIN-->
246246
| | | | Available checkers | | | |
247-
|--------------- |--------- |---------- |--------------- |------------ |--------------- |------------- |
247+
|--------------- |------------- |---------------- |---------- |--------------- |------------ |--------------- |
248248
| accountsservice |avahi |bash |bind |binutils |bolt |bubblewrap |
249-
| busybox |bzip2 |cronie |cryptsetup |cups |curl |dbus |
250-
| dnsmasq |dovecot |dpkg |enscript |expat |ffmpeg |freeradius |
251-
| ftp |gcc |gimp |glibc |gnomeshell |gnupg |gnutls |
252-
| gpgme |gstreamer |gupnp |haproxy |hdf5 |hostapd |hunspell |
253-
| icecast |icu |irssi |jacksondatabind |kbd |kerberos |kexectools |
254-
| libarchive |libbpg |libdb |libebml |libgcrypt |libical |libjpeg_turbo |
255-
| liblas |libnss |librsvg |libseccomp |libsndfile |libsolv |libsoup |
256-
| libsrtp |libssh2 |libtiff |libvirt |libvncserver |libxslt |lighttpd |
257-
| logrotate |lua |mariadb |mdadm |memcached |mtr |mysql |
258-
| nano |ncurses |nessus |netpbm |nginx |node |ntp |
259-
| open_vm_tools |openafs |openjpeg |openldap |openssh |openssl |openswan |
260-
| openvpn |p7zip |pcsc_lite |pigz |png |polarssl_fedora |poppler |
261-
| postgresql |pspp |python |qt |radare2 |rsyslog |samba |
262-
| sane_backends |sqlite |strongswan |subversion |sudo |syslogng |systemd |
263-
| tcpdump |trousers |varnish |webkitgtk |wireshark |wpa_supplicant |xerces |
264-
| xml2 |zlib |zsh | | | | |
249+
| busybox |bzip2 |commons_compress |cronie |cryptsetup |cups |curl |
250+
| dbus |dnsmasq |dovecot |dpkg |enscript |expat |ffmpeg |
251+
| freeradius |ftp |gcc |gimp |glibc |gnomeshell |gnupg |
252+
| gnutls |gpgme |gstreamer |gupnp |haproxy |hdf5 |hostapd |
253+
| hunspell |icecast |icu |irssi |jacksondatabind |kbd |kerberos |
254+
| kexectools |libarchive |libbpg |libdb |libebml |libgcrypt |libical |
255+
| libjpeg_turbo |liblas |libnss |librsvg |libseccomp |libsndfile |libsolv |
256+
| libsoup |libsrtp |libssh2 |libtiff |libvirt |libvncserver |libxslt |
257+
| lighttpd |logrotate |lua |mariadb |mdadm |memcached |mtr |
258+
| mysql |nano |ncurses |nessus |netpbm |nginx |node |
259+
| ntp |open_vm_tools |openafs |openjpeg |openldap |openssh |openssl |
260+
| openswan |openvpn |p7zip |pcsc_lite |pigz |png |polarssl_fedora |
261+
| poppler |postgresql |pspp |python |qt |radare2 |rsyslog |
262+
| samba |sane_backends |sqlite |strongswan |subversion |sudo |syslogng |
263+
| systemd |tcpdump |trousers |varnish |webkitgtk |wireshark |wpa_supplicant |
264+
| xerces |xml2 |zlib |zsh | | | |
265265
<!--CHECKERS TABLE END-->
266266

267267
All the checkers can be found in the checkers directory, as can the

cve_bin_tool/checkers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"bubblewrap",
2121
"busybox",
2222
"bzip2",
23+
"commons_compress",
2324
"cronie",
2425
"cryptsetup",
2526
"cups",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (C) 2022 Intel Corporation
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
5+
"""
6+
CVE checker for Apache commons-compress:
7+
8+
https://www.cvedetails.com/vulnerability-list/vendor_id-45/product_id-59066/Apache-Commons-Compress.html
9+
"""
10+
from cve_bin_tool.checkers import Checker
11+
12+
13+
class CommonsCompressChecker(Checker):
14+
CONTAINS_PATTERNS = [
15+
r"Apache Commons Compress software defines an API for working with",
16+
r"<url>http://commons.apache.org/proper/commons-compress/</url>",
17+
]
18+
FILENAME_PATTERNS = [r"commons-compress(-[0-9]+\.[0-9]+(\.[0-9]+)?)?.jar"]
19+
VERSION_PATTERNS = [
20+
r"<artifactId>commons-compress</artifactId>\r?\n <version>([0-9]+\.[0-9]+(\.[0-9]+)?)</version>"
21+
]
22+
VENDOR_PRODUCT = [("apache", "commons_compress")]

doc/MANUAL.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -128,24 +128,24 @@ which is useful if you're trying the latest code from
128128

129129
<!--CHECKERS TABLE BEGIN-->
130130
| | | | Available checkers | | | |
131-
|--------------- |--------- |---------- |--------------- |------------ |--------------- |------------- |
131+
|--------------- |------------- |---------------- |---------- |--------------- |------------ |--------------- |
132132
| accountsservice |avahi |bash |bind |binutils |bolt |bubblewrap |
133-
| busybox |bzip2 |cronie |cryptsetup |cups |curl |dbus |
134-
| dnsmasq |dovecot |dpkg |enscript |expat |ffmpeg |freeradius |
135-
| ftp |gcc |gimp |glibc |gnomeshell |gnupg |gnutls |
136-
| gpgme |gstreamer |gupnp |haproxy |hdf5 |hostapd |hunspell |
137-
| icecast |icu |irssi |jacksondatabind |kbd |kerberos |kexectools |
138-
| libarchive |libbpg |libdb |libebml |libgcrypt |libical |libjpeg_turbo |
139-
| liblas |libnss |librsvg |libseccomp |libsndfile |libsolv |libsoup |
140-
| libsrtp |libssh2 |libtiff |libvirt |libvncserver |libxslt |lighttpd |
141-
| logrotate |lua |mariadb |mdadm |memcached |mtr |mysql |
142-
| nano |ncurses |nessus |netpbm |nginx |node |ntp |
143-
| open_vm_tools |openafs |openjpeg |openldap |openssh |openssl |openswan |
144-
| openvpn |p7zip |pcsc_lite |pigz |png |polarssl_fedora |poppler |
145-
| postgresql |pspp |python |qt |radare2 |rsyslog |samba |
146-
| sane_backends |sqlite |strongswan |subversion |sudo |syslogng |systemd |
147-
| tcpdump |trousers |varnish |webkitgtk |wireshark |wpa_supplicant |xerces |
148-
| xml2 |zlib |zsh | | | | |
133+
| busybox |bzip2 |commons_compress |cronie |cryptsetup |cups |curl |
134+
| dbus |dnsmasq |dovecot |dpkg |enscript |expat |ffmpeg |
135+
| freeradius |ftp |gcc |gimp |glibc |gnomeshell |gnupg |
136+
| gnutls |gpgme |gstreamer |gupnp |haproxy |hdf5 |hostapd |
137+
| hunspell |icecast |icu |irssi |jacksondatabind |kbd |kerberos |
138+
| kexectools |libarchive |libbpg |libdb |libebml |libgcrypt |libical |
139+
| libjpeg_turbo |liblas |libnss |librsvg |libseccomp |libsndfile |libsolv |
140+
| libsoup |libsrtp |libssh2 |libtiff |libvirt |libvncserver |libxslt |
141+
| lighttpd |logrotate |lua |mariadb |mdadm |memcached |mtr |
142+
| mysql |nano |ncurses |nessus |netpbm |nginx |node |
143+
| ntp |open_vm_tools |openafs |openjpeg |openldap |openssh |openssl |
144+
| openswan |openvpn |p7zip |pcsc_lite |pigz |png |polarssl_fedora |
145+
| poppler |postgresql |pspp |python |qt |radare2 |rsyslog |
146+
| samba |sane_backends |sqlite |strongswan |subversion |sudo |syslogng |
147+
| systemd |tcpdump |trousers |varnish |webkitgtk |wireshark |wpa_supplicant |
148+
| xerces |xml2 |zlib |zsh | | | |
149149
<!--CHECKERS TABLE END-->
150150

151151
For a quick overview of usage and how it works, you can also see [the readme file](README.md).
Binary file not shown.
Binary file not shown.

test/test_data/commons_compress.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (C) 2022 Intel Corporation
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
mapping_test_data = [
5+
{
6+
"product": "commons_compress",
7+
"version": "1.18",
8+
"version_strings": [
9+
"<artifactId>commons-compress</artifactId>\r\n <version>1.18</version>"
10+
],
11+
},
12+
{
13+
"product": "commons_compress",
14+
"version": "1.15.1",
15+
"version_strings": [
16+
"<artifactId>commons-compress</artifactId>\r\n <version>1.15.1</version>"
17+
],
18+
},
19+
]
20+
package_test_data = [
21+
{
22+
"url": "https://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.16.1/",
23+
"package_name": "commons-compress-1.16.1.jar",
24+
"product": "commons_compress",
25+
"version": "1.16.1",
26+
},
27+
{
28+
"url": "http://rpmfind.net/linux/fedora/linux/releases/35/Everything/x86_64/os/Packages/a/",
29+
"package_name": "apache-commons-compress-1.21-1.fc35.noarch.rpm",
30+
"product": "commons_compress",
31+
"version": "1.21",
32+
},
33+
]

0 commit comments

Comments
 (0)