Skip to content

Conversation

@ziadhany
Copy link
Collaborator

@ziadhany ziadhany commented Nov 3, 2025

  • Introduce affected_by_commits and fixed_by_commits fields in our advisory
  • Update from_dict and to_dict methods
  • Update compute_checksum method
  • Create a CodeCommitData importer class
  • Update OSV to collect code fix commits

… in Advisory

Signed-off-by: ziad hany <ziadhany2016@gmail.com>
@ziadhany ziadhany force-pushed the advisory-fix-commit-1 branch from 2af10cf to a8ec9f1 Compare November 4, 2025 15:58
@ziadhany ziadhany marked this pull request as ready for review November 4, 2025 16:01
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
@ziadhany ziadhany changed the title Add support for affected_by_commits and fixed_by_commits Add support for affected_by_commits, fixed_by_commits, and OSV code fix commits Nov 5, 2025
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
@ziadhany ziadhany requested review from TG1999 and keshav-space and removed request for keshav-space November 5, 2025 15:40
@TG1999
Copy link
Contributor

TG1999 commented Nov 6, 2025

@ziadhany add description in the PR please!

except InvalidVersion:
logger.error(f"Invalid SemverVersion: {version!r} for OSV id: {raw_id!r}")

if fixed_range_type == "GIT":
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this? And what's the get_code_commit function ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the OSV schema, a commit be treated as the package version.
https://ossf.github.io/osv-schema/#python-vulnerability

"ranges": [ {
    "type": "GIT",
    "repo": "https://github.com/owner/repo",
    "events": [
      { "introduced": "X" },
      { "fixed": "Y" },
    ]
} ]

When importing this data into the new model, we currently log it as Unsupported fixed version type.
Instead, we should skip these entries silently to avoid unnecessary log noise, since they are already handled in the get_code_commit function.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why to skip and not create code commits out of these ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because the get_fixed_versions function returns only versions, I thought the name might be misleading.

No problem I’ll update it and rename get_fixed_versions to get_fixed_versions_and_commits

Add all the fields in keys for comparison CodeCommitData

Signed-off-by: ziad hany <ziadhany2016@gmail.com>
@ziadhany ziadhany requested a review from TG1999 November 7, 2025 02:48
@TG1999
Copy link
Contributor

TG1999 commented Nov 7, 2025

@ziadhany mostly looks good! Please run the importer once and paste the logs here. Thanks!

I want to see if we are missing on any data in OSV format. And how does the AdvisoryData and ImpactedPackages looks with the new CommitData. Thanks!

Signed-off-by: ziad hany <ziadhany2016@gmail.com>
@ziadhany
Copy link
Collaborator Author

ziadhany commented Nov 7, 2025

@TG1999 This is the log output for the following importers:

  • pysec_importer_v2
  • pypa_importer_v2
  • oss_fuzz_importer_v2

importers_logs.zip

the database query result :
vulnerabilities_advisory Total rows: 3262
vulnerabilities_impactedpackage_fixed_by_commits Total rows: 4013
vulnerabilities_impactedpackage_affecting_commits Total rows: 3623
vulnerabilities_codecommit Total rows: 3791

@ziadhany ziadhany requested a review from TG1999 November 7, 2025 14:56
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.

2 participants