Skip to content

VCIO-next: Design new Improver #1395

Description

@pombredanne

Context

Improvers are scripts that take a bunch of objects as an input and can selectively improve the data about packages and vulnerabilities. The current design is that Importers create Advisories and then a "Default Improver" does an actual proper Import of the data through an intermediate "Inference" object.

Other improvers have the same overall model:

  • An Improver subclass implements an "interesting_advisories" method
  • And then implements a "get_inferences" method that takes AvisoryData (a plain object not a model instance) and yields Inferences

The management command will control all this.

Problem

With the current design, we cannot do several things:

  • We cannot improve if there are no advisories. For instance we cannot loop through some Package or Vulnerabilities
  • We cannot do arbitrary operations on the data: we must go through an Inference
  • We cannot control the frequency/periodicity at which we run improvers

Because of all this, there is also confusion in the community about how to add new improvers.

Solution

We should simplify improvers to the max.

An Improver should be a class that has a label, description and some run frequency and should have just an improve() method that can do ANYTHING it likes.

The default improver should be retired and its code merged in the Importer loop instead.

See also these related issues:

Activity

  1. changed the title [-]Design new Improver[/-] [+]RFC: Design new Improver[/+] on Jan 11, 2024
  2. pombredanne commented on Jan 11, 2024

    @pombredanne
    MemberAuthor
  3. pombredanne commented on Jan 11, 2024

    @pombredanne
    MemberAuthor

    Should we wait for the model refactoring?

    I think not. In all cases we will have to amend improvers to work with the new models. We have many improvement work blocked by this current issue #1395 ... we may end up doing a bit more work if we do not wait, but this is marginal IMHO compared to waiting

  4. armijnhemel commented on Jan 15, 2024

    @armijnhemel
    Contributor

    Another solution is to create "pseudo-advisories", for example, one per purl.

  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 Aug 5, 2024

    @pombredanne
    MemberAuthor

    @keshav-space is this what you are working on with the pipelines?

  8. keshav-space commented on Aug 5, 2024

    @keshav-space
    Member

    @keshav-space is this what you are working on with the pipelines?

    @pombredanne yes!

  9. added a commit that references this issue on Aug 26, 2024
  10. 3 remaining items

  11. changed the title [-]RFC: Design new Improver[/-] [+]VCIO-next: Design new Improver[/+] on Dec 23, 2024
  12. pombredanne commented on Jan 9, 2025

    @pombredanne
    MemberAuthor

    The design has been completed: we are now using the aboutcode.pipelines library extracted from scancode.io for both importers and improvers. Migrations is in progress and tracked in:

  13. keshav-space commented on Mar 28, 2025

    @keshav-space
    Member

    Completed in: #1559 and #1621

    The simple way to test this is to follow the below steps after installing VulnerableCode (https://github.com/aboutcode-org/vulnerablecode?tab=readme-ov-file#run-with-docker):

    1. Run pipeline to flag ghost packages docker compose exec vulnerablecode ./manage.py improve flag_ghost_packages
    2. Browse the packages here http://127.0.0.1/ to find out if the package is ghost. OR ( see an already flagged ghost package here https://public.vulnerablecode.io/packages/pkg:maven/log4j/log4j@2.17.0)
    3. Also find the documentation for new improver here https://vulnerablecode.readthedocs.io/en/latest/tutorial_add_improver_pipeline.html
  14. 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