Skip to content
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

[Pre537] Automate patched_versions conversion from GHSA to ruby-advisory-db #648

Closed
jasnow opened this issue Jun 24, 2023 · 3 comments
Closed

Comments

@jasnow
Copy link
Contributor

jasnow commented Jun 24, 2023

Automate patched_versions conversion from GHSA to ruby-advisory-db.

  • Yes, PR/641 is part of this.
  • NOTE: Trailing comments are not a requirement on patched_version: line, such as:
    • "~> 5.2.8, >= 5.2.8.15" # Rails LTS
  • Will focus of 2023 needs first.
  • May need multiple steps to implement this feature.
  • You can find the grammar for this field in ruby-advisory-db/spec/advisory_example.rb file.
@postmodern
Copy link
Member

postmodern commented Jun 24, 2023

There isn't an easy way to parse and preserve the additional YAML comments. That would require using YAML.parse which returns a raw node tree of the YAML data, which is much harder to work with, merging in the new data and dumping the YAML nodes back out to the file.

An alternative approach would be to use an ERB template to render the advisory file, and properly format all YAML data. It might also be a good idea to create a separate Advisory class which represents the contents of the YAML file that could be used for loading the data and rendering the output. This might also require pulling in additional libraries to handle word-wrapping.

@jasnow
Copy link
Contributor Author

jasnow commented Jun 30, 2023

patched_version and unaffected_versions Use Cases for Testing:

@jasnow
Copy link
Contributor Author

jasnow commented Jul 1, 2023

#664 provide automated patched_versions creation in lib/github_advisory_sync.rb script so I'm go to close this issue.
If additional items come up in the future, we can open new issues/PRs for them.

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

No branches or pull requests

2 participants