Skip to content

refactor(vulnfeeds): switch to osv-schema Go bindings in cmd/ids - #4933

Merged
cuixq merged 4 commits into
google:masterfrom
cuixq:bindings
Mar 3, 2026
Merged

cuixq merged 4 commits into
google:masterfrom
cuixq:bindings

Conversation

@cuixq

@cuixq cuixq commented Mar 3, 2026 •

Copy link
Copy Markdown
Contributor

#4700

This PR migrates vulnfeeds/cmd/ids tool to use the osv-schema Go bindings to replace the deprecated models from osv-scanner.

  • Replaced models.Vulnerability with osvschema.Vulnerability.
  • Switched to protojson for JSON serialization, as the bindings are based on protobuf.
  • Updated YAML processing to use github.com/goccy/go-yaml, leveraging a YAML-to-JSON-to-Proto workflow to ensure compatibility.

A new test suite is also added to verify ID assignment logic across JSON and YAML formats.

@cuixq

cuixq commented Mar 3, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the cmd/ids tool to use the official osv-schema Go bindings. The changes correctly replace the old vulnerability model with the new one and adjust the JSON/YAML serialization logic accordingly. The addition of tests for the ID assignment logic is a great improvement. I've suggested a couple of refactorings in main.go to improve code clarity and reduce duplication in the serialization/deserialization functions.

Comment thread vulnfeeds/cmd/ids/main.go Resolved
Comment thread vulnfeeds/cmd/ids/main.go Resolved
@cuixq
cuixq marked this pull request as ready for review March 3, 2026 23:10
@cuixq
cuixq requested review from another-rex and calebbrown March 3, 2026 23:10
@cuixq
cuixq merged commit bf8f7b4 into google:master Mar 3, 2026
21 checks passed
@cuixq
cuixq deleted the bindings branch March 3, 2026 23:32
tymzd pushed a commit to tymzd/osv.dev that referenced this pull request Apr 13, 2026
…oogle#4933)

google#4700

This PR migrates `vulnfeeds/cmd/ids` tool to use the osv-schema Go
bindings to replace the deprecated models from osv-scanner.
 - Replaced `models.Vulnerability` with `osvschema.Vulnerability`.
- Switched to `protojson` for JSON serialization, as the bindings are
based on protobuf.
- Updated YAML processing to use `github.com/goccy/go-yaml`, leveraging
a YAML-to-JSON-to-Proto workflow to ensure compatibility.

A new test suite is also added to verify ID assignment logic across JSON
and YAML formats.
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.

3 participants