owasp-depscan 4.2.6__tar.gz → 4.2.7__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.

Files changed (82) hide show
  1. {owasp-depscan-4.2.6/owasp_depscan.egg-info → owasp-depscan-4.2.7}/PKG-INFO +5 -12
  2. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/README.md +3 -11
  3. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/depscan/cli.py +13 -35
  4. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/depscan/lib/bom.py +70 -22
  5. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/depscan/lib/config.py +2 -0
  6. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7/owasp_depscan.egg-info}/PKG-INFO +5 -12
  7. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/owasp_depscan.egg-info/requires.txt +1 -0
  8. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/pyproject.toml +2 -1
  9. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/LICENSE +0 -0
  10. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/MANIFEST.in +0 -0
  11. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/depscan/__init__.py +0 -0
  12. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/depscan/lib/__init__.py +0 -0
  13. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/depscan/lib/analysis.py +0 -0
  14. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/depscan/lib/audit.py +0 -0
  15. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/depscan/lib/license.py +0 -0
  16. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/depscan/lib/logger.py +0 -0
  17. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/depscan/lib/normalize.py +0 -0
  18. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/depscan/lib/pkg_query.py +0 -0
  19. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/depscan/lib/privado.py +0 -0
  20. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/depscan/lib/utils.py +0 -0
  21. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/owasp_depscan.egg-info/SOURCES.txt +0 -0
  22. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/owasp_depscan.egg-info/dependency_links.txt +0 -0
  23. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/owasp_depscan.egg-info/entry_points.txt +0 -0
  24. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/owasp_depscan.egg-info/top_level.txt +0 -0
  25. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/setup.cfg +0 -0
  26. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/test/test_analysis.py +0 -0
  27. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/test/test_bom.py +0 -0
  28. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/test/test_license.py +0 -0
  29. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/test/test_norm.py +0 -0
  30. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/test/test_pkg_query.py +0 -0
  31. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/test/test_privado.py +0 -0
  32. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/test/test_utils.py +0 -0
  33. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/__init__.py +0 -0
  34. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_data/fields.yml +0 -0
  35. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_data/meta.yml +0 -0
  36. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_data/rules.yml +0 -0
  37. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/0bsd.txt +0 -0
  38. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/afl-3.0.txt +0 -0
  39. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/agpl-3.0.txt +0 -0
  40. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/apache-2.0.txt +0 -0
  41. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/artistic-2.0.txt +0 -0
  42. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/bsd-2-clause.txt +0 -0
  43. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/bsd-3-clause-clear.txt +0 -0
  44. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/bsd-3-clause.txt +0 -0
  45. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/bsd-4-clause.txt +0 -0
  46. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/bsl-1.0.txt +0 -0
  47. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/cc-by-4.0.txt +0 -0
  48. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/cc-by-sa-4.0.txt +0 -0
  49. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/cc0-1.0.txt +0 -0
  50. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/cecill-2.1.txt +0 -0
  51. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/cern-ohl-p-2.0.txt +0 -0
  52. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/cern-ohl-s-2.0.txt +0 -0
  53. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/cern-ohl-w-2.0.txt +0 -0
  54. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/ecl-2.0.txt +0 -0
  55. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/epl-1.0.txt +0 -0
  56. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/epl-2.0.txt +0 -0
  57. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/eupl-1.1.txt +0 -0
  58. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/eupl-1.2.txt +0 -0
  59. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/gfdl-1.3.txt +0 -0
  60. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/gpl-2.0.txt +0 -0
  61. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/gpl-3.0.txt +0 -0
  62. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/isc.txt +0 -0
  63. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/lgpl-2.1.txt +0 -0
  64. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/lgpl-3.0.txt +0 -0
  65. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/lppl-1.3c.txt +0 -0
  66. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/mit-0.txt +0 -0
  67. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/mit.txt +0 -0
  68. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/mpl-2.0.txt +0 -0
  69. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/ms-pl.txt +0 -0
  70. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/ms-rl.txt +0 -0
  71. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/mulanpsl-2.0.txt +0 -0
  72. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/ncsa.txt +0 -0
  73. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/odbl-1.0.txt +0 -0
  74. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/ofl-1.1.txt +0 -0
  75. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/osl-3.0.txt +0 -0
  76. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/postgresql.txt +0 -0
  77. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/unlicense.txt +0 -0
  78. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/upl-1.0.txt +0 -0
  79. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/vim.txt +0 -0
  80. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/wtfpl.txt +0 -0
  81. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/choosealicense.com/_licenses/zlib.txt +0 -0
  82. {owasp-depscan-4.2.6 → owasp-depscan-4.2.7}/vendor/spdx/json/licenses.json +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: owasp-depscan
3
- Version: 4.2.6
3
+ Version: 4.2.7
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
@@ -21,6 +21,7 @@ Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: appthreat-vulnerability-db>=5.4.2
23
23
  Requires-Dist: defusedxml
24
+ Requires-Dist: oras
24
25
  Requires-Dist: PyYAML
25
26
  Requires-Dist: rich
26
27
  Requires-Dist: quart
@@ -55,7 +56,7 @@ OWASP dep-scan is a fully open-source security audit tool based on known vulnera
55
56
  - NVD
56
57
  - GitHub
57
58
  - NPM
58
- - Linux [vuln-list](https://github.com/appthreat/vuln-list) (Use `--cache-os`)
59
+ - Linux [vuln-list](https://github.com/appthreat/vuln-list)
59
60
 
60
61
  ### Linux distros
61
62
 
@@ -72,7 +73,7 @@ OWASP dep-scan is a fully open-source security audit tool based on known vulnera
72
73
  - Chainguard
73
74
  - Wolfi OS
74
75
 
75
- Application vulnerabilities would be reported for all Linux distros and Windows. To download the full vulnerability database suitable for scanning OS, invoke dep-scan with `--cache-os` for the first time. dep-scan would also download the appropriate database based on project type automatically.
76
+ Application vulnerabilities would be reported for all Linux distros and Windows. To download the full vulnerability database suitable for scanning OS, invoke dep-scan with `--cache` for the first time. dep-scan would also download the appropriate database based on project type automatically.
76
77
 
77
78
  ## Usage
78
79
 
@@ -130,13 +131,6 @@ In server mode, use `/cache` endpoint to cache the vulnerability database.
130
131
  curl http://0.0.0.0:7070/cache
131
132
  ```
132
133
 
133
- Cache all vulnerabilities including os.
134
-
135
- ```bash
136
- # This would take over 5 minutes
137
- curl http://0.0.0.0:7070/cache?os=true
138
- ```
139
-
140
134
  Use the `/scan` endpoint to perform scans.
141
135
 
142
136
  ```bash
@@ -177,12 +171,11 @@ depscan --src $PWD --reports-dir $PWD/reports
177
171
  Full list of options are below:
178
172
 
179
173
  ```bash
180
- usage: depscan [-h] [--no-banner] [--cache] [--cache-os] [--sync] [--suggest] [--risk-audit] [--private-ns PRIVATE_NS] [-t PROJECT_TYPE] [--bom BOM] -i SRC_DIR
174
+ usage: depscan [-h] [--no-banner] [--cache] [--sync] [--suggest] [--risk-audit] [--private-ns PRIVATE_NS] [-t PROJECT_TYPE] [--bom BOM] -i SRC_DIR
181
175
  [--reports-dir REPORTS_DIR] [--no-error] [--deep]
182
176
  -h, --help show this help message and exit
183
177
  --no-banner Do not display banner
184
178
  --cache Cache vulnerability information in platform specific user_data_dir
185
- --cache-os Cache OS vulnerability information in platform specific user_data_dir
186
179
  --sync Sync to receive the latest vulnerability data. Should have invoked cache first.
187
180
  --risk-audit Perform package risk audit (slow operation). Npm only.
188
181
  --private-ns PRIVATE_NS
@@ -23,7 +23,7 @@ OWASP dep-scan is a fully open-source security audit tool based on known vulnera
23
23
  - NVD
24
24
  - GitHub
25
25
  - NPM
26
- - Linux [vuln-list](https://github.com/appthreat/vuln-list) (Use `--cache-os`)
26
+ - Linux [vuln-list](https://github.com/appthreat/vuln-list)
27
27
 
28
28
  ### Linux distros
29
29
 
@@ -40,7 +40,7 @@ OWASP dep-scan is a fully open-source security audit tool based on known vulnera
40
40
  - Chainguard
41
41
  - Wolfi OS
42
42
 
43
- Application vulnerabilities would be reported for all Linux distros and Windows. To download the full vulnerability database suitable for scanning OS, invoke dep-scan with `--cache-os` for the first time. dep-scan would also download the appropriate database based on project type automatically.
43
+ Application vulnerabilities would be reported for all Linux distros and Windows. To download the full vulnerability database suitable for scanning OS, invoke dep-scan with `--cache` for the first time. dep-scan would also download the appropriate database based on project type automatically.
44
44
 
45
45
  ## Usage
46
46
 
@@ -98,13 +98,6 @@ In server mode, use `/cache` endpoint to cache the vulnerability database.
98
98
  curl http://0.0.0.0:7070/cache
99
99
  ```
100
100
 
101
- Cache all vulnerabilities including os.
102
-
103
- ```bash
104
- # This would take over 5 minutes
105
- curl http://0.0.0.0:7070/cache?os=true
106
- ```
107
-
108
101
  Use the `/scan` endpoint to perform scans.
109
102
 
110
103
  ```bash
@@ -145,12 +138,11 @@ depscan --src $PWD --reports-dir $PWD/reports
145
138
  Full list of options are below:
146
139
 
147
140
  ```bash
148
- usage: depscan [-h] [--no-banner] [--cache] [--cache-os] [--sync] [--suggest] [--risk-audit] [--private-ns PRIVATE_NS] [-t PROJECT_TYPE] [--bom BOM] -i SRC_DIR
141
+ usage: depscan [-h] [--no-banner] [--cache] [--sync] [--suggest] [--risk-audit] [--private-ns PRIVATE_NS] [-t PROJECT_TYPE] [--bom BOM] -i SRC_DIR
149
142
  [--reports-dir REPORTS_DIR] [--no-error] [--deep]
150
143
  -h, --help show this help message and exit
151
144
  --no-banner Do not display banner
152
145
  --cache Cache vulnerability information in platform specific user_data_dir
153
- --cache-os Cache OS vulnerability information in platform specific user_data_dir
154
146
  --sync Sync to receive the latest vulnerability data. Should have invoked cache first.
155
147
  --risk-audit Perform package risk audit (slow operation). Npm only.
156
148
  --private-ns PRIVATE_NS
@@ -12,11 +12,14 @@ from rich.terminal_theme import MONOKAI
12
12
  from vdb.lib import config
13
13
  from vdb.lib import db as db_lib
14
14
  from vdb.lib.aqua import AquaSource
15
+ from vdb.lib.config import data_dir
15
16
  from vdb.lib.gha import GitHubSource
16
17
  from vdb.lib.nvd import NvdSource
17
18
  from vdb.lib.osv import OSVSource
18
19
  from vdb.lib.utils import parse_purl
19
20
 
21
+ import oras.client
22
+
20
23
  from depscan.lib import privado, utils
21
24
  from depscan.lib.analysis import (
22
25
  PrepareVexOptions,
@@ -29,7 +32,7 @@ from depscan.lib.analysis import (
29
32
  )
30
33
  from depscan.lib.audit import audit, risk_audit, risk_audit_map, type_audit_map
31
34
  from depscan.lib.bom import create_bom, get_pkg_by_type, get_pkg_list, submit_bom
32
- from depscan.lib.config import UNIVERSAL_SCAN_TYPE, license_data_dir, spdx_license_list
35
+ from depscan.lib.config import UNIVERSAL_SCAN_TYPE, license_data_dir, spdx_license_list, vdb_database_url
33
36
  from depscan.lib.license import build_license_data, bulk_lookup
34
37
  from depscan.lib.logger import LOG, console
35
38
  from depscan.lib.utils import get_version
@@ -76,13 +79,6 @@ def build_args():
76
79
  dest="cache",
77
80
  help="Cache vulnerability information in platform specific " "user_data_dir",
78
81
  )
79
- parser.add_argument(
80
- "--cache-os",
81
- action="store_true",
82
- default=False,
83
- dest="cache_os",
84
- help="Cache OS vulnerability information in platform specific " "user_data_dir",
85
- )
86
82
  parser.add_argument(
87
83
  "--sync",
88
84
  action="store_true",
@@ -455,17 +451,10 @@ async def cache():
455
451
  :return: a JSON response indicating the status of the caching operation.
456
452
  """
457
453
  db = db_lib.get()
458
- q = request.args
459
454
  if not db_lib.index_count(db["index_file"]):
460
- sources_list = [OSVSource(), NvdSource()]
461
- if os.environ.get("GITHUB_TOKEN"):
462
- sources_list.insert(0, GitHubSource())
463
- # Include aqua source when ?os=true query string is passed
464
- if q.get("os", "").lower() in ("true", "1"):
465
- sources_list.insert(0, AquaSource())
466
- for s in sources_list:
467
- LOG.debug("Refreshing %s", s.__class__.__name__)
468
- s.refresh()
455
+ oras_client = oras.client.OrasClient()
456
+ paths_list = oras_client.pull(target = vdb_database_url, outdir = data_dir)
457
+ LOG.debug(f'VDB data is stored at: {paths_list}')
469
458
  return {
470
459
  "error": "false",
471
460
  "message": "vulnerability database cached successfully",
@@ -607,7 +596,7 @@ def main():
607
596
  else:
608
597
  project_types_list = utils.detect_project_type(src_dir)
609
598
  db = db_lib.get()
610
- run_cacher = args.cache or args.cache_os
599
+ run_cacher = args.cache
611
600
  areport_file = (
612
601
  args.report_file
613
602
  if args.report_file
@@ -746,26 +735,15 @@ def main():
746
735
  run_cacher = True
747
736
  else:
748
737
  LOG.debug("Vulnerability database loaded from %s", config.vdb_bin_file)
738
+
749
739
  sources_list = [OSVSource(), NvdSource()]
750
740
  if os.environ.get("GITHUB_TOKEN"):
751
741
  sources_list.insert(0, GitHubSource())
752
742
  if run_cacher:
753
- if (
754
- args.cache_os
755
- or args.deep_scan
756
- or project_type in ("docker", "podman", "yaml-manifest", "os")
757
- ):
758
- sources_list.insert(0, AquaSource())
759
- LOG.info(
760
- "OS Vulnerability database would be downloaded for the "
761
- "first time. To avoid this step, manually download the "
762
- "vulnerability database using the ORAS cli and set the "
763
- "environment variable VDB_HOME."
764
- )
765
- for s in sources_list:
766
- LOG.debug("Refreshing %s", s.__class__.__name__)
767
- s.refresh()
768
- run_cacher = False
743
+ oras_client = oras.client.OrasClient()
744
+ paths_list = oras_client.pull(target = vdb_database_url, outdir = data_dir)
745
+ LOG.debug(f'VDB data is stored at: {paths_list}')
746
+ run_cacher = False
769
747
  elif args.sync:
770
748
  for s in sources_list:
771
749
  LOG.debug("Syncing %s", s.__class__.__name__)
@@ -245,6 +245,69 @@ def resource_path(relative_path):
245
245
  return os.path.join(base_path, relative_path)
246
246
 
247
247
 
248
+ def exec_cdxgen(bin=True):
249
+ if bin:
250
+ cdxgen_cmd = os.environ.get("CDXGEN_CMD", "cdxgen")
251
+ if not shutil.which(cdxgen_cmd):
252
+ local_bin = resource_path(
253
+ os.path.join(
254
+ "local_bin",
255
+ "cdxgen.exe" if sys.platform == "win32" else "cdxgen",
256
+ )
257
+ )
258
+ if not os.path.exists(local_bin):
259
+ LOG.warning(
260
+ "%s command not found. Please install using npm install "
261
+ "@cyclonedx/cdxgen or set PATH variable",
262
+ cdxgen_cmd,
263
+ )
264
+ return False
265
+ try:
266
+ cdxgen_cmd = local_bin
267
+ # Set the plugins directory as an environment variable
268
+ os.environ["CDXGEN_PLUGINS_DIR"] = resource_path("local_bin")
269
+ return cdxgen_cmd
270
+ except Exception:
271
+ return None
272
+
273
+ else:
274
+ # cdxgen_cmd = (
275
+ # os.environ.get("CDXGEN_CMD", "cdxgen")
276
+ # if sys.platform != "win32"
277
+ # else os.environ.get("CDXGEN_CMD", "cdxgen.CMD")
278
+ # )
279
+ lbin = os.getenv("APPDATA") if sys.platform == "win32" else "local_bin"
280
+ local_bin = resource_path(
281
+ os.path.join(
282
+ f"{lbin}\\npm\\" if sys.platform == "win32" else "local_bin",
283
+ "cdxgen" if sys.platform != "win32" else "cdxgen.cmd",
284
+ )
285
+ )
286
+ if not os.path.exists(local_bin):
287
+ LOG.warning(
288
+ "%s command not found. Please install using npm install "
289
+ "@cyclonedx/cdxgen or set PATH variable",
290
+ local_bin,
291
+ )
292
+ return None
293
+ try:
294
+ cdxgen_cmd = local_bin
295
+ # Set the plugins directory as an environment variable
296
+ os.environ["CDXGEN_PLUGINS_DIR"] = (
297
+ resource_path("local_bin")
298
+ if sys.platform != "win32"
299
+ else resource_path(
300
+ os.path.join(
301
+ lbin,
302
+ "\\npm\\node_modules\\@cyclonedx\\cdxgen\\node_modules\\@cyclonedx\\cdxgen-plugins-bin\\plugins",
303
+ )
304
+ )
305
+ )
306
+ return cdxgen_cmd
307
+ except Exception:
308
+ return None
309
+
310
+
248
311
  def create_bom(project_type, bom_file, src_dir=".", deep=False, options={}):
249
312
  """
250
313
  Method to create BOM file by executing cdxgen command
@@ -303,27 +366,9 @@ def create_bom(project_type, bom_file, src_dir=".", deep=False, options={}):
303
366
  "Unable to generate SBoM with cdxgen server. Trying to "
304
367
  "generate one locally."
305
368
  )
306
- cdxgen_cmd = os.environ.get("CDXGEN_CMD", "cdxgen")
307
- if not shutil.which(cdxgen_cmd):
308
- local_bin = resource_path(
309
- os.path.join(
310
- "local_bin",
311
- "cdxgen.exe" if sys.platform == "win32" else "cdxgen",
312
- )
313
- )
314
- if not os.path.exists(local_bin):
315
- LOG.warning(
316
- "%s command not found. Please install using npm install "
317
- "@cyclonedx/cdxgen or set PATH variable",
318
- cdxgen_cmd,
319
- )
320
- return False
321
- try:
322
- cdxgen_cmd = local_bin
323
- # Set the plugins directory as an environment variable
324
- os.environ["CDXGEN_PLUGINS_DIR"] = resource_path("local_bin")
325
- except Exception:
326
- pass
369
+ cdxgen_cmd = exec_cdxgen()
370
+ if not cdxgen_cmd:
371
+ cdxgen_cmd = exec_cdxgen(False)
327
372
  if project_type in ("docker",):
328
373
  LOG.info(
329
374
  "Generating Software Bill-of-Materials for container image %s. "
@@ -335,7 +380,10 @@ def create_bom(project_type, bom_file, src_dir=".", deep=False, options={}):
335
380
  args.append("--deep")
336
381
  LOG.info("About to perform deep scan. This would take a while ...")
337
382
  args.append(src_dir)
338
- exec_tool(args)
383
+ if cdxgen_cmd:
384
+ exec_tool(args)
385
+ else:
386
+ LOG.warning("Unable to locate cdxgen command. ")
339
387
  return os.path.exists(bom_file)
340
388
 
341
389
 
@@ -296,6 +296,8 @@ npm_app_info = {"name": "appthreat-depscan", "version": "1.0.0"}
296
296
 
297
297
  pypi_server = "https://pypi.org/pypi"
298
298
 
299
+ vdb_database_url = "ghcr.io/appthreat/vdb:v5"
300
+
299
301
  # Package risk scoring using a simple weighted formula with no backing
300
302
  # research All parameters and their max value and weight can be overridden
301
303
  # using environment variables
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: owasp-depscan
3
- Version: 4.2.6
3
+ Version: 4.2.7
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
@@ -21,6 +21,7 @@ Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: appthreat-vulnerability-db>=5.4.2
23
23
  Requires-Dist: defusedxml
24
+ Requires-Dist: oras
24
25
  Requires-Dist: PyYAML
25
26
  Requires-Dist: rich
26
27
  Requires-Dist: quart
@@ -55,7 +56,7 @@ OWASP dep-scan is a fully open-source security audit tool based on known vulnera
55
56
  - NVD
56
57
  - GitHub
57
58
  - NPM
58
- - Linux [vuln-list](https://github.com/appthreat/vuln-list) (Use `--cache-os`)
59
+ - Linux [vuln-list](https://github.com/appthreat/vuln-list)
59
60
 
60
61
  ### Linux distros
61
62
 
@@ -72,7 +73,7 @@ OWASP dep-scan is a fully open-source security audit tool based on known vulnera
72
73
  - Chainguard
73
74
  - Wolfi OS
74
75
 
75
- Application vulnerabilities would be reported for all Linux distros and Windows. To download the full vulnerability database suitable for scanning OS, invoke dep-scan with `--cache-os` for the first time. dep-scan would also download the appropriate database based on project type automatically.
76
+ Application vulnerabilities would be reported for all Linux distros and Windows. To download the full vulnerability database suitable for scanning OS, invoke dep-scan with `--cache` for the first time. dep-scan would also download the appropriate database based on project type automatically.
76
77
 
77
78
  ## Usage
78
79
 
@@ -130,13 +131,6 @@ In server mode, use `/cache` endpoint to cache the vulnerability database.
130
131
  curl http://0.0.0.0:7070/cache
131
132
  ```
132
133
 
133
- Cache all vulnerabilities including os.
134
-
135
- ```bash
136
- # This would take over 5 minutes
137
- curl http://0.0.0.0:7070/cache?os=true
138
- ```
139
-
140
134
  Use the `/scan` endpoint to perform scans.
141
135
 
142
136
  ```bash
@@ -177,12 +171,11 @@ depscan --src $PWD --reports-dir $PWD/reports
177
171
  Full list of options are below:
178
172
 
179
173
  ```bash
180
- usage: depscan [-h] [--no-banner] [--cache] [--cache-os] [--sync] [--suggest] [--risk-audit] [--private-ns PRIVATE_NS] [-t PROJECT_TYPE] [--bom BOM] -i SRC_DIR
174
+ usage: depscan [-h] [--no-banner] [--cache] [--sync] [--suggest] [--risk-audit] [--private-ns PRIVATE_NS] [-t PROJECT_TYPE] [--bom BOM] -i SRC_DIR
181
175
  [--reports-dir REPORTS_DIR] [--no-error] [--deep]
182
176
  -h, --help show this help message and exit
183
177
  --no-banner Do not display banner
184
178
  --cache Cache vulnerability information in platform specific user_data_dir
185
- --cache-os Cache OS vulnerability information in platform specific user_data_dir
186
179
  --sync Sync to receive the latest vulnerability data. Should have invoked cache first.
187
180
  --risk-audit Perform package risk audit (slow operation). Npm only.
188
181
  --private-ns PRIVATE_NS
@@ -1,5 +1,6 @@
1
1
  appthreat-vulnerability-db>=5.4.2
2
2
  defusedxml
3
+ oras
3
4
  PyYAML
4
5
  rich
5
6
  quart
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "owasp-depscan"
3
- version = "4.2.6"
3
+ version = "4.2.7"
4
4
  description = "Fully open-source security audit for project dependencies based on known vulnerabilities and advisories."
5
5
  authors = [
6
6
  {name = "Team AppThreat", email = "cloud@appthreat.com"},
@@ -8,6 +8,7 @@ authors = [
8
8
  dependencies = [
9
9
  "appthreat-vulnerability-db>=5.4.2",
10
10
  "defusedxml",
11
+ "oras",
11
12
  "PyYAML",
12
13
  "rich",
13
14
  "quart",
File without changes
File without changes
File without changes