-
Notifications
You must be signed in to change notification settings - Fork 142
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
feat(osv): add osv support #161
Conversation
pkg/vulnsrc/osv/osv.go
Outdated
} | ||
} | ||
|
||
func MustParse(layout, value string) *time.Time { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it's public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made it private
pkg/vulnsrc/osv/osv_test.go
Outdated
}, | ||
}, | ||
{ | ||
name: "single range version and references Go", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you name it better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed test names
pkg/vulnsrc/osv/osv.go
Outdated
Rust = "crates.io" | ||
) | ||
|
||
var defaultEcosystem = []ecosystem{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider using map
here this way getEcoSystem()
won't be required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also variable name should be in plural form
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made map
, remove getEcoSystem()
pkg/vulnsrc/osv/osv.go
Outdated
} | ||
|
||
func (vs VulnSrc) Name() string { | ||
switch vs.ecosystem.name { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add vulnerability.OsvPyPI
, vulnerability.OsvGo
and vulnerability.OsvCratesio
as separate property to defaultEcosystems
map entries above. Get entry and return that property when name is required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added new field in ecosystem
, changed Name()
pkg/vulnsrc/osv/osv.go
Outdated
return ecosystem{} | ||
} | ||
|
||
func (vs VulnSrc) Get(pkgName string) ([]types.Advisory, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is very similar to
https://github.com/aquasecurity/trivy-db/blob/main/pkg/db/advisory.go#L23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used GetAdvisories
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after latest trivy change it may be not required at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed Get()
pkg/vulnsrc/osv/osv.go
Outdated
return ecosystem{} | ||
} | ||
|
||
func (vs VulnSrc) Get(pkgName string) ([]types.Advisory, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after latest trivy change it may be not required at all
pkg/vulnsrc/osv/osv.go
Outdated
} | ||
|
||
type VulnSrc struct { | ||
ecosystem ecosystem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
func Get removed, ecosystem is pointer now
pkg/vulnsrc/osv/osv.go
Outdated
|
||
const ( | ||
osvDir = "osv" | ||
platformFormat = "%s::Osv Security Advisories" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can this function.
trivy-db/pkg/vulnsrc/bucket/bucket.go
Line 16 in 3c60651
func Name(ecosystem, dataSource string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used this function
pkg/vulnsrc/osv/osv.go
Outdated
"github.com/aquasecurity/trivy-db/pkg/types" | ||
"github.com/aquasecurity/trivy-db/pkg/utils" | ||
"github.com/aquasecurity/trivy-db/pkg/vulnsrc/vulnerability" | ||
vtypes "github.com/aquasecurity/vuln-list-update/osv" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't depend on vuln-list-udpate. You can define a new struct having necessary fields only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Hello @knqyf263 ! |
Description
Support OSV format
https://ossf.github.io/osv-schema/#python-vulnerability
Blockers