Skip to content

Drop legacy OSV aliases from Ruby advisories - #2431

Open
hardikkaurani wants to merge 1 commit into
aboutcode-org:mainfrom
hardikkaurani:fix/drop-osv-ruby-aliases-2421
Open

Drop legacy OSV aliases from Ruby advisories#2431
hardikkaurani wants to merge 1 commit into
aboutcode-org:mainfrom
hardikkaurani:fix/drop-osv-ruby-aliases-2421

Conversation

@hardikkaurani

Copy link
Copy Markdown

Problem

Ruby advisory importers (ruby_importer_v2 and legacy ruby) synthesize OSV-{osvdb_id} aliases from the legacy osvdb field in rubysec/ruby-advisory-db. These are defunct, non-public OSVDB identifiers that collide with the modern OSV.dev namespace (OSV-<year>-<number>).

Solution

  • Prune synthesis of OSV-{osvdb} from get_aliases() in both vulnerabilities/pipelines/v2_importers/ruby_importer.py and vulnerabilities/importers/ruby.py.
  • Update test fixture CVE-2010-1330-expected.json to drop obsolete OSV-77297.
  • Add unit test coverage in vulnerabilities/tests/pipelines/v2_importers/test_ruby_importer_v2.py verifying that OSVDB IDs are dropped while legitimate CVE and GHSA aliases are preserved across all permutations.
  • Add data migration 0143_drop_osv_aliases.py:
    • Prunes legacy AdvisoryAlias and Alias records matching ^OSV-\d+$, preserving authentic modern OSV-<year>-<number> identifiers and other aliases.
    • Recomputes unique_content_id for affected AdvisoryV2 records using standalone helper functions compatible with Django historical models.
    • Uses chunked iteration and batched bulk_update for database efficiency.
  • Add migration test in vulnerabilities/tests/test_data_migrations.py.

Testing

  • pytest vulnerabilities/tests/pipelines/v2_importers/test_ruby_importer_v2.py -k "test_get_aliases": 4 passed
  • pytest vulnerabilities/tests/test_ruby.py: 7 passed
  • Migration test verifying alias pruning, preservation of OSV-<year>-<number>, and unique_content_id recomputation passed.
  • black and isort code formatting verified.

Fixes #2421

…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>
Copilot AI lite review requested due to automatic review settings September 14, 2026 07:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drop "OSV" aliases from rubygem data sources

2 participants