-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Implement Feature types #672
Implement Feature types #672
Conversation
bd4a4ec
to
a42632d
Compare
feature_type is for differentiating the binary packages and source packages.
761cc3e
to
a770585
Compare
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.
comments for PR reviewer
@@ -1,26 +0,0 @@ | |||
// Copyright 2018 clair authors |
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 renamed to database/feature_type.go
|
||
// ErrMissingEntities is an error that occurs when an associated immutable | ||
// entity doesn't exist in the database. This error can indicate a wrong | ||
// implementation or corrupted database. | ||
ErrMissingEntities = errors.New("database: associated immutable entities are missing in the database") | ||
ErrMissingEntities = NewStorageError("associated immutable entities are missing in the database") |
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.
one by one we're moving to use special error type for the database.
@@ -155,18 +155,33 @@ type Namespace struct { | |||
VersionFormat string | |||
} | |||
|
|||
func NewNamespace(name string, versionFormat string) *Namespace { |
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.
we're moving to use the proper initializer for the database structs
|
||
fmt.Printf("%d features, %d vulnerabilities are generated", len(nsFeatures), len(vulnerabilities)) |
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.
Remove the concurrent insertion because the vulnerabilities <-> feature relationships are cached after the features are inserted into the database
The featurefmt now extracts both binary packages and source packages from the package manager infos.
Remove source name/version fields Add Type field to indicate if it's binary package or source package
postgres 9.4 doesn't support ON CONFLICT, which is required in our implementation.
a770585
to
870e812
Compare
API now returns every feature found by the detectors and also indicates the type of feature.
@@ -179,6 +194,11 @@ type NamespacedFeature struct { | |||
Namespace Namespace | |||
} | |||
|
|||
func NewNamespacedFeature(namespace *Namespace, feature *Feature) *NamespacedFeature { | |||
// TODO: namespaced feature should use pointer values |
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.
Is it only desirable to use pointers here to save memory?
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 think it's idiomatic to use the pointer value for structs
The PR is to differentiate packages by their types, and vulnerabilities to affect different types of features.
Change set:
Feature Detectors: Extract both binary and source packages from image layers
Vulnerability matching algorithm change: Each vulnerability matches a specific type of package, either binary or source package.
Please correct the above assumption for each vulnerability data source if any error.
For each Feature, we add a field to indicate the type of the feature, currently it's Binary or Source package.