Skip to content

Commit b26cd93

Browse files
authored
Merge pull request #1222 from TG1999/remove_old_fields
Drop duplicated fields from API response and add missing quotes for href values in template
2 parents 16af83f + d7d7d06 commit b26cd93

File tree

7 files changed

+12
-36
lines changed

7 files changed

+12
-36
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ Release notes
22
=============
33

44

5+
Version v33.0.0
6+
-----------------
7+
8+
- We have dropped ``unresolved_vulnerabilities`` from /api/package endpoint API response.
9+
- We have added missing quotes for href values in template.
10+
11+
512
Version v32.0.1
613
-----------------
714

SOURCES.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
+----------------+------------------------------------------------------------------------------------------------------+----------------------------------------------------+
1414
|ruby | https://github.com/rubysec/ruby-advisory-db.git |ruby gems |
1515
+----------------+------------------------------------------------------------------------------------------------------+----------------------------------------------------+
16-
|ubuntu | https://people.canonical.com/~ubuntu-security/oval/ |ubuntu packages |
16+
|ubuntu | |ubuntu packages |
1717
+----------------+------------------------------------------------------------------------------------------------------+----------------------------------------------------+
1818
|retiredotnet | https://github.com/RetireNet/Packages.git |.NET packages |
1919
+----------------+------------------------------------------------------------------------------------------------------+----------------------------------------------------+

vulnerabilities/api.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,6 @@ class PackageSerializer(serializers.HyperlinkedModelSerializer):
124124
Lookup software package using Package URLs
125125
"""
126126

127-
def to_representation(self, instance):
128-
data = super().to_representation(instance)
129-
data["unresolved_vulnerabilities"] = data["affected_by_vulnerabilities"]
130-
return data
131-
132127
purl = serializers.CharField(source="package_url")
133128

134129
affected_by_vulnerabilities = serializers.SerializerMethodField("get_affected_vulnerabilities")

vulnerabilities/templates/package_details.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<td>
6767
{% for alias in vulnerability.alias %}
6868
{% if alias.url %}
69-
<a href={{ alias.url }} target="_blank">{{ alias }}<i class="fa fa-external-link fa_link_custom"></i></a>
69+
<a href="{{ alias.url }}" target="_blank">{{ alias }}<i class="fa fa-external-link fa_link_custom"></i></a>
7070
<br />
7171
{% else %}
7272
{{ alias }}
@@ -113,7 +113,7 @@
113113
<td>
114114
{% for alias in vulnerability.alias %}
115115
{% if alias.url %}
116-
<a href={{ alias.url }} target="_blank">{{ alias }}<i class="fa fa-external-link fa_link_custom"></i></a>
116+
<a href="{{ alias.url }}" target="_blank">{{ alias }}<i class="fa fa-external-link fa_link_custom"></i></a>
117117
<br />
118118
{% else %}
119119
{{ alias }}

vulnerabilities/templates/vulnerabilities.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<td>
4949
{% for alias in vulnerability.alias %}
5050
{% if alias.url %}
51-
<a href={{ alias.url }} target="_blank">{{ alias }}
51+
<a href="{{ alias.url }}" target="_blank">{{ alias }}
5252
<i class="fa fa-external-link fa_link_custom"></i>
5353
</a>
5454
{% else %}

vulnerabilities/templates/vulnerability_details.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<td class="two-col-right">
6969
{% for alias in aliases %}
7070
{% if alias.url %}
71-
<a href={{ alias.url }} target="_blank">{{ alias }}<i class="fa fa-external-link fa_link_custom"></i></a>
71+
<a href="{{ alias.url }}" target="_blank">{{ alias }}<i class="fa fa-external-link fa_link_custom"></i></a>
7272
{% else %}
7373
{{ alias }}
7474
{% endif %}

vulnerabilities/tests/test_api.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -362,16 +362,6 @@ def test_api_with_single_vulnerability_and_fixed_package(self):
362362
"aliases": ["CVE-2029-1234"],
363363
},
364364
],
365-
"unresolved_vulnerabilities": [
366-
{
367-
"url": f"http://testserver/api/vulnerabilities/{self.vuln1.id}",
368-
"vulnerability_id": self.vuln1.vulnerability_id,
369-
"summary": "test-vuln1",
370-
"references": [],
371-
"fixed_packages": [],
372-
"aliases": ["CVE-2019-1234", "GMS-1234-4321"],
373-
}
374-
],
375365
}
376366

377367
def test_api_with_single_vulnerability_and_vulnerable_package(self):
@@ -402,22 +392,6 @@ def test_api_with_single_vulnerability_and_vulnerable_package(self):
402392
}
403393
],
404394
"fixing_vulnerabilities": [],
405-
"unresolved_vulnerabilities": [
406-
{
407-
"url": f"http://testserver/api/vulnerabilities/{self.vuln.id}",
408-
"vulnerability_id": self.vuln.vulnerability_id,
409-
"summary": "test-vuln",
410-
"references": [],
411-
"fixed_packages": [
412-
{
413-
"url": f"http://testserver/api/packages/{self.package.id}",
414-
"purl": "pkg:generic/nginx/test@11",
415-
"is_vulnerable": True,
416-
}
417-
],
418-
"aliases": ["CVE-2029-1234"],
419-
}
420-
],
421395
}
422396

423397
def test_api_with_all_vulnerable_packages(self):

0 commit comments

Comments
 (0)