diff --git a/Makefile b/Makefile index cf78903b..6920eeac 100644 --- a/Makefile +++ b/Makefile @@ -27,9 +27,11 @@ shell: # Open a bash session in a standalone container (no stack required) docker run -it $(IMAGE_NAME) bash +# make test - full suite +# make test k= - filter by name, e.g. make test k=test_name test: - @echo "-> Run the test suite" - ${MANAGE} test --noinput --parallel auto + ${EXEC} web pip install --find-links=thirdparty/dist/ --no-index --no-cache-dir '.[dev]' + ${MANAGE} test --noinput --parallel auto $(if $(k),-k $(k),) migrations: @echo "-> Creates new database migrations" diff --git a/component_catalog/api.py b/component_catalog/api.py index abd8705f..e37e6ac4 100644 --- a/component_catalog/api.py +++ b/component_catalog/api.py @@ -436,8 +436,8 @@ class ComponentFilterSet(DataspacedAPIFilterSet): field_name="affected_by_vulnerabilities", ) affected_by = django_filters.CharFilter( - field_name="affected_by_vulnerabilities__vulnerability_id", - label="Affected by (vulnerability_id)", + field_name="affected_by_vulnerabilities__advisory_id", + label="Affected by (advisory_id)", ) class Meta: @@ -630,7 +630,8 @@ class PackageSerializer( read_only=True, many=True, fields=[ - "vulnerability_id", + "advisory_uid", + "advisory_id", "api_url", "uuid", ], @@ -809,8 +810,8 @@ class PackageAPIFilterSet(DataspacedAPIFilterSet): field_name="affected_by_vulnerabilities", ) affected_by = django_filters.CharFilter( - field_name="affected_by_vulnerabilities__vulnerability_id", - label="Affected by (vulnerability_id)", + field_name="affected_by_vulnerabilities__advisory_id", + label="Affected by (advisory_id)", ) risk_score = ScoreRangeFilter(score_ranges=RISK_SCORE_RANGES) diff --git a/component_catalog/filters.py b/component_catalog/filters.py index 5e08ae09..0ece94d9 100644 --- a/component_catalog/filters.py +++ b/component_catalog/filters.py @@ -119,7 +119,7 @@ class ComponentFilterSet(DataspacedFilterSet): widget=DropDownRightWidget(link_content=''), ) affected_by = django_filters.CharFilter( - field_name="affected_by_vulnerabilities__vulnerability_id", + field_name="affected_by_vulnerabilities__advisory_id", label=_("Affected by"), ) @@ -267,7 +267,7 @@ class PackageFilterSet(DataspacedFilterSet): widget=DropDownRightWidget(link_content=''), ) affected_by = django_filters.CharFilter( - field_name="affected_by_vulnerabilities__vulnerability_id", + field_name="affected_by_vulnerabilities__advisory_id", label=_("Affected by"), ) affected_by_last_modified_date = django_filters.DateRangeFilter( diff --git a/component_catalog/templates/component_catalog/tabs/tab_vulnerabilities.html b/component_catalog/templates/component_catalog/tabs/tab_vulnerabilities.html index 9fa439bd..1613caa8 100644 --- a/component_catalog/templates/component_catalog/tabs/tab_vulnerabilities.html +++ b/component_catalog/templates/component_catalog/tabs/tab_vulnerabilities.html @@ -51,11 +51,11 @@ {% if vulnerability.resource_url %} - {{ vulnerability.vulnerability_id }} + {{ vulnerability.advisory_id }} {% else %} - {{ vulnerability.vulnerability_id }} + {{ vulnerability.advisory_id }} {% endif %}
diff --git a/component_catalog/tests/test_api.py b/component_catalog/tests/test_api.py index afd60a0a..7ad52a2a 100644 --- a/component_catalog/tests/test_api.py +++ b/component_catalog/tests/test_api.py @@ -1350,17 +1350,17 @@ def test_api_package_endpoint_vulnerabilities_features(self): results = response.data["results"] self.assertEqual("9.0", results[0]["risk_score"]) self.assertEqual( - vulnerability1.vulnerability_id, - results[0]["affected_by_vulnerabilities"][0]["vulnerability_id"], + vulnerability1.advisory_id, + results[0]["affected_by_vulnerabilities"][0]["advisory_id"], ) - data = {"affected_by": vulnerability1.vulnerability_id} + data = {"affected_by": vulnerability1.advisory_id} response = self.client.get(self.package_list_url, data) self.assertEqual(1, response.data["count"]) self.assertContains(response, self.package1_detail_url) self.assertNotContains(response, self.package2_detail_url) - data = {"affected_by": vulnerability2.vulnerability_id} + data = {"affected_by": vulnerability2.advisory_id} response = self.client.get(self.package_list_url, data) self.assertEqual(0, response.data["count"]) self.assertNotContains(response, self.package1_detail_url) diff --git a/component_catalog/tests/test_filters.py b/component_catalog/tests/test_filters.py index 82827d65..c496a7de 100644 --- a/component_catalog/tests/test_filters.py +++ b/component_catalog/tests/test_filters.py @@ -406,6 +406,6 @@ def test_package_filterset_affected_by_filter(self): self.assertIn(package1, filterset.qs) self.assertIn(package2, filterset.qs) - data = {"affected_by": vulnerability1.vulnerability_id} + data = {"affected_by": vulnerability1.advisory_id} filterset = PackageFilterSet(dataspace=self.dataspace, data=data) self.assertQuerySetEqual(filterset.qs, [package1]) diff --git a/component_catalog/tests/test_views.py b/component_catalog/tests/test_views.py index 5efafcb1..40ec4f16 100644 --- a/component_catalog/tests/test_views.py +++ b/component_catalog/tests/test_views.py @@ -1054,7 +1054,7 @@ def test_component_details_view_tab_vulnerabilities(self): ) self.assertContains(response, expected) self.assertContains(response, 'id="tab_vulnerabilities"') - self.assertContains(response, vulnerability1.vcid) + self.assertContains(response, vulnerability1.advisory_id) def test_component_catalog_component_create_ajax_view(self): component_create_ajax_url = reverse("component_catalog:component_add_ajax") @@ -3020,7 +3020,7 @@ def test_package_details_view_tab_vulnerabilities(self): ) self.assertContains(response, expected) self.assertContains(response, 'id="tab_vulnerabilities"') - self.assertContains(response, self.vulnerability1.vcid) + self.assertContains(response, self.vulnerability1.advisory_id) def test_vulnerablecode_get_plain_purls(self): purls = get_plain_purls(packages=[]) @@ -3056,65 +3056,34 @@ def test_vulnerablecode_get_vulnerable_purls(self): with mock.patch( "dejacode_toolkit.vulnerablecode.VulnerableCode.bulk_search_by_purl" ) as bulk_search: - bulk_search.return_value = [] + bulk_search.return_value = {"count": 0, "results": []} vulnerable_purls = vulnerablecode.get_vulnerable_purls(packages=[self.package1]) self.assertEqual([], vulnerable_purls) - bulk_search.return_value = ["pkg:pypi/django@2.1"] + bulk_search.return_value = {"count": 1, "results": ["pkg:pypi/django@2.1"]} vulnerable_purls = vulnerablecode.get_vulnerable_purls(packages=[self.package1]) self.assertEqual(["pkg:pypi/django@2.1"], vulnerable_purls) - def test_vulnerablecode_get_vulnerable_cpes(self): - vulnerablecode = VulnerableCode(self.dataspace) - vulnerable_cpes = vulnerablecode.get_vulnerable_cpes(components=[]) - self.assertEqual([], vulnerable_cpes) - - components = [self.component1, self.component2] - vulnerable_cpes = vulnerablecode.get_vulnerable_cpes(components=components) - self.assertEqual([], vulnerable_cpes) - - self.component1.cpe = "cpe:2.3:a:djangoproject:django:0.95:*:*:*:*:*:*:*" - self.component1.save() - - with mock.patch( - "dejacode_toolkit.vulnerablecode.VulnerableCode.bulk_search_by_cpes" - ) as bulk_search: - bulk_search.return_value = [ - { - "vulnerability_id": "VCID-188m-1bke-aaae", - "summary": "The administrative interface in django.contrib.admin ", - "references": [ - {"reference_id": ""}, - ], - } - ] - vulnerable_cpes = vulnerablecode.get_vulnerable_cpes(components=components) - self.assertEqual([], vulnerable_cpes) - - bulk_search.return_value[0]["references"] = [{"reference_id": self.component1.cpe}] - vulnerable_cpes = vulnerablecode.get_vulnerable_cpes(components=components) - self.assertEqual([self.component1.cpe], vulnerable_cpes) - - @mock.patch("dejacode_toolkit.vulnerablecode.VulnerableCode.request_get") - def test_vulnerablecode_get_vulnerabilities_cache(self, mock_request_get): + @mock.patch("dejacode_toolkit.vulnerablecode.VulnerableCode.bulk_search_by_purl") + def test_vulnerablecode_get_vulnerabilities_cache(self, mock_bulk_search): vulnerablecode = VulnerableCode(self.dataspace) self.package1.set_package_url("pkg:pypi/django@2.1") self.package1.save() - mock_request_get.return_value = { + mock_bulk_search.return_value = { "count": 1, "results": True, } results = vulnerablecode.get_vulnerabilities_by_purl(self.package1.package_url) - self.assertEqual(1, mock_request_get.call_count) + self.assertEqual(1, mock_bulk_search.call_count) self.assertTrue(results) results = vulnerablecode.get_vulnerabilities_by_purl(self.package1.package_url) - # request.get was only called once since the results are returned from the cached + # bulk_search_by_purl was only called once since the results are returned from the cache # on the second call of `get_vulnerabilities_by_purl`. - self.assertEqual(1, mock_request_get.call_count) + self.assertEqual(1, mock_bulk_search.call_count) self.assertTrue(results) def test_send_scan_notification(self): diff --git a/dejacode/settings.py b/dejacode/settings.py index fb026ceb..11a586db 100644 --- a/dejacode/settings.py +++ b/dejacode/settings.py @@ -717,6 +717,7 @@ def get_fake_redis_connection(config, use_strict_redis): # Default to 5 seconds. DEJACODE_INTEGRATION_REQUESTS_TIMEOUT = env.int("DEJACODE_INTEGRATION_REQUESTS_TIMEOUT", default=5) +VULNERABLECODE_USER_AGENT = env.str("VULNERABLECODE_USER_AGENT", default="VCIO_API_AGENT") if IS_TESTS: # Silent the django-axes logging during tests diff --git a/dejacode/static/css/dejacode_bootstrap.css b/dejacode/static/css/dejacode_bootstrap.css index b45e3019..4f0b48fb 100644 --- a/dejacode/static/css/dejacode_bootstrap.css +++ b/dejacode/static/css/dejacode_bootstrap.css @@ -395,7 +395,7 @@ table.packages-table .column-primary_language { } /* -- Vulnerability List -- */ -table.vulnerabilities-table .column-vulnerability_id { +table.vulnerabilities-table .column-advisory_uid { width: 220px; } table.vulnerabilities-table .column-aliases { @@ -413,7 +413,7 @@ table.vulnerabilities-table .column-summary { } /* -- Vulnerability tab -- */ -#tab_vulnerabilities .column-vulnerability_id { +#tab_vulnerabilities .column-advisory_uid { width: 230px; } #tab_vulnerabilities .column-affected_packages { diff --git a/dejacode_toolkit/__init__.py b/dejacode_toolkit/__init__.py index aa246c63..f6f43760 100644 --- a/dejacode_toolkit/__init__.py +++ b/dejacode_toolkit/__init__.py @@ -27,7 +27,7 @@ def get_settings(var_name, default=None): def is_service_available(label, session, url, raise_exceptions): """Check if a configured integration service is available.""" try: - response = session.head(url, timeout=REQUESTS_TIMEOUT) + response = session.head(url, allow_redirects=True, timeout=REQUESTS_TIMEOUT) response.raise_for_status() except requests.exceptions.RequestException as request_exception: logger.debug(f"{label} is_available() error: {request_exception}") @@ -43,6 +43,7 @@ class BaseService: settings_prefix = None url_field_name = None api_key_field_name = None + api_version = None default_timeout = REQUESTS_TIMEOUT def __init__(self, dataspace): @@ -71,6 +72,9 @@ def __init__(self, dataspace): self.api_url = f"{self.service_url.rstrip('/')}/api/" + if self.api_version: + self.api_url = f"{self.api_url}{self.api_version.rstrip('/')}/" + def get_session(self): session = requests.Session() diff --git a/dejacode_toolkit/vulnerablecode.py b/dejacode_toolkit/vulnerablecode.py index 34980dcf..8a0bad69 100644 --- a/dejacode_toolkit/vulnerablecode.py +++ b/dejacode_toolkit/vulnerablecode.py @@ -9,6 +9,7 @@ from django.core.cache import caches from dejacode_toolkit import BaseService +from dejacode_toolkit import get_settings from dejacode_toolkit import logger cache = caches["vulnerabilities"] @@ -19,90 +20,54 @@ class VulnerableCode(BaseService): settings_prefix = "VULNERABLECODE" url_field_name = "vulnerablecode_url" api_key_field_name = "vulnerablecode_api_key" + api_version = "v3" + user_agent = get_settings("VULNERABLECODE_USER_AGENT", default="VCIO_API_AGENT") - def get_vulnerabilities( + def get_session(self): + session = super().get_session() + session.headers.update({"User-Agent": self.user_agent}) + return session + + def get_vulnerabilities_by_purl( self, - url, - field_name, - field_value, + purl, timeout=None, ): - """Get list of vulnerabilities.""" - cached_results = cache.get(field_value) + """Get list of vulnerabilities providing a package `purl`.""" + plain_purl = get_plain_purl(purl) + + cached_results = cache.get(plain_purl) if cached_results: return cached_results - payload = {field_name: field_value} - - response = self.request_get(url=url, params=payload, timeout=timeout) + response = self.bulk_search_by_purl(purls=[plain_purl], timeout=timeout) if response and response.get("count"): results = response["results"] - cache.set(field_value, results) + cache.set(plain_purl, results) return results - def get_vulnerabilities_by_purl( - self, - purl, - timeout=None, - ): - """Get list of vulnerabilities providing a package `purl`.""" - return self.get_vulnerabilities( - url=f"{self.api_url}packages/", - field_name="purl", - field_value=get_plain_purl(purl), - timeout=timeout, - ) - - def get_vulnerabilities_by_cpe( - self, - cpe, - timeout=None, - ): - """Get list of vulnerabilities providing a package or component `cpe`.""" - return self.get_vulnerabilities( - url=f"{self.api_url}cpes/", - field_name="cpe", - field_value=cpe, - timeout=timeout, - ) - def bulk_search_by_purl( self, purls, - purl_only, + details=True, timeout=None, ): """Bulk search of vulnerabilities using the provided list of `purls`.""" - url = f"{self.api_url}packages/bulk_search" + url = f"{self.api_url}packages" data = { "purls": purls, - "purl_only": purl_only, - "plain_purl": True, + "details": details, } logger.debug(f"VulnerableCode: url={url} purls_count={len(purls)}") return self.request_post(url=url, json=data, timeout=timeout) - def bulk_search_by_cpes( - self, - cpes, - timeout=None, - ): - """Bulk search of vulnerabilities using the provided list of `cpes`.""" - url = f"{self.api_url}cpes/bulk_search" - - data = { - "cpes": cpes, - } - - logger.debug(f"VulnerableCode: url={url} cpes_count={len(cpes)}") - return self.request_post(url, json=data, timeout=timeout) - - def get_vulnerable_purls(self, packages, purl_only=True, timeout=10): + def get_vulnerable_purls(self, packages, details=False, timeout=10): """ Return a list of PURLs for which at least one `affected_by_vulnerabilities` was found in the VulnerableCodeDB for the given list of `packages`. + Returns None when the API call fails (e.g. timeout or network error). """ plain_purls = get_plain_purls(packages) @@ -110,62 +75,20 @@ def get_vulnerable_purls(self, packages, purl_only=True, timeout=10): return [] vulnerable_purls = self.bulk_search_by_purl( - plain_purls, - purl_only=purl_only, + purls=plain_purls, + details=details, timeout=timeout, ) - return vulnerable_purls or [] - - def get_vulnerable_cpes(self, components): - """ - Return a list of vulnerable CPEs found in the VulnerableCodeDB for the given - list of `components`. - """ - cpes = [component.cpe for component in components if component.cpe] - - if not cpes: - return [] - - search_results = self.bulk_search_by_cpes(cpes) - if not search_results: - return [] - - vulnerable_cpes = [ - reference.get("reference_id") - for entry in search_results - for reference in entry.get("references") - if reference.get("reference_id").startswith("cpe") - ] - - return list(set(vulnerable_cpes)) + if vulnerable_purls is None: + return None + return vulnerable_purls.get("results") or [] def get_package_url_available_types(self): - # Replace by fetching the endpoint once available. - # https://github.com/aboutcode-org/vulnerablecode/issues/1561#issuecomment-2298764730 - return [ - "alpine", - "alpm", - "apache", - "cargo", - "composer", - "conan", - "deb", - "gem", - "generic", - "github", - "golang", - "hex", - "mattermost", - "maven", - "mozilla", - "nginx", - "npm", - "nuget", - "openssl", - "pypi", - "rpm", - "ruby", - ] + """Return the list of supported package types from the VulnerableCode API.""" + response = self.request_get(f"{self.api_url}package-types") + if isinstance(response, list): + return response + return [] def get_plain_purl(purl_str): diff --git a/dje/outputs.py b/dje/outputs.py index d5b93624..77bf6ec1 100644 --- a/dje/outputs.py +++ b/dje/outputs.py @@ -297,7 +297,7 @@ def get_csaf_product_tree(product): def get_csaf_vulnerability_ids(vulnerability): - ids = [csaf.Id(system_name="VulnerableCode", text=vulnerability.vulnerability_id)] + ids = [csaf.Id(system_name="VulnerableCode", text=vulnerability.advisory_id)] for alias in vulnerability.aliases: prefix = alias.split("-")[0] @@ -399,7 +399,7 @@ def get_openvex_timestamp(): def get_openvex_vulnerability(vulnerability): return openvex.Vulnerability( - name=vulnerability.vulnerability_id, + name=vulnerability.advisory_id, field_id=vulnerability.resource_url, description=vulnerability.summary, aliases=vulnerability.aliases, diff --git a/dje/tests/test_outputs.py b/dje/tests/test_outputs.py index b71f9282..b3b29f25 100644 --- a/dje/tests/test_outputs.py +++ b/dje/tests/test_outputs.py @@ -52,18 +52,18 @@ def setUp(self): make_product_package(self.product1, package3) vulnerability1 = make_vulnerability( self.dataspace, - vulnerability_id="VCID-0001", - resource_url="https://public.vulnerablecode.io/vulnerabilities/VCID-0001", + advisory_id="ID-0001", + resource_url="https://public.vulnerablecode.io/vulnerabilities/ID-0001", aliases=["CVE-1984-1010"], affecting=[package1], ) vulnerability2 = make_vulnerability( self.dataspace, - vulnerability_id="VCID-0002", - resource_url="https://public.vulnerablecode.io/vulnerabilities/VCID-0002", + advisory_id="ID-0002", + resource_url="https://public.vulnerablecode.io/vulnerabilities/ID-0002", affecting=[package2], ) - make_vulnerability(self.dataspace, vulnerability_id="VCID-0003", affecting=[package3]) + make_vulnerability(self.dataspace, advisory_id="ID-0003", affecting=[package3]) make_vulnerability_analysis( product_package1, @@ -166,7 +166,7 @@ def test_outputs_get_cyclonedx_bom_include_vex(self): ) self.assertIsInstance(bom, cyclonedx_bom.Bom) self.assertEqual(4, len(bom.vulnerabilities)) - self.assertEqual(vulnerability1.vulnerability_id, bom.vulnerabilities[0].id) + self.assertEqual(vulnerability1.advisory_id, bom.vulnerabilities[0].id) self.assertIsNone(bom.vulnerabilities[0].analysis) analysis1 = make_vulnerability_analysis(product_package1, vulnerability1) diff --git a/dje/tests/testfiles/outputs/csaf_security_advisory.csaf.json b/dje/tests/testfiles/outputs/csaf_security_advisory.csaf.json index 7dc0f09d..fe5832dc 100644 --- a/dje/tests/testfiles/outputs/csaf_security_advisory.csaf.json +++ b/dje/tests/testfiles/outputs/csaf_security_advisory.csaf.json @@ -53,7 +53,7 @@ "ids": [ { "system_name": "VulnerableCode", - "text": "VCID-0001" + "text": "ID-0001" }, { "system_name": "Common Vulnerabilities and Exposures", @@ -85,7 +85,7 @@ "ids": [ { "system_name": "VulnerableCode", - "text": "VCID-0002" + "text": "ID-0002" } ], "notes": [ @@ -113,7 +113,7 @@ "ids": [ { "system_name": "VulnerableCode", - "text": "VCID-0003" + "text": "ID-0003" } ], "notes": [ diff --git a/dje/tests/testfiles/outputs/openvex_document.json b/dje/tests/testfiles/outputs/openvex_document.json index 455557d1..83bdfa84 100644 --- a/dje/tests/testfiles/outputs/openvex_document.json +++ b/dje/tests/testfiles/outputs/openvex_document.json @@ -7,8 +7,8 @@ "statements": [ { "vulnerability": { - "name": "VCID-0001", - "@id": "https://public.vulnerablecode.io/vulnerabilities/VCID-0001", + "name": "ID-0001", + "@id": "https://public.vulnerablecode.io/vulnerabilities/ID-0001", "description": "", "aliases": [ "CVE-1984-1010" @@ -27,8 +27,8 @@ }, { "vulnerability": { - "name": "VCID-0002", - "@id": "https://public.vulnerablecode.io/vulnerabilities/VCID-0002", + "name": "ID-0002", + "@id": "https://public.vulnerablecode.io/vulnerabilities/ID-0002", "description": "", "aliases": [] }, @@ -45,7 +45,7 @@ }, { "vulnerability": { - "name": "VCID-0003", + "name": "ID-0003", "@id": "", "description": "", "aliases": [] diff --git a/docs/reference-vulnerability-management.rst b/docs/reference-vulnerability-management.rst index 34d95c1c..f4a61c74 100644 --- a/docs/reference-vulnerability-management.rst +++ b/docs/reference-vulnerability-management.rst @@ -117,8 +117,8 @@ The **Vulnerability** model in DejaCode provides detailed information about soft vulnerabilities. Each field captures specific aspects of a vulnerability, enabling accurate assessment and management. Below is a description of the key fields: -- **vulnerability_id**: - A unique identifier for the vulnerability. For example, **"VCID-2024-0001"**. +- **advisory_id**: + A unique identifier for the vulnerability. For example, **"PYSEC-2020-2233"**. - **resource_url**: The URL of the data source providing details about the vulnerability. diff --git a/product_portfolio/api.py b/product_portfolio/api.py index a84d3439..c1ea0ea6 100644 --- a/product_portfolio/api.py +++ b/product_portfolio/api.py @@ -196,8 +196,8 @@ class ProductFilterSet(DataspacedAPIFilterSet): field_name="packages__affected_by_vulnerabilities", ) affected_by = django_filters.CharFilter( - field_name="packages__affected_by_vulnerabilities__vulnerability_id", - label="Affected by (vulnerability_id)", + field_name="packages__affected_by_vulnerabilities__advisory_id", + label="Affected by (advisory_id)", ) class Meta: @@ -751,8 +751,8 @@ class ProductPackageFilterSet(DataspacedAPIFilterSet): field_name="package__affected_by_vulnerabilities", ) affected_by = django_filters.CharFilter( - field_name="package__affected_by_vulnerabilities__vulnerability_id", - label="Affected by (vulnerability_id)", + field_name="package__affected_by_vulnerabilities__advisory_id", + label="Affected by (advisory_id)", ) class Meta: diff --git a/product_portfolio/filters.py b/product_portfolio/filters.py index c3ad11e8..98f6f369 100644 --- a/product_portfolio/filters.py +++ b/product_portfolio/filters.py @@ -138,7 +138,7 @@ class ProductFilterSet(DataspacedFilterSet): widget=DropDownRightWidget(link_content=''), ) affected_by = django_filters.CharFilter( - field_name="packages__affected_by_vulnerabilities__vulnerability_id", + field_name="packages__affected_by_vulnerabilities__advisory_id", label=_("Affected by"), ) productpackage_licenses = django_filters.CharFilter( diff --git a/product_portfolio/templates/product_portfolio/compliance/compliance_panels.html b/product_portfolio/templates/product_portfolio/compliance/compliance_panels.html index 43ce4e46..92c0fe29 100644 --- a/product_portfolio/templates/product_portfolio/compliance/compliance_panels.html +++ b/product_portfolio/templates/product_portfolio/compliance/compliance_panels.html @@ -192,7 +192,7 @@

{% trans "Security compliance" %}

{% endif %} - {{ vulnerability.vulnerability_id }} + {{ vulnerability.advisory_id }} {{ vulnerability.summary|truncatechars:70 }}
diff --git a/product_portfolio/templates/product_portfolio/compliance/compliance_vulnerabilities_card.html b/product_portfolio/templates/product_portfolio/compliance/compliance_vulnerabilities_card.html index 60089149..190ac720 100644 --- a/product_portfolio/templates/product_portfolio/compliance/compliance_vulnerabilities_card.html +++ b/product_portfolio/templates/product_portfolio/compliance/compliance_vulnerabilities_card.html @@ -15,18 +15,18 @@

{% if vulnerability.resource_url %} - {{ vulnerability.vulnerability_id }} + {{ vulnerability.advisory_id }} {% else %} - {{ vulnerability.vulnerability_id }} + {{ vulnerability.advisory_id }} {% endif %} {% if vulnerability.risk_level == 'critical' %} - + {{ vulnerability.product_count }} product{{ vulnerability.product_count|pluralize }} {% else %} - + {{ vulnerability.product_count }} product{{ vulnerability.product_count|pluralize }} {% endif %} diff --git a/product_portfolio/templates/product_portfolio/compliance/compliance_watchlist_card.html b/product_portfolio/templates/product_portfolio/compliance/compliance_watchlist_card.html index 2e1bdb4d..73ad45c3 100644 --- a/product_portfolio/templates/product_portfolio/compliance/compliance_watchlist_card.html +++ b/product_portfolio/templates/product_portfolio/compliance/compliance_watchlist_card.html @@ -44,7 +44,7 @@

{{ product.low_count }} low {% endif %} {% if not product.critical_count and not product.high_count and not product.medium_count and not product.low_count %} - None + None {% endif %} diff --git a/product_portfolio/templates/product_portfolio/modals/vulnerability_analysis_modal.html b/product_portfolio/templates/product_portfolio/modals/vulnerability_analysis_modal.html index 1f716ec7..e1e268c2 100644 --- a/product_portfolio/templates/product_portfolio/modals/vulnerability_analysis_modal.html +++ b/product_portfolio/templates/product_portfolio/modals/vulnerability_analysis_modal.html @@ -7,7 +7,7 @@

Vulnerability analysis: - +
diff --git a/product_portfolio/templates/product_portfolio/product_details.html b/product_portfolio/templates/product_portfolio/product_details.html index 7af09625..cfe9dbeb 100644 --- a/product_portfolio/templates/product_portfolio/product_details.html +++ b/product_portfolio/templates/product_portfolio/product_details.html @@ -292,11 +292,11 @@ let button = $(event.relatedTarget); // Button that triggered the modal // Extract info from data-* attributes let edit_url = button.data('edit-url'); - let vulnerability_id = button.data('vulnerability-id'); + let advisory_uid = button.data('advisory-uid'); let package_identifier = button.data('package-identifier'); $('#submit-vulnerability-analysis-form').data('edit-url', edit_url); - $('#vulnerability-analysis-modal #analysis-vulnerability-id').text(vulnerability_id); + $('#vulnerability-analysis-modal #analysis-advisory-uid').text(advisory_uid); $('#vulnerability-analysis-modal #analysis-package-identifier').text(package_identifier); $.ajax({ diff --git a/product_portfolio/templates/product_portfolio/tabs/tab_packages_vulnerabilities.html b/product_portfolio/templates/product_portfolio/tabs/tab_packages_vulnerabilities.html index 211d25d0..43ed66a3 100644 --- a/product_portfolio/templates/product_portfolio/tabs/tab_packages_vulnerabilities.html +++ b/product_portfolio/templates/product_portfolio/tabs/tab_packages_vulnerabilities.html @@ -44,11 +44,11 @@ {% if vulnerability.resource_url %} - {{ vulnerability.vulnerability_id }} + {{ vulnerability.advisory_id }} {% else %} - {{ vulnerability.vulnerability_id }} + {{ vulnerability.advisory_id }} {% endif %} {% if vulnerability.summary %} @@ -102,9 +102,9 @@