-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a "Vulnerabilities" tab in package details view #600
Signed-off-by: Thomas Druez <tdruez@nexb.com>
- Loading branch information
Showing
5 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
scanpipe/templates/scanpipe/includes/vulnerabilities_table.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<table class="table is-bordered is-striped is-narrow is-hoverable is-fullwidth"> | ||
<thead> | ||
<tr> | ||
<th style="width: 210px;">Vulnerability</th> | ||
<th>Summary</th> | ||
<th style="width: 225px;">Aliases</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for vulnerability in vulnerabilities %} | ||
<tr> | ||
<td> | ||
<a href="{{ vulnerablecode_url }}vulnerabilities/{{ vulnerability.vulnerability_id }}" target="_blank"> | ||
{{ vulnerability.vulnerability_id }} | ||
<i class="fa-solid fa-up-right-from-square is-small"></i> | ||
</a> | ||
</td> | ||
<td> | ||
{{ vulnerability.summary }} | ||
</td> | ||
<td> | ||
{% for alias in vulnerability.aliases %} | ||
{% if alias|slice:":3" == "CVE" %} | ||
<a href="https://nvd.nist.gov/vuln/detail/{{ alias }}" target="_blank">{{ alias }} | ||
<i class="fa-solid fa-up-right-from-square is-small"></i> | ||
</a> | ||
{% elif alias|slice:":4" == "GHSA" %} | ||
<a href="https://github.com/advisories/{{ alias }}" target="_blank">{{ alias }} | ||
<i class="fa-solid fa-up-right-from-square is-small"></i> | ||
</a> | ||
{% elif alias|slice:":3" == "NPM" %} | ||
<a href="https://github.com/nodejs/security-wg/blob/main/vuln/npm/{{ alias|slice:"4:" }}.json" target="_blank">{{ alias }} | ||
<i class="fa-solid fa-up-right-from-square is-small"></i> | ||
</a> | ||
{% else %} | ||
{{ alias }} | ||
{% endif %} | ||
<br> | ||
{% endfor %} | ||
</td> | ||
</tr> | ||
{% empty %} | ||
<tr> | ||
<td colspan="42"> | ||
{{ empty_message }} | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
scanpipe/templates/scanpipe/tabset/tab_vulnerabilities.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="content"> | ||
<p class="panel-heading py-2 px-2 is-size-6 mb-0"> | ||
Affected by vulnerabilities | ||
<span class="tag is-danger is-rounded">{{ tab_data.fields.affected_by_vulnerabilities.value|length }}</span> | ||
</p> | ||
{% include 'scanpipe/includes/vulnerabilities_table.html' with vulnerabilities=tab_data.fields.affected_by_vulnerabilities.value empty_message="This package is not known to be affected by vulnerabilities." %} | ||
<p class="panel-heading py-2 px-2 is-size-6 mb-0 mt-5"> | ||
Fixing vulnerabilities | ||
<span class="tag is-success is-rounded">{{ tab_data.fields.fixing_vulnerabilities.value|length }}</span> | ||
</p> | ||
{% include 'scanpipe/includes/vulnerabilities_table.html' with vulnerabilities=tab_data.fields.fixing_vulnerabilities.value empty_message="This package is not known to fix vulnerabilities." %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters