Skip to content

Attempt to generate patched_versions from GHSA firstPatchedVersion. #641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 24, 2023

Conversation

postmodern
Copy link
Member

Attempt to automatically generate the patched_versions from the GHSA vulnerabilities/firstPatchedVersion/identiifer information.

@postmodern postmodern self-assigned this Jun 20, 2023
@postmodern
Copy link
Member Author

@jasnow since I don't have the GitHub sync OAuth token setup locally, could you test this branch and see if it can correctly generate patched_versions for new GHSA advisories?

@jasnow
Copy link
Contributor

jasnow commented Jun 20, 2023

  • Added comma at end of line 379: "patched_versions" => patched_versions_for(package).
  • Working on this:
NoMethodError: undefined method `[]' for nil:NilClass

         first_patched_versions << v['firstPatchedVersion']['identifier']

@postmodern
Copy link
Member Author

@jasnow interesting, looks like not all vulnerabilities have firstPatchedVersion key, which makes sense since some vulnerabilities will be unpatched.

@jasnow
Copy link
Contributor

jasnow commented Jun 21, 2023

Noticed that you use double quotes were used inside "[]"s elsewhere in the script.

@jasnow
Copy link
Contributor

jasnow commented Jun 21, 2023

I will start testing this PR today. Here are some of my test cases: https://gist.github.com/jasnow/7c99f4d9e8b838293ba407af373141af

Probably need a supported grammar for "unaffected_versions:" and "patched_versions:" and
what the expected outputs are for more complex test cases in my gist.

@jasnow
Copy link
Contributor

jasnow commented Jun 21, 2023

Results of 1st gist testcase (after post-processing): https://gist.github.com/jasnow/000dd1ee3c8eedd6b78bb7b7dab51cdb

  • Related: Lost unaffected_versions value

Extra

I will stop at the 1st gist testcase for now.

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