From 2e87065d01599b91c9e71e715b702a268b1022bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quirin=20Hardy=20Zie=C3=9Fler?= Date: Tue, 20 Feb 2024 19:03:59 +0100 Subject: [PATCH] :tada: introducing EPSS score (#9516) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * WIP * first draw * fix migrations * fix migrations * add epss to findings UI * added epss to finding list * Delete unittests/scans/wazuh/one_endpoint_finding.json * flake8 * add migration for ModelOptions * Add null values for epss + validators * updated findings detail page to display epss as percentage * removed wazuh file * update branch (#3) * Update versions in application files * Update jira-description.tpl (#9403) * Update and rename whitesource.md to mend.md (#9348) * Update and rename whitesource.md to mend.md * Update docs/content/en/integrations/parsers/file/mend.md Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> --------- Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> * API: Remote v2 OpenAPI2 Docs from menu (#9469) * :bug: fix migration (#9467) * finding sla expiration date field (part one) (#9473) * addition of sla expiration date field on the finding model * add migration and fix indentation issue * fix mitigated finding remaining sla days calculation * fix sla violation filter to return only active, sla violating findings * migration system settings fix * fix mitigation date vs datetime discrepancy * fix breaking unit test * move product save check to signal * fix unit test failure * make signal operations async, fix sla config delete 500 error * add unit tests to test sla expiration date functionality * restarting without signals * add async updating flags, redo migration * move signal logic to overriden save * fix errors for non-existing objects at creation * clean up comments and a few logical expressions * fix flake8 error * addition of new unit tests * fix unit test error * add message to form fields when async updating flag is true * fix save location, reword form messages, reword redirect messages * remove commented lines from unit tests * add a bit more description to API validation errors * migration fix * migration performance improvements * fix datetime - str comparison issue * clean up for part one of sla expiration date field * fix flake8 * Update dojo/db_migrations/0200_finding_sla_expiration_date_product_async_updating_and_more.py Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> * Update dojo/models.py Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> --------- Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> * Update versions in application files * Update versions in application files * Update release-drafter/release-drafter action from v5.25.0 to v6 (.github/workflows/release-drafter.yml) (#9460) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Bump pytz from 2023.4 to 2024.1 (#9465) Bumps [pytz](https://github.com/stub42/pytz) from 2023.4 to 2024.1. - [Release notes](https://github.com/stub42/pytz/releases) - [Commits](https://github.com/stub42/pytz/compare/release_2023.4...release_2024.1) --- updated-dependencies: - dependency-name: pytz dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump django-debug-toolbar from 4.2.0 to 4.3.0 (#9466) Bumps [django-debug-toolbar](https://github.com/jazzband/django-debug-toolbar) from 4.2.0 to 4.3.0. - [Release notes](https://github.com/jazzband/django-debug-toolbar/releases) - [Changelog](https://github.com/jazzband/django-debug-toolbar/blob/main/docs/changes.rst) - [Commits](https://github.com/jazzband/django-debug-toolbar/compare/4.2...4.3) --- updated-dependencies: - dependency-name: django-debug-toolbar dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump nginx from `d12e6f7` to `f2802c2` (#9477) Bumps nginx from `d12e6f7` to `f2802c2`. --- updated-dependencies: - dependency-name: nginx dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update dependency postcss from 8.4.33 to v8.4.34 (docs/package.json) (#9481) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update rabbitmq:3.12.12-alpine Docker digest from 3.12.12 to 3.12.12-alpine (docker-compose.yml) (#9458) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * :arrow_up: Bump boto3 from 1.34.32 to 1.34.35 (#9489) Bumps [boto3](https://github.com/boto/boto3) from 1.34.32 to 1.34.35. - [Release notes](https://github.com/boto/boto3/releases) - [Changelog](https://github.com/boto/boto3/blob/develop/CHANGELOG.rst) - [Commits](https://github.com/boto/boto3/compare/1.34.32...1.34.35) --- updated-dependencies: - dependency-name: boto3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update dependency ruff from 0.1.15 to v0.2.1 (requirements-lint.txt) (#9459) * Update dependency ruff from 0.1.15 to v0.2.1 (requirements-lint.txt) * Fix ruff warning (#9461) * Update dependency ruff from 0.1.15 to v0.2.0 (requirements-lint.txt) * fix ruff warning --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: kiblik Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> * :bug: fix defaulting severity, see last comments in #8778 (#9370) Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> * Add ruff for *tests (#9406) * Revert ":bug: fix dependencytrack deduplication (#9117)" (#9371) This reverts commit 0f55a7f2c2db4b39ab30b868b2090c45ed9038b4. Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> * dojo/importers/importer/importer.py - Change "None" string to "Info" from cvss module when a CVSS vector string should evaluate to "Info" (#9453) * dojo/importers/importer/importer.py - Change "None" string to "Info" from cvss module when a CVSS vector string evaluates to "Info" * dojo/importers/importer/importer.py - Change "None" string to "Info" from cvss module when a CVSS vector string evaluates to "Info" #flake8_fix * Trivy Operator VulnerabilityReport Parser tweaks (#9452) * API: Check missing endpoints (#7618) * Rename unittest * Define exceptions for now * Announcement was implemented * Fix unittests with assertRaises + replace assertTrue/False with better checks (#9435) * Fix unittests with assertRaises * Replace assertTrue/False with better checks * Fixes * Optimize list of Maintenance in relase notes (#9492) * fix typo in docs (#9487) * :bug: WFuzz: Add additional severity mappings (#9486) * :bug: fix wfuzz, issue #7863 * add 302 * update docs * Be strict about Warnings during testing (#9490) * Set PYTHONWARNINGS=error * Add basic filterwarnings * Mute some warnings * Mute one more warning * :bug: fix trufflehog3, issue #6999 (#9470) * :bug: fix yarn_audit, #6495 (#9478) * Bump vulners from 2.1.2 to 2.1.5 (#9391) Bumps [vulners]() from 2.1.2 to 2.1.5. --- updated-dependencies: - dependency-name: vulners dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add support for DD_APPEND_SLASH (#9385) * Override default Django APPEND_SLASH * Update dojo/settings/settings.dist.py * :tada: Improvements for wazuh importer (#9248) * improvement for wazuh importer * :wrench: change on dedupe for Wazuh * :wrench: change on dedupe for Wazuh * :memo: * :pencil2: * :memo: * :memo: * flake8 * :tada: recoded wazuh importer to support endpoints * :white_check_mark: adjusted unittests * :memo: * :pencil2: * :pencil2: --------- Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> * Update rabbitmq:3.12.12-alpine Docker digest from 3.12.12 to 3.12.12-alpine (docker-compose.yml) (#9501) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency postcss from 8.4.34 to v8.4.35 (docs/package.json) (#9502) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Improve API endpoints for Risk Acceptances (#9415) * Modifying Bugcrowd API Parser to align to vendor documentation on wha… (#9517) * Modifying Bugcrowd API Parser to align to vendor documentation on what the not_applicable state means. It is now active == False and severity == 'Info'. [sc-4217] * fixing Flake8 errors * fixing Flake8 errors, part deux --------- Signed-off-by: dependabot[bot] Co-authored-by: DefectDojo release bot Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> Co-authored-by: Paul Osinski <42211303+paulOsinski@users.noreply.github.com> Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> Co-authored-by: kiblik Co-authored-by: manuelsommer <47991713+manuel-sommer@users.noreply.github.com> Co-authored-by: Blake Owens <76979297+blakeaowens@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Robert Kiss Co-authored-by: ninp0 Co-authored-by: Raouf HADDADA <22875897+raouf-haddada@users.noreply.github.com> Co-authored-by: Felix Hernandez Co-authored-by: Jay Paz * updated migrations * added percentage to findings_list * :pencil2: tightening column title in findings detail page * flake8 * undo DT parser update * fix migrations * update migrations to changes in dev * merge dev into epss score * Update versions in application files * Update versions * Parse GitHub vulnerability version (#9462) * Fix SARIF parser with CodeQL rules (#9440) * fix for sarif parser with codeql rules * add check for extensions property * flake8 comparsion * finding sla expiration date field (part two) (#9494) * finding sla expiration date field (part two) * sla violation check updates * clean up of finding violates_sla property * flake8 fix * Update dojo/models.py Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> * Update 0201_populate_finding_sla_expiration_date.py --------- Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> * Jira Server/DataCenter: Update meta methods (#9512) * Jira Webhook: Catch comments from other issue updates (#9513) * Jira Webhook: Catch comments from other issue updates * Accommodate redirect responses * Update dojo/jira_link/views.py Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> * Fix syntax --------- Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> * add metrics page: "Product Tag Count" (fixes #9151) (#9152) * add metrics page: "Product Tag Count" It is fully based on "Product Type Count" metrics page. * fixup! add metrics page: "Product Tag Count" * Fix Flake8 * Update views.py --------- Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> * Release Drafter: Try validating inputs * Disallow duplicate tool types (#9530) * Disallow duplicate tool types * Fix Flake8 * Only validate on new creations * Force new name on tool type unit test * Engagement Surveys: Add missing leading slash (#9531) URL redirects were behaving strangely without this leading slash. it seems it was missed when all the others were added * Update versions in application files * Update versions in application files * Dojo_Group: Support for "RemoteUser" in model (#9405) * Use correct name references * fix db_mig * Update and rename 0201_alter_dojo_group_social_provider.py to 0202_alter_dojo_group_social_provider.py --------- Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> * Update rabbitmq:3.12.12-alpine Docker digest from 3.12.12 to 3.12.12-alpine (docker-compose.yml) (#9535) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * remove flot-axis library (#9540) * use full url for helm-repos and alias in renovate.json (#9525) With this change, renovate will create PRs to update the helm-dependencies, just as with docker-compose. Note that only setting the repository to the full URL did not work, I also had to add the registryAlias. * Update Helm release redis from 16.12.3 to ~16.13.0 (helm/defectdojo/Chart.yaml) (#9550) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update rabbitmq:3.12.12-alpine Docker digest from 3.12.12 to 3.12.12-alpine (docker-compose.yml) (#9541) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update postgres Docker tag from 16.1 to v16.2 (docker-compose.yml) (#9536) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update Helm release mysql from 9.1.8 to ~9.19.0 (helm/defectdojo/Chart.yaml) (#9545) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --------- Co-authored-by: DefectDojo release bot Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> Co-authored-by: Colm O hEigeartaigh Co-authored-by: Andrei Serebriakov Co-authored-by: Blake Owens <76979297+blakeaowens@users.noreply.github.com> Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> Co-authored-by: tomaszn Co-authored-by: kiblik Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Felix Hernandez Co-authored-by: Sebastian Gumprich * update epss-score (#5) solve conflicts --------- Signed-off-by: dependabot[bot] Co-authored-by: DefectDojo release bot Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> Co-authored-by: Paul Osinski <42211303+paulOsinski@users.noreply.github.com> Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> Co-authored-by: kiblik Co-authored-by: manuelsommer <47991713+manuel-sommer@users.noreply.github.com> Co-authored-by: Blake Owens <76979297+blakeaowens@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Robert Kiss Co-authored-by: ninp0 Co-authored-by: Raouf HADDADA <22875897+raouf-haddada@users.noreply.github.com> Co-authored-by: Felix Hernandez Co-authored-by: Jay Paz Co-authored-by: Colm O hEigeartaigh Co-authored-by: Andrei Serebriakov Co-authored-by: tomaszn Co-authored-by: Sebastian Gumprich --- ...ptions_finding_epss_percentile_and_more.py | 36 +++++++++++++++++++ dojo/filters.py | 9 ++++- dojo/models.py | 14 ++++++-- .../templates/dojo/findings_list_snippet.html | 18 ++++++++++ dojo/templates/dojo/view_finding.html | 25 +++++++++++-- dojo/templatetags/multiply.py | 8 +++++ 6 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 dojo/db_migrations/0203_alter_finding_options_finding_epss_percentile_and_more.py create mode 100644 dojo/templatetags/multiply.py diff --git a/dojo/db_migrations/0203_alter_finding_options_finding_epss_percentile_and_more.py b/dojo/db_migrations/0203_alter_finding_options_finding_epss_percentile_and_more.py new file mode 100644 index 0000000000..00bf8b5e2b --- /dev/null +++ b/dojo/db_migrations/0203_alter_finding_options_finding_epss_percentile_and_more.py @@ -0,0 +1,36 @@ +# Generated by Django 4.1.13 on 2024-02-11 15:32 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dojo', '0202_alter_dojo_group_social_provider'), + ] + + operations = [ + migrations.AlterModelOptions( + name='finding', + options={'ordering': ('numerical_severity', '-date', 'title', 'epss_score', 'epss_percentile')}, + ), + migrations.AddField( + model_name='finding', + name='epss_percentile', + field=models.FloatField(blank=True, default=None, help_text='EPSS percentile for the CVE. Describes how many CVEs are scored at or below this one.', null=True, validators=[django.core.validators.MinValueValidator(0.0), django.core.validators.MaxValueValidator(1.0)], verbose_name='EPSS percentile'), + ), + migrations.AddField( + model_name='finding', + name='epss_score', + field=models.FloatField(blank=True, default=None, help_text='EPSS score for the CVE. Describes how likely it is the vulnerability will be exploited in the next 30 days.', null=True, validators=[django.core.validators.MinValueValidator(0.0), django.core.validators.MaxValueValidator(1.0)], verbose_name='EPSS Score'), + ), + migrations.AddIndex( + model_name='finding', + index=models.Index(fields=['epss_score'], name='dojo_findin_epss_sc_e40540_idx'), + ), + migrations.AddIndex( + model_name='finding', + index=models.Index(fields=['epss_percentile'], name='dojo_findin_epss_pe_567499_idx'), + ), + ] diff --git a/dojo/filters.py b/dojo/filters.py index 723c52337f..2cdfe7a57a 100644 --- a/dojo/filters.py +++ b/dojo/filters.py @@ -322,6 +322,8 @@ def get_finding_filterset_fields(metrics=False, similar=False): 'unique_id_from_tool', 'vuln_id_from_tool', 'service', + 'epss_score', + 'epss_percentile' ]) if similar: @@ -1443,6 +1445,8 @@ class FindingFilter(FindingFilterWithTags): ('test__engagement__product__name', 'test__engagement__product__name'), ('service', 'service'), + ('epss_score', 'epss_score'), + ('epss_percentile', 'epss_percentile'), ), field_labels={ 'numerical_severity': 'Severity', @@ -1451,6 +1455,8 @@ class FindingFilter(FindingFilterWithTags): 'mitigated': 'Mitigated Date', 'title': 'Finding Name', 'test__engagement__product__name': 'Product Name', + 'epss_score': 'EPSS Score', + 'epss_percentile': 'EPSS Percentile', } ) @@ -1464,7 +1470,8 @@ class Meta: 'numerical_severity', 'line', 'duplicate_finding', 'hash_code', 'reviewers', 'created', 'files', 'sla_start_date', 'sla_expiration_date', 'cvssv3', - 'severity_justification', 'steps_to_reproduce'] + 'severity_justification', 'steps_to_reproduce', + 'epss_score', 'epss_percentile'] def __init__(self, *args, **kwargs): self.user = None diff --git a/dojo/models.py b/dojo/models.py index 1ed97a2b69..90da3b5c1f 100755 --- a/dojo/models.py +++ b/dojo/models.py @@ -13,7 +13,7 @@ from django.contrib.auth.models import Group from django.db.models.expressions import Case, When from django.urls import reverse -from django.core.validators import RegexValidator, validate_ipv46_address +from django.core.validators import RegexValidator, validate_ipv46_address, MinValueValidator, MaxValueValidator from django.core.files.base import ContentFile from django.core.exceptions import ValidationError from django.db import models, connection @@ -2207,6 +2207,14 @@ class Finding(models.Model): blank=False, verbose_name=_("Vulnerability Id"), help_text=_("An id of a vulnerability in a security advisory associated with this finding. Can be a Common Vulnerabilities and Exposures (CVE) or from other sources.")) + epss_score = models.FloatField(default=None, null=True, blank=True, + verbose_name=_("EPSS Score"), + help_text=_("EPSS score for the CVE. Describes how likely it is the vulnerability will be exploited in the next 30 days."), + validators=[MinValueValidator(0.0), MaxValueValidator(1.0)]) + epss_percentile = models.FloatField(default=None, null=True, blank=True, + verbose_name=_("EPSS percentile"), + help_text=_("EPSS percentile for the CVE. Describes how many CVEs are scored at or below this one."), + validators=[MinValueValidator(0.0), MaxValueValidator(1.0)]) cvssv3_regex = RegexValidator(regex=r'^AV:[NALP]|AC:[LH]|PR:[UNLH]|UI:[NR]|S:[UC]|[CIA]:[NLH]', message="CVSS must be entered in format: 'AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H'") cvssv3 = models.TextField(validators=[cvssv3_regex], max_length=117, @@ -2501,7 +2509,7 @@ class Finding(models.Model): 'High': 1, 'Critical': 0} class Meta: - ordering = ('numerical_severity', '-date', 'title') + ordering = ('numerical_severity', '-date', 'title', 'epss_score', 'epss_percentile') indexes = [ models.Index(fields=['test', 'active', 'verified']), @@ -2516,6 +2524,8 @@ class Meta: models.Index(fields=['test', 'component_name']), models.Index(fields=['cve']), + models.Index(fields=['epss_score']), + models.Index(fields=['epss_percentile']), models.Index(fields=['cwe']), models.Index(fields=['out_of_scope']), models.Index(fields=['false_p']), diff --git a/dojo/templates/dojo/findings_list_snippet.html b/dojo/templates/dojo/findings_list_snippet.html index 248b749194..514c6e1a96 100644 --- a/dojo/templates/dojo/findings_list_snippet.html +++ b/dojo/templates/dojo/findings_list_snippet.html @@ -2,6 +2,7 @@ {% load display_tags %} {% load authorization_tags %} {% load get_endpoint_status %} +{% load multiply %} {% load static %} {% load i18n %} {% block findings_list %} @@ -322,6 +323,9 @@

{% trans "Vulnerability Id" %} + + {% trans "EPSS Score" %} / {% trans "Percentile" %} + {% if filter_name == 'Closed' %} {% comment %} The display field is translated in the function. No need to translate here as well{% endcomment %} @@ -593,6 +597,19 @@

{% endif %} {% endwith %} + + {% if finding.epss_score is not None %} + {{ finding.epss_score|multiply:100|floatformat:"2" }}% + {% else %} + N.A. + {% endif %} + / + {% if finding.epss_percentile is not None %} + {{ finding.epss_percentile|multiply:100|floatformat:"2" }}% + {% else %} + N.A. + {% endif %} + {% if filter_name == 'Closed' %} {{ finding.mitigated|date }} @@ -721,6 +738,7 @@

}}, { "data": "cwe" }, { "data": "cve" }, + { "data": "epss"}, { "data": "found_date" }, { "data": "finding_age" }, {% if system_settings.enable_finding_sla %} diff --git a/dojo/templates/dojo/view_finding.html b/dojo/templates/dojo/view_finding.html index 5a49cbd5bb..9517bc0eab 100755 --- a/dojo/templates/dojo/view_finding.html +++ b/dojo/templates/dojo/view_finding.html @@ -1,5 +1,6 @@ {% extends "base.html" %} {% load display_tags %} +{% load multiply %} {% load authorization_tags %} {% load humanize %} {% load static %} @@ -268,8 +269,17 @@

Date Mitigated Mitigated By {% endif %} - CWE - Vulnerability Id + CWE + Vulnerability Id + {% if finding.epss_score != None or finding.epss_percentile != None %} + {% if finding.epss_score != None and finding.epss_percentile != None %} + EPSS Score / Percentile + {% elif finding.epss_score != None and finding.epss_percentile == None %} + EPSS Score + {% elif finding.epss_score == None and finding.epss_percentile != None %} + EPSS Percentile + {% endif %} + {% endif %} Found by {% if finding.vuln_id_from_tool %} Vuln ID from tool @@ -421,7 +431,16 @@

{% endif %} {% endif %} - + {% if finding.epss_score != None or finding.epss_percentile != None %} + {% if finding.epss_score != None and finding.epss_percentile != None %} + {{ finding.epss_score|multiply:100|floatformat:"3" }}% / {{ finding.epss_percentile|multiply:100|floatformat:"3" }}% + {% elif finding.epss_score != None and finding.epss_percentile == None %} + {{ finding.epss_score|multiply:100|floatformat:"3" }}% + {% elif finding.epss_score == None and finding.epss_percentile != None %} + {{ finding.epss_percentile|multiply:100|floatformat:"3" }}% + {% endif %} + {% endif %} + {% if found_by %} {% for scanner in found_by %} {{ scanner }} diff --git a/dojo/templatetags/multiply.py b/dojo/templatetags/multiply.py new file mode 100644 index 0000000000..641fa4889c --- /dev/null +++ b/dojo/templatetags/multiply.py @@ -0,0 +1,8 @@ +from django import template + +register = template.Library() + + +@register.filter +def multiply(value, arg): + return value * arg