Skip to content

VCIO-next: Design new Advisory -> Package -> Vulnerability models relationhips #1393

Closed

Description

@pombredanne

Context

In our current approach, we aggregate data from multiple advisories in a single vulnerability which is unique based on its aliases.

Problem

An Advisory may be strictly about a given Package ecosystem, and provide a score just for an ecosystem. Therefore, if we merge and combine everything in a single Vulnerability, we can end up with misleading data or messy data. In some other cases, we historically mixed importing and improving, leading to performance and confusion issues.

For instance we have these issues:

Solution

The relationship should not be between a Package and a Vulnerability but rather a Package and an Advisory, and an Advisory to a Vulnerability.
Similarly, scores, categories and references may be specific to an Advisory and not about all the packages subject to a Vulnerability.

In this design we would essentially adopt a structure similar to that of VulnTotal
where multiple advisories are either concurring to the same impact conclusion or may disagree (which becomes a problem that needs curation either with a manual review or improvers)

Severity may also need some rethinking as they are from an Advisory and specific to some packages in many cases. For instance the severity/scores published by RedHat are only about the RPM packaging of a vulnerable package, not about any package or upstream in general.

See also:

@Hritik14 @TG1999 @keshav-space @DennisClark

Activity

  1. changed the title [-]Design new Advisory -> Package -> Vulnerability models relationhips[/-] [+]RFC: Design new Advisory -> Package -> Vulnerability models relationhips[/+] on Jan 11, 2024
  2. pombredanne commented on Jan 11, 2024

    @pombredanne
    MemberAuthor

    Some random notes:

    • an Improver can fix data bugs. These need to run only once sometimes, and are almost like data migrations, but we do not want data migrations for them as they can run while the system is used and available.
    • an Improver can improve data and in this case it needs to run more than once
    • an Improver can also create new data based on fetching external data. This is almost like an improver would be an advisory source in this case. Should we treat an Improver as an advisory?
    • we need to run improvers in parallel
  3. pombredanne commented on Jan 11, 2024

    @pombredanne
    MemberAuthor

    This is a major refactoring of the models with major implications on the UI and the API since Advisories would become of first-class objects.

    We could possibly create some facade and adapters such that in the short term we can do model changes and do not need to refactor the whole UI and API.

    This would be more work but would avoid breaking things upfront.

    Here is a first possible approach with ghost relationships

    1. We create the Advisory to Vulnerability relationships and a Package relationship in this relationship. This would not change the current models and the API and UI stay the same. We populate these relationship with improvers and/data migrations and progressively update all importers to use and populate these models. We still merge the data in the advisory record.

    2. Progressively we update the UI and create a new version of the API that will use the new data structure. At some point of time, we stop update the legacy Vulnerability fields

    Another approach is to create new models

    We would create and will use in parallel a full set of new duplicated models like Package2, Vulnerability2 and so on have a v2 of the UI and API.

    At some point in the future we would deprecate and retire the old models, UI and API. This is more work and some duplicated code, BUT means less instability.

  4. pombredanne commented on Jan 11, 2024

    @pombredanne
    MemberAuthor

    After discussion this is preferred:

    Here is a first possible approach with ghost relationships

    • We create the Advisory to Vulnerability relationships and a Package relationship in this relationship. This would not change the current models and the API and UI stay the same. We populate these relationship with improvers and/data migrations and progressively update all importers to use and populate these models. We still merge the data in the advisory record.

    • Progressively we update the UI and create a new version of the API that will use the new data structure. At some point of time, we stop update the legacy Vulnerability fields

    We will therefore have progressively a new v2 API and v2 UI in small chunks and will avoid wrecking everything.

  5. added this to the v34.0.0 milestone on Jan 30, 2024
  6. self-assigned this
    on Feb 6, 2024
  7. pombredanne commented on Oct 15, 2024

    @pombredanne
    MemberAuthor

    See also:

    We could add a field at the advisory level to track its license, but we are tracking the license consistently for each importer already. Just food for thoughts.

  8. removed this from the v35.0.0 - 2-next milestone on Oct 15, 2024
  9. 3 remaining items

  10. changed the title [-]RFC: Design new Advisory -> Package -> Vulnerability models relationhips[/-] [+]VCIO-next: Design new Advisory -> Package -> Vulnerability models relationhips[/+] on Dec 23, 2024
  11. moved this to In Progress in 04-VulnerableCode nexton Jan 28, 2025
  12. TG1999 commented on Apr 3, 2025

    @TG1999
    Contributor
  13. added a commit that references this issue on Jul 1, 2025
  14. TG1999 commented on Jul 11, 2025

    @TG1999
    Contributor

    This is done now!

    PRs for references:
    #1866

    To test this:
    Set up Vulnerablecode on your system locally and run a new V2 importer pipeline for example:

    ./manage.py import gitlab_importer_v2

    Then do ./manage.py shell to test newly introduced models. AdvisoryV2, PackageV2

    AdvisoryV2.objects.all()
    PackageV2.objects.all()

  15. moved this from Done to Validated in 04-VulnerableCode nexton Jul 15, 2025
  16. moved this from Validated to Done in 04-VulnerableCode nexton Jul 15, 2025
  17. moved this from Done to Validated in 04-VulnerableCode nexton Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions