Skip to content

Commit

Permalink
Refactor sort and version_class functions and add tests #1287
Browse files Browse the repository at this point in the history
Reference: #1287
Signed-off-by: John M. Horan <johnmhoran@gmail.com>
  • Loading branch information
johnmhoran committed Aug 12, 2024
1 parent 8333952 commit 7e740a6
Show file tree
Hide file tree
Showing 5 changed files with 426 additions and 31 deletions.
103 changes: 103 additions & 0 deletions vulnerabilities/tests/test_data/package_sort/input_purls.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
pkg:alpm/arch/containers-common@1:0.47.4-4?arch=x86_64
pkg:alpm/arch/pacman@6.0.1-1?arch=x86_64
pkg:alpm/arch/python-pip@21.0-1?arch=any
pkg:cargo/clap@3.0.0
pkg:cargo/clap@3.0.1
pkg:cargo/clap@3.0.10
pkg:cargo/clap@3.0.11
pkg:cargo/clap@3.0.2
pkg:cargo/clap@3.0.20
pkg:cargo/rand@0.7.2
pkg:cargo/structopt@0.3.11
pkg:composer/bk2k/bootstrap-package@11.0.2
pkg:composer/bk2k/bootstrap-package@11.0.3
pkg:composer/bk2k/bootstrap-package@7.1.0
pkg:composer/bk2k/bootstrap-package@7.1.1
pkg:composer/bk2k/bootstrap-package@7.1.2
pkg:conan/capnproto@0.15.0
pkg:conan/capnproto@0.15.2
pkg:conan/capnproto@0.7.0
pkg:conan/capnproto@0.8.0
pkg:deb/debian/jackson-databind@2.12.1-1%2Bdeb11u1
pkg:deb/debian/jackson-databind@2.12.1-1%2Bdeb11u1?distro=sid
pkg:deb/debian/jackson-databind@2.13.2.2-1?distro=sid
pkg:deb/debian/jackson-databind@2.13.2.2-1?distro=stretch
pkg:deb/debian/jackson-databind@2.14.0-1?distro=sid
pkg:deb/debian/jackson-databind@2.8.6-1%2Bdeb9u10?distro=stretch
pkg:deb/debian/jackson-databind@2.8.6-1%2Bdeb9u7?distro=stretch
pkg:deb/debian/jackson-databind@2.9.8-3%2Bdeb10u4?distro=sid
pkg:deb/ubuntu/dpkg@1.13.11ubuntu7.2
pkg:deb/ubuntu/dpkg@1.13.11ubuntu7~proposed
pkg:deb/ubuntu/dpkg@1.13.21ubuntu1
pkg:deb/ubuntu/dpkg@1.14.5ubuntu11
pkg:deb/ubuntu/dpkg@1.14.5ubuntu12
pkg:deb/ubuntu/dpkg@1.14.5ubuntu2
pkg:deb/ubuntu/dpkg@1.14.5ubuntu3
pkg:gem/actionpack@3.1.1
pkg:gem/actionpack@3.1.10
pkg:gem/actionpack@3.1.11
pkg:gem/actionpack@3.1.2
pkg:gem/webbynode@1.0.5.beta10
pkg:gem/webbynode@1.0.5.beta2
pkg:gem/webbynode@1.0.5.beta3
pkg:generic/postgresql@10.19.0
pkg:generic/postgresql@10.2.0
pkg:generic/postgresql@10.21.0
pkg:generic/postgresql@10.22.0
pkg:generic/postgresql@10.3.0
pkg:generic/postgresql@10.4.0
pkg:github/istio/istio@0.2.0
pkg:github/istio/istio@0.2.1
pkg:github/istio/istio@0.2.10
pkg:github/istio/istio@0.2.11
pkg:github/istio/istio@0.2.12
pkg:github/istio/istio@0.2.2
pkg:golang/github.com/1Panel-dev/1Panel@1.10.1-lts
pkg:golang/github.com/1Panel-dev/1Panel@1.10.3
pkg:golang/github.com/1Panel-dev/1Panel@1.10.3-lts
pkg:golang/github.com/1Panel-dev/1Panel@1.3.6
pkg:golang/github.com/1Panel-dev/1Panel@1.4.3
pkg:hex/pow@1.0.15
pkg:hex/pow@1.0.16
pkg:hex/pow@1.0.2
pkg:hex/pow@1.0.3
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.1.1
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.10.0
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.12.6.1
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.13.2
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.13.2.1
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.2.1
pkg:maven/io.netty/netty-codec-dns@4.1.101.Final
pkg:maven/io.netty/netty-codec-dns@4.1.97.Final
pkg:maven/io.netty/netty-codec-http@4.1.101.Final
pkg:maven/io.netty/netty-codec-http@4.1.97.Final
pkg:maven/io.netty/netty-codec-http2@4.1.101.Final
pkg:maven/io.netty/netty-codec-http2@4.1.97.Final
pkg:npm/%40budibase/bbui@1.2.44-alpha.1
pkg:npm/%40budibase/bbui@1.2.44-alpha.10
pkg:npm/%40budibase/bbui@1.2.44-alpha.11
pkg:npm/%40budibase/bbui@1.2.44-alpha.2
pkg:npm/%40budibase/bbui@1.2.44-alpha.3
pkg:npm/bootstrap-select@1.13.5
pkg:npm/bootstrap-select@1.13.6
pkg:npm/bootstrap-select@1.6.2
pkg:npm/bootstrap-select@1.6.3
pkg:nuget/adplug@2.3.0-beta17
pkg:nuget/adplug@2.3.0-beta172
pkg:nuget/adplug@2.3.0-beta173
pkg:nuget/adplug@2.3.0-beta18
pkg:nuget/adplug@2.3.0-beta186
pkg:nuget/adplug@2.3.0-beta19
pkg:nuget/adplug@2.3.0-beta190
pkg:pypi/jinja2@2.1
pkg:pypi/jinja2@2.1.1
pkg:pypi/jinja2@2.10
pkg:pypi/jinja2@2.2
pkg:pypi/jinja2@2.2.1
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=11
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=12
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=13
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=2
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=5
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=7
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=9
132 changes: 132 additions & 0 deletions vulnerabilities/tests/test_data/package_sort/purls_with_excel_sort.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
pkg:alpm/arch/containers-common@1:0.47.4-4?arch=x86_64
pkg:alpm/arch/pacman@6.0.1-1?arch=x86_64
pkg:alpm/arch/python-pip@21.0-1?arch=any
pkg:apk/alpine/apk@2.12.9-r3?arch=x86
pkg:apk/alpine/curl@7.83.0-r0?arch=x86
pkg:bitbucket/birkenfeld/pygments-main@244fd47e07d1014f0aed9c
pkg:bitnami/wordpress?distro=debian-12
pkg:bitnami/wordpress@6.2.0?arch=arm64&distro=debian-12
pkg:bitnami/wordpress@6.2.0?arch=arm64&distro=photon-4
pkg:bitnami/wordpress@6.2.0?distro=debian-12
pkg:cargo/clap@3.0.0
pkg:cargo/clap@3.0.1
pkg:cargo/clap@3.0.10
pkg:cargo/clap@3.0.11
pkg:cargo/clap@3.0.2
pkg:cargo/clap@3.0.20
pkg:cargo/rand@0.7.2
pkg:cargo/structopt@0.3.11
pkg:cocoapods/AFNetworking@4.0.1
pkg:cocoapods/GoogleUtilities@7.5.2#NSData+zlib
pkg:cocoapods/MapsIndoors@3.24.0
pkg:cocoapods/ShareKit@2.0#Twitter
pkg:composer/bk2k/bootstrap-package@11.0.2
pkg:composer/bk2k/bootstrap-package@11.0.3
pkg:composer/bk2k/bootstrap-package@7.1.0
pkg:composer/bk2k/bootstrap-package@7.1.1
pkg:composer/bk2k/bootstrap-package@7.1.2
pkg:conan/capnproto@0.15.0
pkg:conan/capnproto@0.15.2
pkg:conan/capnproto@0.7.0
pkg:conan/capnproto@0.8.0
pkg:conda/absl-py@0.4.1?build=py36h06a4308_0&channel=main&subdir=linux-64&type=tar.bz2
pkg:conda/openssl@1.0.2l?channel=main&subdir=linux-64&build=h077ae2c_5&type=tar.bz2
pkg:cpan/DROLSKY/DateTime@1.55
pkg:cpan/DROLSKY/DateTime@1.56
pkg:cpan/DROLSKY/DateTime@1.57
pkg:cran/caret@6.0-88
pkg:cran/caret@6.0-89
pkg:cran/caret@6.0-90
pkg:deb/debian/jackson-databind@2.12.1-1%2Bdeb11u1
pkg:deb/debian/jackson-databind@2.12.1-1%2Bdeb11u1?distro=sid
pkg:deb/debian/jackson-databind@2.13.2.2-1?distro=sid
pkg:deb/debian/jackson-databind@2.13.2.2-1?distro=stretch
pkg:deb/debian/jackson-databind@2.14.0-1?distro=sid
pkg:deb/debian/jackson-databind@2.8.6-1%2Bdeb9u10?distro=stretch
pkg:deb/debian/jackson-databind@2.8.6-1%2Bdeb9u7?distro=stretch
pkg:deb/debian/jackson-databind@2.9.8-3%2Bdeb10u4?distro=sid
pkg:deb/ubuntu/dpkg@1.13.11ubuntu7.2
pkg:deb/ubuntu/dpkg@1.13.11ubuntu7~proposed
pkg:deb/ubuntu/dpkg@1.13.21ubuntu1
pkg:deb/ubuntu/dpkg@1.14.5ubuntu11
pkg:deb/ubuntu/dpkg@1.14.5ubuntu12
pkg:deb/ubuntu/dpkg@1.14.5ubuntu2
pkg:deb/ubuntu/dpkg@1.14.5ubuntu3
pkg:docker/cassandra@latest
pkg:docker/customer/dockerimage@sha256%3A244fd47e07d10?repository_url=gcr.io
pkg:docker/smartentry/debian@dc437cc87d10
pkg:gem/actionpack@3.1.1
pkg:gem/actionpack@3.1.10
pkg:gem/actionpack@3.1.11
pkg:gem/actionpack@3.1.2
pkg:gem/webbynode@1.0.5.beta10
pkg:gem/webbynode@1.0.5.beta2
pkg:gem/webbynode@1.0.5.beta3
pkg:generic/postgresql@10.19.0
pkg:generic/postgresql@10.2.0
pkg:generic/postgresql@10.21.0
pkg:generic/postgresql@10.22.0
pkg:generic/postgresql@10.3.0
pkg:generic/postgresql@10.4.0
pkg:github/istio/istio@0.2.0
pkg:github/istio/istio@0.2.1
pkg:github/istio/istio@0.2.10
pkg:github/istio/istio@0.2.11
pkg:github/istio/istio@0.2.12
pkg:github/istio/istio@0.2.2
pkg:golang/github.com/1Panel-dev/1Panel@1.10.1-lts
pkg:golang/github.com/1Panel-dev/1Panel@1.10.3
pkg:golang/github.com/1Panel-dev/1Panel@1.10.3-lts
pkg:golang/github.com/1Panel-dev/1Panel@1.3.6
pkg:golang/github.com/1Panel-dev/1Panel@1.4.3
pkg:hackage/Allure@0.11.0.0
pkg:hackage/Allure@0.9.5.0
pkg:hex/pow@1.0.15
pkg:hex/pow@1.0.16
pkg:hex/pow@1.0.2
pkg:hex/pow@1.0.3
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.1.1
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.10.0
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.12.6.1
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.13.2
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.13.2.1
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.2.1
pkg:maven/io.netty/netty-codec-dns@4.1.101.Final
pkg:maven/io.netty/netty-codec-dns@4.1.97.Final
pkg:maven/io.netty/netty-codec-http@4.1.101.Final
pkg:maven/io.netty/netty-codec-http@4.1.97.Final
pkg:maven/io.netty/netty-codec-http2@4.1.101.Final
pkg:maven/io.netty/netty-codec-http2@4.1.97.Final
pkg:npm/%40budibase/bbui@1.2.44-alpha.1
pkg:npm/%40budibase/bbui@1.2.44-alpha.10
pkg:npm/%40budibase/bbui@1.2.44-alpha.11
pkg:npm/%40budibase/bbui@1.2.44-alpha.2
pkg:npm/%40budibase/bbui@1.2.44-alpha.3
pkg:npm/bootstrap-select@1.13.5
pkg:npm/bootstrap-select@1.13.6
pkg:npm/bootstrap-select@1.6.2
pkg:npm/bootstrap-select@1.6.3
pkg:nuget/adplug@2.3.0-beta17
pkg:nuget/adplug@2.3.0-beta172
pkg:nuget/adplug@2.3.0-beta173
pkg:nuget/adplug@2.3.0-beta18
pkg:nuget/adplug@2.3.0-beta186
pkg:nuget/adplug@2.3.0-beta19
pkg:nuget/adplug@2.3.0-beta190
pkg:pypi/jinja2@2.1
pkg:pypi/jinja2@2.1.1
pkg:pypi/jinja2@2.10
pkg:pypi/jinja2@2.2
pkg:pypi/jinja2@2.2.1
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=11
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=12
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=13
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=2
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=5
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=7
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=9
pkg:swid/Acme/example.com/Enterprise+Server@1.0.0?tag_id=75b8c285-fa7b-485b-b199-4745e3004d0d
pkg:swid/Adobe+Systems+Incorporated/Adobe+InDesign@CC?tag_id=CreativeCloud-CS6-Win-GM-MUL
pkg:swid/Fedora@29?tag_id=org.fedoraproject.Fedora-29
pkg:swift/github.com/Alamofire/Alamofire@5.4.3
pkg:swift/github.com/RxSwiftCommunity/RxFlow@2.12.4
103 changes: 103 additions & 0 deletions vulnerabilities/tests/test_data/package_sort/sorted_purls.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
pkg:alpm/arch/containers-common@1:0.47.4-4?arch=x86_64
pkg:alpm/arch/pacman@6.0.1-1?arch=x86_64
pkg:alpm/arch/python-pip@21.0-1?arch=any
pkg:cargo/clap@3.0.0
pkg:cargo/clap@3.0.1
pkg:cargo/clap@3.0.2
pkg:cargo/clap@3.0.10
pkg:cargo/clap@3.0.11
pkg:cargo/clap@3.0.20
pkg:cargo/rand@0.7.2
pkg:cargo/structopt@0.3.11
pkg:composer/bk2k/bootstrap-package@7.1.0
pkg:composer/bk2k/bootstrap-package@7.1.1
pkg:composer/bk2k/bootstrap-package@7.1.2
pkg:composer/bk2k/bootstrap-package@11.0.2
pkg:composer/bk2k/bootstrap-package@11.0.3
pkg:conan/capnproto@0.7.0
pkg:conan/capnproto@0.8.0
pkg:conan/capnproto@0.15.0
pkg:conan/capnproto@0.15.2
pkg:deb/debian/jackson-databind@2.8.6-1%2Bdeb9u7?distro=stretch
pkg:deb/debian/jackson-databind@2.8.6-1%2Bdeb9u10?distro=stretch
pkg:deb/debian/jackson-databind@2.9.8-3%2Bdeb10u4?distro=sid
pkg:deb/debian/jackson-databind@2.12.1-1%2Bdeb11u1
pkg:deb/debian/jackson-databind@2.12.1-1%2Bdeb11u1?distro=sid
pkg:deb/debian/jackson-databind@2.13.2.2-1?distro=sid
pkg:deb/debian/jackson-databind@2.13.2.2-1?distro=stretch
pkg:deb/debian/jackson-databind@2.14.0-1?distro=sid
pkg:deb/ubuntu/dpkg@1.13.11ubuntu7~proposed
pkg:deb/ubuntu/dpkg@1.13.11ubuntu7.2
pkg:deb/ubuntu/dpkg@1.13.21ubuntu1
pkg:deb/ubuntu/dpkg@1.14.5ubuntu2
pkg:deb/ubuntu/dpkg@1.14.5ubuntu3
pkg:deb/ubuntu/dpkg@1.14.5ubuntu11
pkg:deb/ubuntu/dpkg@1.14.5ubuntu12
pkg:gem/actionpack@3.1.1
pkg:gem/actionpack@3.1.2
pkg:gem/actionpack@3.1.10
pkg:gem/actionpack@3.1.11
pkg:gem/webbynode@1.0.5.beta2
pkg:gem/webbynode@1.0.5.beta3
pkg:gem/webbynode@1.0.5.beta10
pkg:generic/postgresql@10.2.0
pkg:generic/postgresql@10.3.0
pkg:generic/postgresql@10.4.0
pkg:generic/postgresql@10.19.0
pkg:generic/postgresql@10.21.0
pkg:generic/postgresql@10.22.0
pkg:github/istio/istio@0.2.0
pkg:github/istio/istio@0.2.1
pkg:github/istio/istio@0.2.2
pkg:github/istio/istio@0.2.10
pkg:github/istio/istio@0.2.11
pkg:github/istio/istio@0.2.12
pkg:golang/github.com/1Panel-dev/1Panel@1.3.6
pkg:golang/github.com/1Panel-dev/1Panel@1.4.3
pkg:golang/github.com/1Panel-dev/1Panel@1.10.1-lts
pkg:golang/github.com/1Panel-dev/1Panel@1.10.3-lts
pkg:golang/github.com/1Panel-dev/1Panel@1.10.3
pkg:hex/pow@1.0.2
pkg:hex/pow@1.0.3
pkg:hex/pow@1.0.15
pkg:hex/pow@1.0.16
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.1.1
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.2.1
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.10.0
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.12.6.1
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.13.2
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.13.2.1
pkg:maven/io.netty/netty-codec-dns@4.1.97.Final
pkg:maven/io.netty/netty-codec-dns@4.1.101.Final
pkg:maven/io.netty/netty-codec-http@4.1.97.Final
pkg:maven/io.netty/netty-codec-http@4.1.101.Final
pkg:maven/io.netty/netty-codec-http2@4.1.97.Final
pkg:maven/io.netty/netty-codec-http2@4.1.101.Final
pkg:npm/bootstrap-select@1.6.2
pkg:npm/bootstrap-select@1.6.3
pkg:npm/bootstrap-select@1.13.5
pkg:npm/bootstrap-select@1.13.6
pkg:npm/%40budibase/bbui@1.2.44-alpha.1
pkg:npm/%40budibase/bbui@1.2.44-alpha.2
pkg:npm/%40budibase/bbui@1.2.44-alpha.3
pkg:npm/%40budibase/bbui@1.2.44-alpha.10
pkg:npm/%40budibase/bbui@1.2.44-alpha.11
pkg:nuget/adplug@2.3.0-beta17
pkg:nuget/adplug@2.3.0-beta172
pkg:nuget/adplug@2.3.0-beta173
pkg:nuget/adplug@2.3.0-beta18
pkg:nuget/adplug@2.3.0-beta186
pkg:nuget/adplug@2.3.0-beta19
pkg:nuget/adplug@2.3.0-beta190
pkg:pypi/jinja2@2.1
pkg:pypi/jinja2@2.1.1
pkg:pypi/jinja2@2.2
pkg:pypi/jinja2@2.2.1
pkg:pypi/jinja2@2.10
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=11
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=12
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=13
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=2
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=5
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=7
pkg:rpm/redhat/openssl@1.0.1e-30.el6_6?arch=9
Loading

0 comments on commit 7e740a6

Please sign in to comment.