owasp-depscan 5.1.3__tar.gz → 5.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of owasp-depscan might be problematic. Click here for more details.
- {owasp-depscan-5.1.3/owasp_depscan.egg-info → owasp-depscan-5.1.5}/PKG-INFO +43 -4
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/README.md +39 -2
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/depscan/cli.py +12 -93
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/depscan/lib/analysis.py +325 -169
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/depscan/lib/config.py +113 -5
- owasp-depscan-5.1.5/depscan/lib/csaf.py +1858 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/depscan/lib/logger.py +8 -4
- owasp-depscan-5.1.5/depscan/lib/orasclient.py +127 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5/owasp_depscan.egg-info}/PKG-INFO +43 -4
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/owasp_depscan.egg-info/SOURCES.txt +1 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/owasp_depscan.egg-info/requires.txt +3 -1
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/pyproject.toml +4 -2
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/test/test_analysis.py +63 -0
- owasp-depscan-5.1.5/test/test_csaf.py +1052 -0
- owasp-depscan-5.1.3/depscan/lib/csaf.py +0 -1982
- owasp-depscan-5.1.3/test/test_csaf.py +0 -1547
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/LICENSE +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/MANIFEST.in +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/depscan/__init__.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/depscan/lib/__init__.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/depscan/lib/audit.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/depscan/lib/bom.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/depscan/lib/explainer.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/depscan/lib/github.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/depscan/lib/license.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/depscan/lib/normalize.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/depscan/lib/pkg_query.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/depscan/lib/utils.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/owasp_depscan.egg-info/dependency_links.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/owasp_depscan.egg-info/entry_points.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/owasp_depscan.egg-info/top_level.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/setup.cfg +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/test/test_bom.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/test/test_explainer.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/test/test_github.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/test/test_license.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/test/test_norm.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/test/test_pkg_query.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/test/test_utils.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/__init__.py +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_data/fields.yml +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_data/meta.yml +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_data/rules.yml +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/0bsd.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/afl-3.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/agpl-3.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/apache-2.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/artistic-2.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/bsd-2-clause.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/bsd-3-clause-clear.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/bsd-3-clause.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/bsd-4-clause.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/bsl-1.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/cc-by-4.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/cc-by-sa-4.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/cc0-1.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/cecill-2.1.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/cern-ohl-p-2.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/cern-ohl-s-2.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/cern-ohl-w-2.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/ecl-2.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/epl-1.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/epl-2.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/eupl-1.1.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/eupl-1.2.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/gfdl-1.3.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/gpl-2.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/gpl-3.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/isc.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/lgpl-2.1.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/lgpl-3.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/lppl-1.3c.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/mit-0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/mit.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/mpl-2.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/ms-pl.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/ms-rl.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/mulanpsl-2.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/ncsa.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/odbl-1.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/ofl-1.1.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/osl-3.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/postgresql.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/unlicense.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/upl-1.0.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/vim.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/wtfpl.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/choosealicense.com/_licenses/zlib.txt +0 -0
- {owasp-depscan-5.1.3 → owasp-depscan-5.1.5}/vendor/spdx/json/licenses.json +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: owasp-depscan
|
|
3
|
-
Version: 5.1.
|
|
3
|
+
Version: 5.1.5
|
|
4
4
|
Summary: Fully open-source security audit for project dependencies based on known vulnerabilities and advisories.
|
|
5
5
|
Author-email: Team AppThreat <cloud@appthreat.com>
|
|
6
6
|
License: MIT
|
|
@@ -20,7 +20,7 @@ Classifier: Topic :: Utilities
|
|
|
20
20
|
Requires-Python: >=3.8
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
|
-
Requires-Dist: appthreat-vulnerability-db>=5.5.
|
|
23
|
+
Requires-Dist: appthreat-vulnerability-db>=5.5.8
|
|
24
24
|
Requires-Dist: defusedxml
|
|
25
25
|
Requires-Dist: oras
|
|
26
26
|
Requires-Dist: PyYAML
|
|
@@ -30,6 +30,8 @@ Requires-Dist: PyGithub
|
|
|
30
30
|
Requires-Dist: toml
|
|
31
31
|
Requires-Dist: pdfkit
|
|
32
32
|
Requires-Dist: Jinja2
|
|
33
|
+
Requires-Dist: packageurl-python
|
|
34
|
+
Requires-Dist: cvss
|
|
33
35
|
Provides-Extra: dev
|
|
34
36
|
Requires-Dist: black; extra == "dev"
|
|
35
37
|
Requires-Dist: flake8; extra == "dev"
|
|
@@ -46,6 +48,38 @@ OWASP dep-scan is a next-generation security and risk audit tool based on known
|
|
|
46
48
|
[](https://github.com/owasp-dep-scan/dep-scan/actions/workflows/pythonpublish.yml)
|
|
47
49
|
[](https://discord.gg/pF4BYWEJcS)
|
|
48
50
|
|
|
51
|
+
## Contents
|
|
52
|
+
|
|
53
|
+
- [Features](#features)
|
|
54
|
+
- [Vulnerability Data sources](#vulnerability-data-sources)
|
|
55
|
+
- [Linux distros](#linux-distros)
|
|
56
|
+
- [Usage](#usage)
|
|
57
|
+
- [OCI Artifacts via ORAS cli](#oci-artifacts-via-oras-cli)
|
|
58
|
+
- [Single binary executables](#single-binary-executables)
|
|
59
|
+
- [Server mode](#server-mode)
|
|
60
|
+
- [Scanning projects locally (Python version)](#scanning-projects-locally-python-version)
|
|
61
|
+
- [Scanning containers locally (Python version)](#scanning-containers-locally-python-version)
|
|
62
|
+
- [Scanning projects locally (Docker container)](#scanning-projects-locally-docker-container)
|
|
63
|
+
- [Supported languages and package format](#supported-languages-and-package-format)
|
|
64
|
+
- [Reachability analysis](#reachability-analysis)
|
|
65
|
+
- [Example analysis for a Java project](#example-analysis-for-a-java-project)
|
|
66
|
+
- [Example analysis for a JavaScript project](#example-analysis-for-a-javascript-project)
|
|
67
|
+
- [Customization through environment variables](#customization-through-environment-variables)
|
|
68
|
+
- [GitHub Security Advisory](#github-security-advisory)
|
|
69
|
+
- [Suggest mode](#suggest-mode)
|
|
70
|
+
- [Package Risk audit](#package-risk-audit)
|
|
71
|
+
- [Automatic adjustment](#automatic-adjustment)
|
|
72
|
+
- [Configuring weights](#configuring-weights)
|
|
73
|
+
- [Live OS scan](#live-os-scan)
|
|
74
|
+
- [License scan](#license-scan)
|
|
75
|
+
- [Kubernetes and Cloud apps](#kubernetes-and-cloud-apps)
|
|
76
|
+
- [PDF reports](#pdf-reports)
|
|
77
|
+
- [Custom reports](#custom-reports)
|
|
78
|
+
- [Performance tuning](#performance-tuning)
|
|
79
|
+
- [Use nydus to speed up the initial vdb download](#use-nydus-to-speed-up-the-initial-vdb-download)
|
|
80
|
+
- [Discord support](#discord-support)
|
|
81
|
+
- [License](#license)
|
|
82
|
+
|
|
49
83
|
## Features
|
|
50
84
|
|
|
51
85
|
- Scan most application code - local repos, Linux container images, Kubernetes manifests, and OS - to identify known CVEs with prioritization
|
|
@@ -98,15 +132,18 @@ Use [ORAS cli](https://oras.land/docs/) to download the vulnerability database f
|
|
|
98
132
|
export VDB_HOME=depscan
|
|
99
133
|
mkdir -p $VDB_HOME
|
|
100
134
|
oras pull ghcr.io/appthreat/vdb:v5 -o $VDB_HOME
|
|
135
|
+
# oras pull ghcr.io/appthreat/vdb-10y:v5 -o $VDB_HOME
|
|
101
136
|
oras pull ghcr.io/owasp-dep-scan/depscan:v4 -o $VDB_HOME
|
|
102
137
|
```
|
|
103
138
|
|
|
139
|
+
Use `vdb-10y` which is a larger database with vulnerability data spanning the last 10 years from 2014. In contrast, vdb with a starting year of 2018 is appropriate for most users.
|
|
140
|
+
|
|
104
141
|
### Single binary executables
|
|
105
142
|
|
|
106
143
|
Download the executable binary for your operating system from the [releases page](https://github.com/owasp-dep-scan/depscan-bin/releases). These binary bundle the following:
|
|
107
144
|
|
|
108
|
-
- dep-scan with Python 3.
|
|
109
|
-
- cdxgen with Node.js
|
|
145
|
+
- dep-scan with Python 3.11
|
|
146
|
+
- cdxgen with Node.js 21
|
|
110
147
|
- cdxgen binary plugins
|
|
111
148
|
|
|
112
149
|
```bash
|
|
@@ -355,6 +392,8 @@ depscan --profile research -t js -i <source directory> --reports-dir <reports di
|
|
|
355
392
|
The following environment variables can be used to customise the behaviour.
|
|
356
393
|
|
|
357
394
|
- VDB_HOME - Directory to use for caching database. For docker based execution, this directory should get mounted as a volume from the host
|
|
395
|
+
- VDB_DATABASE_URL - Vulnerability DB URL. Defaults to: ghcr.io/appthreat/vdb:v5
|
|
396
|
+
- USE_VDB_10Y - Set to true to use the larger 10 year vulnerability database. Default download url: ghcr.io/appthreat/vdb-10y:v5
|
|
358
397
|
|
|
359
398
|
## GitHub Security Advisory
|
|
360
399
|
|
|
@@ -7,6 +7,38 @@ OWASP dep-scan is a next-generation security and risk audit tool based on known
|
|
|
7
7
|
[](https://github.com/owasp-dep-scan/dep-scan/actions/workflows/pythonpublish.yml)
|
|
8
8
|
[](https://discord.gg/pF4BYWEJcS)
|
|
9
9
|
|
|
10
|
+
## Contents
|
|
11
|
+
|
|
12
|
+
- [Features](#features)
|
|
13
|
+
- [Vulnerability Data sources](#vulnerability-data-sources)
|
|
14
|
+
- [Linux distros](#linux-distros)
|
|
15
|
+
- [Usage](#usage)
|
|
16
|
+
- [OCI Artifacts via ORAS cli](#oci-artifacts-via-oras-cli)
|
|
17
|
+
- [Single binary executables](#single-binary-executables)
|
|
18
|
+
- [Server mode](#server-mode)
|
|
19
|
+
- [Scanning projects locally (Python version)](#scanning-projects-locally-python-version)
|
|
20
|
+
- [Scanning containers locally (Python version)](#scanning-containers-locally-python-version)
|
|
21
|
+
- [Scanning projects locally (Docker container)](#scanning-projects-locally-docker-container)
|
|
22
|
+
- [Supported languages and package format](#supported-languages-and-package-format)
|
|
23
|
+
- [Reachability analysis](#reachability-analysis)
|
|
24
|
+
- [Example analysis for a Java project](#example-analysis-for-a-java-project)
|
|
25
|
+
- [Example analysis for a JavaScript project](#example-analysis-for-a-javascript-project)
|
|
26
|
+
- [Customization through environment variables](#customization-through-environment-variables)
|
|
27
|
+
- [GitHub Security Advisory](#github-security-advisory)
|
|
28
|
+
- [Suggest mode](#suggest-mode)
|
|
29
|
+
- [Package Risk audit](#package-risk-audit)
|
|
30
|
+
- [Automatic adjustment](#automatic-adjustment)
|
|
31
|
+
- [Configuring weights](#configuring-weights)
|
|
32
|
+
- [Live OS scan](#live-os-scan)
|
|
33
|
+
- [License scan](#license-scan)
|
|
34
|
+
- [Kubernetes and Cloud apps](#kubernetes-and-cloud-apps)
|
|
35
|
+
- [PDF reports](#pdf-reports)
|
|
36
|
+
- [Custom reports](#custom-reports)
|
|
37
|
+
- [Performance tuning](#performance-tuning)
|
|
38
|
+
- [Use nydus to speed up the initial vdb download](#use-nydus-to-speed-up-the-initial-vdb-download)
|
|
39
|
+
- [Discord support](#discord-support)
|
|
40
|
+
- [License](#license)
|
|
41
|
+
|
|
10
42
|
## Features
|
|
11
43
|
|
|
12
44
|
- Scan most application code - local repos, Linux container images, Kubernetes manifests, and OS - to identify known CVEs with prioritization
|
|
@@ -59,15 +91,18 @@ Use [ORAS cli](https://oras.land/docs/) to download the vulnerability database f
|
|
|
59
91
|
export VDB_HOME=depscan
|
|
60
92
|
mkdir -p $VDB_HOME
|
|
61
93
|
oras pull ghcr.io/appthreat/vdb:v5 -o $VDB_HOME
|
|
94
|
+
# oras pull ghcr.io/appthreat/vdb-10y:v5 -o $VDB_HOME
|
|
62
95
|
oras pull ghcr.io/owasp-dep-scan/depscan:v4 -o $VDB_HOME
|
|
63
96
|
```
|
|
64
97
|
|
|
98
|
+
Use `vdb-10y` which is a larger database with vulnerability data spanning the last 10 years from 2014. In contrast, vdb with a starting year of 2018 is appropriate for most users.
|
|
99
|
+
|
|
65
100
|
### Single binary executables
|
|
66
101
|
|
|
67
102
|
Download the executable binary for your operating system from the [releases page](https://github.com/owasp-dep-scan/depscan-bin/releases). These binary bundle the following:
|
|
68
103
|
|
|
69
|
-
- dep-scan with Python 3.
|
|
70
|
-
- cdxgen with Node.js
|
|
104
|
+
- dep-scan with Python 3.11
|
|
105
|
+
- cdxgen with Node.js 21
|
|
71
106
|
- cdxgen binary plugins
|
|
72
107
|
|
|
73
108
|
```bash
|
|
@@ -316,6 +351,8 @@ depscan --profile research -t js -i <source directory> --reports-dir <reports di
|
|
|
316
351
|
The following environment variables can be used to customise the behaviour.
|
|
317
352
|
|
|
318
353
|
- VDB_HOME - Directory to use for caching database. For docker based execution, this directory should get mounted as a volume from the host
|
|
354
|
+
- VDB_DATABASE_URL - Vulnerability DB URL. Defaults to: ghcr.io/appthreat/vdb:v5
|
|
355
|
+
- USE_VDB_10Y - Set to true to use the larger 10 year vulnerability database. Default download url: ghcr.io/appthreat/vdb-10y:v5
|
|
319
356
|
|
|
320
357
|
## GitHub Security Advisory
|
|
321
358
|
|
|
@@ -2,22 +2,17 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
import argparse
|
|
5
|
-
from defusedxml.ElementTree import parse
|
|
6
5
|
import json
|
|
7
6
|
import os
|
|
8
|
-
import shutil
|
|
9
|
-
import subprocess
|
|
10
7
|
import sys
|
|
11
|
-
import tarfile
|
|
12
8
|
import tempfile
|
|
13
9
|
|
|
14
|
-
import
|
|
10
|
+
from defusedxml.ElementTree import parse
|
|
15
11
|
from quart import Quart, request
|
|
16
12
|
from rich.panel import Panel
|
|
17
13
|
from rich.terminal_theme import DEFAULT_TERMINAL_THEME, MONOKAI
|
|
18
14
|
from vdb.lib import config
|
|
19
15
|
from vdb.lib import db as db_lib
|
|
20
|
-
from vdb.lib.config import data_dir
|
|
21
16
|
from vdb.lib.gha import GitHubSource
|
|
22
17
|
from vdb.lib.nvd import NvdSource
|
|
23
18
|
from vdb.lib.osv import OSVSource
|
|
@@ -45,12 +40,11 @@ from depscan.lib.config import (
|
|
|
45
40
|
UNIVERSAL_SCAN_TYPE,
|
|
46
41
|
license_data_dir,
|
|
47
42
|
spdx_license_list,
|
|
48
|
-
vdb_database_url,
|
|
49
|
-
vdb_rafs_database_url,
|
|
50
43
|
)
|
|
51
44
|
from depscan.lib.csaf import export_csaf, write_toml
|
|
52
45
|
from depscan.lib.license import build_license_data, bulk_lookup
|
|
53
46
|
from depscan.lib.logger import DEBUG, LOG, console
|
|
47
|
+
from depscan.lib.orasclient import download_image
|
|
54
48
|
|
|
55
49
|
try:
|
|
56
50
|
os.environ["PYTHONIOENCODING"] = "utf-8"
|
|
@@ -497,68 +491,6 @@ def summarise(
|
|
|
497
491
|
return summary, vdr_file, pkg_vulnerabilities, pkg_group_rows
|
|
498
492
|
|
|
499
493
|
|
|
500
|
-
def download_rafs_based_image():
|
|
501
|
-
rafs_image_downloaded, paths_list = False, None
|
|
502
|
-
nydus_image_command = shutil.which("nydus-image", mode=os.X_OK)
|
|
503
|
-
if nydus_image_command is not None:
|
|
504
|
-
LOG.info(
|
|
505
|
-
"About to download the vulnerability database from %s. This might take a while ...",
|
|
506
|
-
vdb_rafs_database_url,
|
|
507
|
-
)
|
|
508
|
-
|
|
509
|
-
try:
|
|
510
|
-
oras_client = oras.client.OrasClient()
|
|
511
|
-
rafs_data_dir = tempfile.TemporaryDirectory()
|
|
512
|
-
paths_list = oras_client.pull(
|
|
513
|
-
target=vdb_rafs_database_url, outdir=rafs_data_dir.name
|
|
514
|
-
)
|
|
515
|
-
|
|
516
|
-
if (
|
|
517
|
-
paths_list
|
|
518
|
-
and os.path.exists(
|
|
519
|
-
os.path.join(rafs_data_dir.name, "data.rafs")
|
|
520
|
-
)
|
|
521
|
-
and os.path.exists(
|
|
522
|
-
os.path.join(rafs_data_dir.name, "meta.rafs")
|
|
523
|
-
)
|
|
524
|
-
):
|
|
525
|
-
nydus_download_command = [
|
|
526
|
-
f"{nydus_image_command}",
|
|
527
|
-
"unpack",
|
|
528
|
-
"--blob",
|
|
529
|
-
os.path.join(rafs_data_dir.name, "data.rafs"),
|
|
530
|
-
"--output",
|
|
531
|
-
os.path.join(data_dir, "vdb.tar"),
|
|
532
|
-
"--bootstrap",
|
|
533
|
-
os.path.join(rafs_data_dir.name, "meta.rafs"),
|
|
534
|
-
]
|
|
535
|
-
_ = subprocess.run(
|
|
536
|
-
nydus_download_command,
|
|
537
|
-
check=True,
|
|
538
|
-
stdout=subprocess.DEVNULL,
|
|
539
|
-
)
|
|
540
|
-
if os.path.exists(os.path.join(data_dir, "vdb.tar")):
|
|
541
|
-
rafs_image_downloaded = True
|
|
542
|
-
with tarfile.open(
|
|
543
|
-
os.path.join(data_dir, "vdb.tar"), "r"
|
|
544
|
-
) as tar:
|
|
545
|
-
tar.extractall(path=data_dir)
|
|
546
|
-
os.remove(os.path.join(data_dir, "vdb.tar"))
|
|
547
|
-
else:
|
|
548
|
-
raise FileNotFoundError("vdb.tar not found")
|
|
549
|
-
else:
|
|
550
|
-
raise FileNotFoundError("data.rafs or meta.rafs not found")
|
|
551
|
-
|
|
552
|
-
except Exception:
|
|
553
|
-
LOG.info(
|
|
554
|
-
"Unable to pull the vulnerability database (rafs image) from %s. Trying to pull the non-rafs-based VDB image.",
|
|
555
|
-
vdb_rafs_database_url,
|
|
556
|
-
)
|
|
557
|
-
rafs_image_downloaded = False
|
|
558
|
-
|
|
559
|
-
return rafs_image_downloaded, data_dir
|
|
560
|
-
|
|
561
|
-
|
|
562
494
|
@app.get("/")
|
|
563
495
|
async def index():
|
|
564
496
|
"""
|
|
@@ -576,18 +508,17 @@ async def cache():
|
|
|
576
508
|
"""
|
|
577
509
|
db = db_lib.get()
|
|
578
510
|
if not db_lib.index_count(db["index_file"]):
|
|
579
|
-
|
|
580
|
-
if
|
|
581
|
-
LOG.info(
|
|
582
|
-
"About to download the vulnerability database from %s. This might take a while ...",
|
|
583
|
-
vdb_database_url,
|
|
584
|
-
)
|
|
585
|
-
oras_client = oras.client.OrasClient()
|
|
586
|
-
oras_client.pull(target=vdb_database_url, outdir=data_dir)
|
|
511
|
+
paths_list = download_image()
|
|
512
|
+
if paths_list:
|
|
587
513
|
return {
|
|
588
514
|
"error": "false",
|
|
589
515
|
"message": "vulnerability database cached successfully",
|
|
590
516
|
}
|
|
517
|
+
else:
|
|
518
|
+
return {
|
|
519
|
+
"error": "true",
|
|
520
|
+
"message": "vulnerability database was not cached",
|
|
521
|
+
}
|
|
591
522
|
return {
|
|
592
523
|
"error": "false",
|
|
593
524
|
"message": "vulnerability database already exists",
|
|
@@ -1035,17 +966,7 @@ def main():
|
|
|
1035
966
|
except Exception:
|
|
1036
967
|
pass
|
|
1037
968
|
if run_cacher:
|
|
1038
|
-
|
|
1039
|
-
if not rafs_image_downloaded:
|
|
1040
|
-
LOG.info(
|
|
1041
|
-
"About to download the vulnerability database from %s. This might take a while ...",
|
|
1042
|
-
vdb_database_url,
|
|
1043
|
-
)
|
|
1044
|
-
oras_client = oras.client.OrasClient()
|
|
1045
|
-
paths_list = oras_client.pull(
|
|
1046
|
-
target=vdb_database_url, outdir=data_dir
|
|
1047
|
-
)
|
|
1048
|
-
|
|
969
|
+
paths_list = download_image()
|
|
1049
970
|
LOG.debug("VDB data is stored at: %s", paths_list)
|
|
1050
971
|
run_cacher = False
|
|
1051
972
|
db = db_lib.get()
|
|
@@ -1100,12 +1021,10 @@ def main():
|
|
|
1100
1021
|
# CSAF VEX export
|
|
1101
1022
|
if args.csaf:
|
|
1102
1023
|
export_csaf(
|
|
1103
|
-
|
|
1024
|
+
pkg_vulnerabilities,
|
|
1104
1025
|
src_dir,
|
|
1105
1026
|
reports_dir,
|
|
1106
|
-
|
|
1107
|
-
direct_purls=direct_purls,
|
|
1108
|
-
reached_purls=reached_purls,
|
|
1027
|
+
bom_file,
|
|
1109
1028
|
)
|
|
1110
1029
|
console.save_html(
|
|
1111
1030
|
html_file,
|