Repository navigation
Conversation
update_references was add-only, so a CVE or bugzilla Red Hat removed from an advisory stayed on our errata and in the published updateinfo.xml. With the new opt-in prune flag, stored cve/bugzilla references missing from the payload are removed from the DB record and from already released Pulp advisories, which are then republished. rhsa and self references are never pruned. References are bulk deleted on purpose: both NewErrataReference relationships cascade deletes, so an ORM delete would also remove the advisory and the ErrataCVE row shared with other advisories.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /api/v1/errata/update_references/was add-only. When Red Hat drops a wrongly attributed CVE or bugzilla from an advisory, public-errata-parser's refresh can't remove it, so it stays on our errata and in the publishedupdateinfo.xml. Scanners then report the CVE as fixed by an AlmaLinux advisory that doesn't fix it.This adds an opt-in
pruneflag. With it, the payload is taken as the advisory's complete upstream reference set, and storedcve/bugzillareferences missing from it are removed.rhsaandselfreferences are never pruned.Changes
alws/schemas/errata_schema.py:UpdateErrataReferencesRequest.prune, defaultFalse, so existing callers keep the add-only behaviour.alws/crud/errata.py:add_missing_errata_references()→sync_errata_references(). It adds the missing references as before, and withpruneit removes the stalecve/bugzillaones. It returns the added and removedref_ids.DELETEon purpose. BothNewErrataReferencerelationships usecascade="all, delete", so an ORM delete would also delete the errata record and theErrataCVErow, which other advisories share. Deleting that row would in turn cascade, through its FK, into those advisories' references.append_references_in_update_records()→sync_references_in_update_records(). It now also deletes Pulpcve/bugzillareferences that aren't on the DB record anymore, so released advisories match the DB.alws/routers/errata.py: a released record is reconciled in Pulp (theupdate_errata_referencesactor, whose signature is unchanged) when references were added or removed.Testing
tests/test_api/test_errata.py: new test covering add, no-prune (nothing removed), prune (only the dropped CVE goes,rhsa/bugzilla/selfstay), a repeated prune, and theErrataCVErow and errata record surviving the removal.tests/test_unit/test_errata.py: new test for the Pulp reference sync (stalecve/bugzilladeleted,selfkept, missing ones appended).tests/test_oval, as inrun-tests.sh): 303 passed, 10 skipped.Deployment
Can be deployed independently of the parser change. Old ALBS ignores the unknown
prunefield, and old parser versions never send it.