Skip to content

BUG: Duplicate packages with same PURL break SBOM import and DejaCode component catalog #295

@rogu-beta

Description

@rogu-beta

Describe the bug
Importing an SBOM results in errors for several packages:

{'__all__': ['Package with this Dataspace, Type, Namespace, Name, Version, Qualifiers, Subpath, Download URL and Filename already exists.']}

Comparing the content of the SBOM with the inventory as well as existing package revealed, that the issue is caused by duplicate packages in the component catalog. Apparently there are packages with the same PURL, hash, type, name, and version. One is properly populated with scan data, while the other is not. (Edit: It seems that the above error is caused when there is an existing package without a download url, see #295 (comment) for the two distinct cases). I suspect the duplicate/broken one was formerly associated with a project that has since been deleted.

The even bigger issue is that while we can see those packages in the regular UI, they do not get shown in the admin's dashboard when searching for its name. Thus, deleting over 400 affected ones is a bit of a challenge, given that the error message does not indicate which specific packages cause the issue.

It seems that there is some uniqueness constraint not properly checked when importing SBOMs, as all packages have been imported through SBOMs.

To Reproduce
Unclear

Expected behavior
DejaCode should not allow to create duplicate packages through imported SBOMs.

Screenshots

Image

Image

Image

Context (OS, Browser, Device, etc.):
n.a.

Metadata

Metadata

Assignees

Labels

HighPriorityHigh PrioritybugSomething isn't workingdesign neededDesign details needed to complete the issueenhancementNew feature or requestintegrationIntegration with other applications

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions