owasp-depscan 5.0.3__py3-none-any.whl → 5.1.0__py3-none-any.whl

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.

depscan/cli.py CHANGED
@@ -1115,7 +1115,8 @@ def main():
1115
1115
  # render report into template if wished
1116
1116
  if args.report_template and os.path.isfile(args.report_template):
1117
1117
  utils.render_template_report(
1118
- jsonl_report_file=report_file,
1118
+ vdr_file=vdr_file,
1119
+ bom_file=bom_file,
1119
1120
  summary=summary,
1120
1121
  template_file=args.report_template,
1121
1122
  result_file=os.path.join(reports_dir, args.report_name),
depscan/lib/normalize.py CHANGED
@@ -155,10 +155,12 @@ def create_pkg_variations(pkg_dict):
155
155
  for suffix in COMMON_SUFFIXES:
156
156
  if name.endswith(suffix):
157
157
  name_aliases.add(name.replace(suffix, ""))
158
- for k, v in config.package_alias.items():
159
- if name.startswith(k) or k.startswith(name) or v.startswith(name):
160
- name_aliases.add(k)
161
- name_aliases.add(v)
158
+ # The below aliasing is resulting in several false positives for npm
159
+ if pkg_type not in ("npm",):
160
+ for k, v in config.package_alias.items():
161
+ if name.startswith(k) or k.startswith(name) or v.startswith(name):
162
+ name_aliases.add(k)
163
+ name_aliases.add(v)
162
164
  if pkg_type in config.OS_PKG_TYPES:
163
165
  if "lib" in name:
164
166
  name_aliases.add(name.replace("lib", ""))
depscan/lib/utils.py CHANGED
@@ -413,22 +413,33 @@ def export_pdf(
413
413
 
414
414
 
415
415
  def render_template_report(
416
- jsonl_report_file,
416
+ vdr_file,
417
+ bom_file,
417
418
  summary,
418
419
  template_file,
419
420
  result_file,
420
421
  ):
421
422
  """
422
- Render the given json_report_file and summary dict using the template_file with Jinja
423
+ Render the given vdr_file (falling back to bom_file if no vdr was written)
424
+ and summary dict using the template_file with Jinja, rendered output is written
425
+ to named result_file in reports directory.
423
426
  """
424
- with open(jsonl_report_file, "r", encoding="utf-8") as jsonl_file:
425
- json_report = [json.loads(jline) for jline in jsonl_file.readlines()]
427
+ if vdr_file and os.path.isfile(vdr_file):
428
+ with open(vdr_file, "r", encoding="utf-8") as f:
429
+ bom = json.load(f)
430
+ else:
431
+ with open(bom_file, "r", encoding="utf-8") as f:
432
+ bom = json.load(f)
426
433
  with open(template_file, "r", encoding="utf-8") as tmpl_file:
427
434
  template = tmpl_file.read()
428
435
  jinja_env = Environment(autoescape=False)
429
436
  jinja_tmpl = jinja_env.from_string(template)
430
437
  report_result = jinja_tmpl.render(
431
- vulnerabilities=json_report,
438
+ metadata=bom.get('metadata', None),
439
+ vulnerabilities=bom.get('vulnerabilities', None),
440
+ components=bom.get('components', None),
441
+ dependencies=bom.get('dependencies', None),
442
+ services=bom.get('services', None),
432
443
  summary=summary,
433
444
  )
434
445
  with open(result_file, "w", encoding="utf-8") as outfile:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: owasp-depscan
3
- Version: 5.0.3
3
+ Version: 5.1.0
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.5
23
+ Requires-Dist: appthreat-vulnerability-db >=5.5.6
24
24
  Requires-Dist: defusedxml
25
25
  Requires-Dist: oras
26
26
  Requires-Dist: PyYAML
@@ -461,11 +461,19 @@ Giving it will pass the vulnerability report into your template for rendering th
461
461
  Please find a basic example here:
462
462
 
463
463
  ```jinja
464
+ {% if metadata -%}
465
+ Report for {{ metadata.component.group }}:{{ metadata.component.name }}:{{ metadata.component.version }}
466
+ {% endif -%}
467
+
468
+ {% if vulnerabilities -%}
464
469
  There were {{ vulnerabilities | length }} issues identified:
465
470
 
466
471
  {% for vuln in vulnerabilities -%}
467
- * {{ vuln.id }} - {{ vuln.package }}
468
- {% endfor %}
472
+ * {{ vuln['bom-ref'] }} - {{ vuln.recommendation }}
473
+ {% endfor -%}
474
+ {% else -%}
475
+ 🏆 _No vulnerabilities found_
476
+ {% endif -%}
469
477
 
470
478
  Severity counts:
471
479
  * Low: {{ summary.LOW }}
@@ -475,10 +483,19 @@ Severity counts:
475
483
  * Unspecified: {{ summary.UNSPECIFIED }}
476
484
  ```
477
485
 
478
- The `vulnerabilities` object is the same list that can be found in the `depscan-bom.json` report file,
486
+ The objects available are taken from the CycloneDX *.vdr.json BOM file generated, just have a look to the file for its full structure:
487
+
488
+ * `metadata`
489
+ * `vulnerabilities`
490
+ * `components`
491
+ * `dependencies`
492
+ * `services`
493
+
479
494
  `summary` is a dictionary type with vulnerability severity quantities as shown in the example above.
480
495
  Furthermore insights are imaginably to be made available to the template, please reach out or contribute on demand.
481
496
 
497
+ We appreciate if you like to contribute your report templates as examples, please add/find them [here](contrib/report-templates/).
498
+
482
499
  ## Discord support
483
500
 
484
501
  The developers could be reached via the [discord](https://discord.gg/DCNxzaeUpd) channel for enterprise support.
@@ -1,5 +1,5 @@
1
1
  depscan/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- depscan/cli.py,sha256=NlcIdADd76Gzr64As_-QjJ0Zbon9d64D1KHxAYlgPlo,40361
2
+ depscan/cli.py,sha256=rKylWBHfAPrNwn1OD5eRA3dADcaVtH1XdFSpTDy5L8w,40380
3
3
  depscan/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  depscan/lib/analysis.py,sha256=GdrQbZRorQcTf4_8lC5C11phbI1iIJUNx9FhqgF4agc,50988
5
5
  depscan/lib/audit.py,sha256=6GmHOkhDYY1LCIRd-wUSrSISh6_IFR5PhOopPJIQTeE,1318
@@ -10,9 +10,9 @@ depscan/lib/explainer.py,sha256=yRCEroeNCSj_bUQXqwUkLHV3l7eSJvTYoms9T1CDgGk,9282
10
10
  depscan/lib/github.py,sha256=h6e_12xLwspXJbt_7lW6vuHaqgJQgyFSRCLrfUndCH4,1697
11
11
  depscan/lib/license.py,sha256=y4-WZuD2MOunKaLd2EJGcSYP6s3Lp_dgssdzhcl9eEM,2332
12
12
  depscan/lib/logger.py,sha256=UKsx_sKuSvkoR7Co4WwUzWe56Aidv0cNFQJM7lXU018,1576
13
- depscan/lib/normalize.py,sha256=Mf8aiXSw9jcshVsb4OyMdRlU41raiCTxXM3VsVwBXZU,10168
13
+ depscan/lib/normalize.py,sha256=HOK6HPgX-wakYuUa6to81Z38atQ1iYXHF-s6nsIrsPU,10298
14
14
  depscan/lib/pkg_query.py,sha256=Hlf3LypsL7EF309HevcfhdjAOPDZbN1XRQOmjQpnxlI,20082
15
- depscan/lib/utils.py,sha256=Qt5dQozjiN7d6-_0j5jFm9fQYviLOMlR0868CpJvdek,14011
15
+ depscan/lib/utils.py,sha256=fAG6eTRqEvmmbPOsMBdgQzaKo4KWAYdijRgn-_MX6t8,14428
16
16
  vendor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  vendor/choosealicense.com/_data/fields.yml,sha256=ydNsITXFUuADzGPM-jcUcJnN0r_qSGgH51oV27nX3Qs,819
18
18
  vendor/choosealicense.com/_data/meta.yml,sha256=rSNmnx0LE6VA9wnR29Y_P9s-TnADQqbdw2enE4i1mWM,1792
@@ -63,9 +63,9 @@ vendor/choosealicense.com/_licenses/vim.txt,sha256=d5GQjXB328L8EBkhKgxcjk344D3K7
63
63
  vendor/choosealicense.com/_licenses/wtfpl.txt,sha256=BxXeubkvQm32MDmlZsBcbzJzBpR5kWgw0JxSR9d7f3k,948
64
64
  vendor/choosealicense.com/_licenses/zlib.txt,sha256=e6dfCeLhxD3NCnIkY4cVIagRaWdRvencjNhHZ1APvpc,1678
65
65
  vendor/spdx/json/licenses.json,sha256=_Vz_aACEg-giVk08ZBQLqB5Z3AnSWZmdD9I22ID3QNs,275192
66
- owasp_depscan-5.0.3.dist-info/LICENSE,sha256=oQnCbnZtJ_NLDdOLc-rVY1D1N0RNWLHPpYXcc77xzSo,1073
67
- owasp_depscan-5.0.3.dist-info/METADATA,sha256=A6tndpGYCot-uPbbd-mTTkE50VSTT7ACFAYvBDSFpmY,24224
68
- owasp_depscan-5.0.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
69
- owasp_depscan-5.0.3.dist-info/entry_points.txt,sha256=FxQKHFWZTfKU2eBxHPFRxwhSNexntYygYhquykS8zxA,69
70
- owasp_depscan-5.0.3.dist-info/top_level.txt,sha256=qbHOZvNU2dXANv946hMdP2vOi0ESQB5t2ZY5ktKtXvQ,15
71
- owasp_depscan-5.0.3.dist-info/RECORD,,
66
+ owasp_depscan-5.1.0.dist-info/LICENSE,sha256=oQnCbnZtJ_NLDdOLc-rVY1D1N0RNWLHPpYXcc77xzSo,1073
67
+ owasp_depscan-5.1.0.dist-info/METADATA,sha256=Gf3cPNsgde0RurILElnXXVKasNqsXKzgtbpPwtTGeCw,24705
68
+ owasp_depscan-5.1.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
69
+ owasp_depscan-5.1.0.dist-info/entry_points.txt,sha256=FxQKHFWZTfKU2eBxHPFRxwhSNexntYygYhquykS8zxA,69
70
+ owasp_depscan-5.1.0.dist-info/top_level.txt,sha256=qbHOZvNU2dXANv946hMdP2vOi0ESQB5t2ZY5ktKtXvQ,15
71
+ owasp_depscan-5.1.0.dist-info/RECORD,,