Drop legacy OSV aliases from Ruby advisories - #2431
Open
hardikkaurani wants to merge 1 commit into
Open
Conversation
…sting records Resolves aboutcode-org#2421: - Remove synthesis of OSV-{osvdb_id} aliases from osvdb field in v2 and v1 Ruby importers - Add data migration 0143 to prune orphaned AdvisoryAlias and Alias records matching OSV-\\d+ and recompute unique_content_id on affected advisories - Update test fixture CVE-2010-1330-expected.json - Add unit tests verifying get_aliases drops osvdb without affecting CVE and GHSA aliases - Add migration test in test_data_migrations.py Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
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.
Problem
Ruby advisory importers (
ruby_importer_v2and legacyruby) synthesizeOSV-{osvdb_id}aliases from the legacyosvdbfield inrubysec/ruby-advisory-db. These are defunct, non-public OSVDB identifiers that collide with the modern OSV.dev namespace (OSV-<year>-<number>).Solution
OSV-{osvdb}fromget_aliases()in bothvulnerabilities/pipelines/v2_importers/ruby_importer.pyandvulnerabilities/importers/ruby.py.CVE-2010-1330-expected.jsonto drop obsoleteOSV-77297.vulnerabilities/tests/pipelines/v2_importers/test_ruby_importer_v2.pyverifying that OSVDB IDs are dropped while legitimate CVE and GHSA aliases are preserved across all permutations.0143_drop_osv_aliases.py:AdvisoryAliasandAliasrecords matching^OSV-\d+$, preserving authentic modernOSV-<year>-<number>identifiers and other aliases.unique_content_idfor affectedAdvisoryV2records using standalone helper functions compatible with Django historical models.bulk_updatefor database efficiency.vulnerabilities/tests/test_data_migrations.py.Testing
pytest vulnerabilities/tests/pipelines/v2_importers/test_ruby_importer_v2.py -k "test_get_aliases": 4 passedpytest vulnerabilities/tests/test_ruby.py: 7 passedOSV-<year>-<number>, andunique_content_idrecomputation passed.blackandisortcode formatting verified.Fixes #2421