-
Notifications
You must be signed in to change notification settings - Fork 287
libpkg add: OSVF parser #2453
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
base: main
Are you sure you want to change the base?
libpkg add: OSVF parser #2453
Conversation
bb1374a
to
3b905d2
Compare
note there are 2 tests failures on debian: |
libpkg/pkg_osvf.c
Outdated
unsigned int | ||
pkg_osvg_get_ecosystem(const char *ecosystem) | ||
{ | ||
if(strncmp(ecosystem, "AlmaLinux", 8) == 0) |
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.
it will probably be more maintainable, to have a struct ecomapping [] = { { "AlmaLinux", OSVF_ECOSYSTEM_ALMALINUX} , ... }; and we loop on the all entries. the day we have a new entry it is easier to append
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.
I'd use a hash table here tbh instead of a loop.
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 how will we keep this up to date over time as new ones are added?
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.
I haven't looked what this is used for, but maybe we can just cherrypick the one we are interested in.
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.
I'll implement full parser for Affected fields as they can be like Ubuntu:Pro:18.04:LTS
or Red Hat:rhel_aus:8.4::appstream
. For FreeBSD there would be namespaces like: FreeBSD:ports
, FreeBSD:kernel:14.3
and FreeBSD:src:14.3
?
unsigned int | ||
pkg_osvg_get_reference(const char *reference_type) | ||
{ | ||
|
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.
same a mapping struct would be more maintainable
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 one I didn't understand. Is it that you feed struct to that or make new struct for this one?
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.
There are many places where types checks and NULL checks are strongly advised when you work with ucl objects.
libpkg/pkg_osvf.c
Outdated
unsigned int | ||
pkg_osvg_get_ecosystem(const char *ecosystem) | ||
{ | ||
if(strncmp(ecosystem, "AlmaLinux", 8) == 0) |
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.
I'd use a hash table here tbh instead of a loop.
3b905d2
to
169d6a5
Compare
Open Source Vulnerability format is widely used format to exchage vulnerability information between variable systems. Commit adds OSVF parser to libpkg and also introduces test for making sure that it working correctly. Parser uses schema JSON from https://ossf.github.io/osv-schema/ to make sure that OSVF files are correctly formated. Current parser only supports latest Schema and version. Sponsored by: FreeBSD Foundation
169d6a5
to
64becb6
Compare
I was using wrong macro here. Correct one for Kyua and atf absolute path is: |
Open Source Vulnerability format is widely used format to exchange vulnerability information between variable systems.
Commit adds OSVF parser to libpkg and also introduces test for making sure that it working correctly.
Parser uses schema JSON from https://ossf.github.io/osv-schema/ to make sure that OSVF files are correctly formatted. Current parser only supports latest Schema and version.