-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
insertVulnerabilityFixedInFeature: pq: duplicate key value violates unique constraint #238
Comments
Same thing here, has anyone resolved this issue? |
Hi, This issue looks repeatable and pretty critical, I'll free some time next week to take a look! |
the same issue |
We're also getting this error. Using the same instructions in the README with docker-compose. Any updates on this issue? |
Are there any workarounds for this yet? |
Red Hat's OVAL files com.redhat.rhsa-20090382.xml and com.redhat.rhsa-20090045.xml describe RHSA-2009:0382-01 and RHSA-2009:0382-02 respectively; these are two releases of the same RHSA with only minor differences. Clair 1.2.x disregards the '-xx' revision suffix and attempts to insert data for both releases as RHSA-2009:0382, which violates the database uniqueness constraint. I've had success working around this by explicitly skipping com.redhat.rhsa-20090382.xml (the older release) with a minor edit to the RHEL fetcher: --- a/updater/fetchers/rhel/rhel.go
+++ b/updater/fetchers/rhel/rhel.go
@@ -116,7 +116,7 @@ func (f *RHELFetcher) FetchUpdate(datastore database.Datastore) (resp updater.Fe
r := rhsaRegexp.FindStringSubmatch(line)
if len(r) == 2 {
rhsaNo, _ := strconv.Atoi(r[1])
- if rhsaNo > firstRHSA {
+ if rhsaNo > firstRHSA && rhsaNo != 20090382 {
rhsaList = append(rhsaList, rhsaNo)
}
} |
@Quentin-M Do you have any plan to fix this? |
The revision suffix is never parsed because the name is extracted from the While the Debian and Ubuntu fetchers maintain an internal list of vulnerabilities to keep them unique at return time, the RHEL/OVAL fetcher does not. However, doVulnerabilitiesNamespacing catches the duplicates and merge them. Unfortunately, its logic is somewhat limited in the sense that it does not verify that FixedIn features are unique. The single vulnerability will the duplicated FixedIn goes all the way to insertVulnerabilityFixedInFeatureVersions, which tries to insert the relationship between the vulnerability and the feature twice. Therefore, while we could fix the issue at multiple levels, I think that the most durable solution would be to harden Now, what's scarier about this whole thing is that RHEL may have added an errata with an old date? Both advisories are dated 2009 / 2011, timestamped 2015 but we didn't encounter this issue before and I don't see any code change that might have introduced it. Also, the updated errata ( |
I think it's safe to rely on the unique constraint in the database. Clair's storage is inherently relational, so I don't think we ever plan to support a database layer that doesn't have unique indices. |
@jzelinskie Agreed. In the early stages of the project, most of the database tests were implementation agnostic and were running on each registered implementation. But it got removed after an internal discussion for a silly reason that I can't seem to remember. I extended the pgsql's tests to cover this case. What about creating a follow-up issue to extract as many tests as possible from the pgsql implementation and put them at the database level instead? |
sgtm |
Just tested clair for the first time. Followed the instructions in README.md running with docker-compose so the image is: quay.io/coreos/clair
After a few hours running i get duplicate key error when updateing.
The text was updated successfully, but these errors were encountered: