Skip to content

Commit

Permalink
database: Add parent feature pointer to Feature struct
Browse files Browse the repository at this point in the history
Feature now has a pointer to parent feature. If a vulnerability affects
a parent feature, this child feature will be affected.
  • Loading branch information
KeyboardNerd committed Oct 9, 2018
1 parent 3c72fa2 commit 3fe894c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions database/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ type Feature struct {
Name string
Version string
VersionFormat string

// Parent feature indicates that the vulnerability affects parent feature
// will also affect this feature.
//
// e.g. A source package is the parent feature of a binary package.
Parent *Feature
}

// NamespacedFeature is a feature with determined namespace and can be affected
Expand Down
8 changes: 4 additions & 4 deletions database/pgsql/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import (
// int keys must be the consistent with the database ID.
var (
realFeatures = map[int]database.Feature{
1: {"ourchat", "0.5", "dpkg"},
2: {"openssl", "1.0", "dpkg"},
3: {"openssl", "2.0", "dpkg"},
4: {"fake", "2.0", "rpm"},
1: {"ourchat", "0.5", "dpkg", nil},
2: {"openssl", "1.0", "dpkg", nil},
3: {"openssl", "2.0", "dpkg", nil},
4: {"fake", "2.0", "rpm", nil},
}

realNamespaces = map[int]database.Namespace{
Expand Down

0 comments on commit 3fe894c

Please sign in to comment.