Skip to content

Commit

Permalink
database: Add affected feature type
Browse files Browse the repository at this point in the history
Affected feature type is for determining either the source feature or
the binary feature that an vulnerability affects.
  • Loading branch information
KeyboardNerd committed Oct 18, 2018
1 parent 17539bd commit 00fadfc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
26 changes: 26 additions & 0 deletions database/affected_feature_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2018 clair authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package database

// AffectedFeatureType indicates the type of feature that a vulnerability
// affects.
type AffectedFeatureType string

const (
// AffectSourcePackage indicates the vulnerability affects a source package.
AffectSourcePackage AffectedFeatureType = "source"
// AffectBinaryPackage indicates the vulnerability affects a binary package.
AffectBinaryPackage AffectedFeatureType = "binary"
)
8 changes: 5 additions & 3 deletions database/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,10 @@ type VulnerabilityWithFixedIn struct {
// by a Vulnerability. Namespace and Feature Name is unique. Affected Feature is
// bound to vulnerability.
type AffectedFeature struct {
Namespace Namespace
FeatureName string
// AffectedType determines which type of package it affects.
AffectedType AffectedFeatureType
Namespace Namespace
FeatureName string
// FixedInVersion is known next feature version that's not affected by the
// vulnerability. Empty FixedInVersion means the unaffected version is
// unknown.
Expand Down Expand Up @@ -229,7 +231,7 @@ type Vulnerability struct {
Metadata MetadataMap
}

// VulnerabilityWithAffected is an vulnerability with all known affected
// VulnerabilityWithAffected is a vulnerability with all known affected
// features.
type VulnerabilityWithAffected struct {
Vulnerability
Expand Down

0 comments on commit 00fadfc

Please sign in to comment.