Skip to content

Commit 3407b4a

Browse files
committed
Fix gitlab importer advisory ID
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent 822bcfe commit 3407b4a

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

vulnerabilities/api_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def get_fixing_vulnerabilities(self, obj):
349349
# Ghost package should not fix any vulnerability.
350350
if obj.is_ghost:
351351
return []
352-
return [adv.advisory_id for adv in obj.fixing_advisories.all()]
352+
return [adv.avid for adv in obj.fixing_advisories.all()]
353353

354354

355355
class PackageurlListSerializer(serializers.Serializer):

vulnerabilities/importer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def __post_init__(self):
160160
self.reference_id = str(self.reference_id)
161161

162162
def __lt__(self, other):
163-
if not isinstance(other, Reference):
163+
if not isinstance(other, ReferenceV2):
164164
return NotImplemented
165165
return self._cmp_key() < other._cmp_key()
166166

vulnerabilities/pipelines/v2_importers/gitlab_importer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ def parse_gitlab_advisory(
245245
date_published = dateparser.parse(gitlab_advisory.get("pubdate"))
246246
date_published = date_published.replace(tzinfo=pytz.UTC)
247247
package_slug = gitlab_advisory.get("package_slug")
248+
advisory_id = f"{package_slug}/{advisory_id}" if package_slug else advisory_id
248249
advisory_url = get_advisory_url(
249250
file=file,
250251
base_path=base_path,

0 commit comments

Comments
 (0)