fix(server): add licenses to the Result message (#4955)

This commit is contained in:
Nikita Pivkin
2023-08-08 10:21:59 +03:00
committed by GitHub
parent e8cf281471
commit 798ef1b64a
7 changed files with 577 additions and 142 deletions

View File

@@ -1,12 +1,12 @@
package rpc package rpc
import ( import (
"strings"
"time" "time"
"github.com/golang/protobuf/ptypes" "github.com/samber/lo"
"google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/timestamppb"
"github.com/golang/protobuf/ptypes/timestamp"
"google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/structpb"
dbTypes "github.com/aquasecurity/trivy-db/pkg/types" dbTypes "github.com/aquasecurity/trivy-db/pkg/types"
@@ -161,7 +161,7 @@ func ConvertToRPCVulns(vulns []types.DetectedVulnerability) []*common.Vulnerabil
vensorSeverityMap[string(vendor)] = common.Severity(vendorSeverity) vensorSeverityMap[string(vendor)] = common.Severity(vendorSeverity)
} }
var lastModifiedDate, publishedDate *timestamp.Timestamp var lastModifiedDate, publishedDate *timestamppb.Timestamp
if vuln.LastModifiedDate != nil { if vuln.LastModifiedDate != nil {
lastModifiedDate = timestamppb.New(*vuln.LastModifiedDate) // nolint: errcheck lastModifiedDate = timestamppb.New(*vuln.LastModifiedDate) // nolint: errcheck
} }
@@ -295,11 +295,36 @@ func ConvertFromRPCResults(rpcResults []*scanner.Result) []types.Result {
Packages: ConvertFromRPCPkgs(result.Packages), Packages: ConvertFromRPCPkgs(result.Packages),
CustomResources: ConvertFromRPCCustomResources(result.CustomResources), CustomResources: ConvertFromRPCCustomResources(result.CustomResources),
Secrets: ConvertFromRPCSecretFindings(result.Secrets), Secrets: ConvertFromRPCSecretFindings(result.Secrets),
Licenses: ConvertFromRPCLicenses(result.Licenses),
}) })
} }
return results return results
} }
func ConvertFromRPCLicenses(rpcLicenses []*common.DetectedLicense) []types.DetectedLicense {
var licenses []types.DetectedLicense
for _, l := range rpcLicenses {
severity := dbTypes.Severity(l.Severity)
licenses = append(licenses, types.DetectedLicense{
Severity: severity.String(),
Category: ConvertFromRPCLicenseCategory(l.Category),
PkgName: l.PkgName,
FilePath: l.FilePath,
Name: l.Name,
Confidence: float64(l.Confidence),
Link: l.Link,
})
}
return licenses
}
func ConvertFromRPCLicenseCategory(rpcCategory common.DetectedLicense_LicenseCategory) ftypes.LicenseCategory {
if rpcCategory == common.DetectedLicense_UNSPECIFIED {
return ""
}
return ftypes.LicenseCategory(strings.ToLower(rpcCategory.String()))
}
// ConvertFromRPCCustomResources converts array of cache.CustomResource to fanal.CustomResource // ConvertFromRPCCustomResources converts array of cache.CustomResource to fanal.CustomResource
func ConvertFromRPCCustomResources(rpcCustomResources []*common.CustomResource) []ftypes.CustomResource { func ConvertFromRPCCustomResources(rpcCustomResources []*common.CustomResource) []ftypes.CustomResource {
var resources []ftypes.CustomResource var resources []ftypes.CustomResource
@@ -390,12 +415,10 @@ func ConvertFromRPCVulns(rpcVulns []*common.Vulnerability) []types.DetectedVulne
var lastModifiedDate, publishedDate *time.Time var lastModifiedDate, publishedDate *time.Time
if vuln.LastModifiedDate != nil { if vuln.LastModifiedDate != nil {
t, _ := ptypes.Timestamp(vuln.LastModifiedDate) // nolint: errcheck lastModifiedDate = lo.ToPtr(vuln.LastModifiedDate.AsTime())
lastModifiedDate = &t
} }
if vuln.PublishedDate != nil { if vuln.PublishedDate != nil {
t, _ := ptypes.Timestamp(vuln.PublishedDate) // nolint: errcheck publishedDate = lo.ToPtr(vuln.PublishedDate.AsTime())
publishedDate = &t
} }
vulns = append(vulns, types.DetectedVulnerability{ vulns = append(vulns, types.DetectedVulnerability{
@@ -591,11 +614,10 @@ func ConvertFromRPCMisconfResults(rpcResults []*common.MisconfResult) []ftypes.M
// ConvertFromRPCPutArtifactRequest converts cache.PutArtifactRequest to fanal.PutArtifactRequest // ConvertFromRPCPutArtifactRequest converts cache.PutArtifactRequest to fanal.PutArtifactRequest
func ConvertFromRPCPutArtifactRequest(req *cache.PutArtifactRequest) ftypes.ArtifactInfo { func ConvertFromRPCPutArtifactRequest(req *cache.PutArtifactRequest) ftypes.ArtifactInfo {
created, _ := ptypes.Timestamp(req.ArtifactInfo.Created) // nolint: errcheck
return ftypes.ArtifactInfo{ return ftypes.ArtifactInfo{
SchemaVersion: int(req.ArtifactInfo.SchemaVersion), SchemaVersion: int(req.ArtifactInfo.SchemaVersion),
Architecture: req.ArtifactInfo.Architecture, Architecture: req.ArtifactInfo.Architecture,
Created: created, Created: req.ArtifactInfo.Created.AsTime(),
DockerVersion: req.ArtifactInfo.DockerVersion, DockerVersion: req.ArtifactInfo.DockerVersion,
OS: req.ArtifactInfo.Os, OS: req.ArtifactInfo.Os,
HistoryPackages: ConvertFromRPCPkgs(req.ArtifactInfo.HistoryPackages), HistoryPackages: ConvertFromRPCPkgs(req.ArtifactInfo.HistoryPackages),
@@ -643,8 +665,9 @@ func ConvertToRPCRepository(repo *ftypes.Repository) *common.Repository {
// ConvertToRPCArtifactInfo returns PutArtifactRequest // ConvertToRPCArtifactInfo returns PutArtifactRequest
func ConvertToRPCArtifactInfo(imageID string, imageInfo ftypes.ArtifactInfo) *cache.PutArtifactRequest { func ConvertToRPCArtifactInfo(imageID string, imageInfo ftypes.ArtifactInfo) *cache.PutArtifactRequest {
t, err := ptypes.TimestampProto(imageInfo.Created)
if err != nil { t := timestamppb.New(imageInfo.Created)
if err := t.CheckValid(); err != nil {
log.Logger.Warnf("invalid timestamp: %s", err) log.Logger.Warnf("invalid timestamp: %s", err)
} }
@@ -765,6 +788,7 @@ func ConvertToRPCScanResponse(results types.Results, fos ftypes.OS) *scanner.Sca
Packages: ConvertToRPCPkgs(result.Packages), Packages: ConvertToRPCPkgs(result.Packages),
CustomResources: ConvertToRPCCustomResources(result.CustomResources), CustomResources: ConvertToRPCCustomResources(result.CustomResources),
Secrets: ConvertToRPCSecretFindings(result.Secrets), Secrets: ConvertToRPCSecretFindings(result.Secrets),
Licenses: ConvertToRPCLicenses(result.Licenses),
}) })
} }
@@ -774,6 +798,35 @@ func ConvertToRPCScanResponse(results types.Results, fos ftypes.OS) *scanner.Sca
} }
} }
func ConvertToRPCLicenses(licenses []types.DetectedLicense) []*common.DetectedLicense {
var rpcLicenses []*common.DetectedLicense
for _, l := range licenses {
severity, err := dbTypes.NewSeverity(l.Severity)
if err != nil {
log.Logger.Warn(err)
}
rpcLicenses = append(rpcLicenses, &common.DetectedLicense{
Severity: common.Severity(severity),
Category: ConvertToRPCLicenseCategory(l.Category),
PkgName: l.PkgName,
FilePath: l.FilePath,
Name: l.Name,
Confidence: float32(l.Confidence),
Link: l.Link,
})
}
return rpcLicenses
}
func ConvertToRPCLicenseCategory(category ftypes.LicenseCategory) common.DetectedLicense_LicenseCategory {
rpcCategory, ok := common.DetectedLicense_LicenseCategory_value[strings.ToUpper(string(category))]
if !ok {
return common.DetectedLicense_UNSPECIFIED
}
return common.DetectedLicense_LicenseCategory(rpcCategory)
}
func ConvertToDeleteBlobsRequest(blobIDs []string) *cache.DeleteBlobsRequest { func ConvertToDeleteBlobsRequest(blobIDs []string) *cache.DeleteBlobsRequest {
return &cache.DeleteBlobsRequest{BlobIds: blobIDs} return &cache.DeleteBlobsRequest{BlobIds: blobIDs}
} }

View File

@@ -669,3 +669,147 @@ func TestConvertToRPCMiconfs(t *testing.T) {
}) })
} }
} }
func TestConvertFromRPCLicenses(t *testing.T) {
tests := []struct {
name string
rpcLicenses []*common.DetectedLicense
want []types.DetectedLicense
}{
{
name: "happy",
rpcLicenses: []*common.DetectedLicense{
{
Severity: common.Severity_HIGH,
Category: common.DetectedLicense_RESTRICTED,
PkgName: "alpine-baselayout",
FilePath: "some-path",
Name: "GPL-2.0",
Confidence: 1,
Link: "https://some-link",
},
},
want: []types.DetectedLicense{
{
Severity: "HIGH",
Category: "restricted",
PkgName: "alpine-baselayout",
FilePath: "some-path",
Name: "GPL-2.0",
Confidence: 1,
Link: "https://some-link",
},
},
},
{
name: "no licenses",
rpcLicenses: nil,
want: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := ConvertFromRPCLicenses(tt.rpcLicenses)
assert.Equal(t, tt.want, got)
})
}
}
func TestConvertToRPCLicenses(t *testing.T) {
tests := []struct {
name string
licenses []types.DetectedLicense
want []*common.DetectedLicense
}{
{
name: "happy",
licenses: []types.DetectedLicense{
{
Severity: "HIGH",
Category: "restricted",
PkgName: "alpine-baselayout",
FilePath: "some-path",
Name: "GPL-2.0",
Confidence: 1,
Link: "https://some-link",
},
},
want: []*common.DetectedLicense{
{
Severity: common.Severity_HIGH,
Category: common.DetectedLicense_RESTRICTED,
PkgName: "alpine-baselayout",
FilePath: "some-path",
Name: "GPL-2.0",
Confidence: 1,
Link: "https://some-link",
},
},
},
{
name: "no licenses",
licenses: nil,
want: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := ConvertToRPCLicenses(tt.licenses)
assert.Equal(t, tt.want, got)
})
}
}
func TestConvertToRPCLicenseCategory(t *testing.T) {
tests := []struct {
name string
category ftypes.LicenseCategory
want common.DetectedLicense_LicenseCategory
}{
{
name: "happy",
category: ftypes.CategoryNotice,
want: common.DetectedLicense_NOTICE,
},
{
name: "unspecified",
category: "",
want: common.DetectedLicense_UNSPECIFIED,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := ConvertToRPCLicenseCategory(tt.category)
assert.Equal(t, tt.want, got)
})
}
}
func TestConvertFromRPCLicenseCategory(t *testing.T) {
tests := []struct {
name string
rpcCategory common.DetectedLicense_LicenseCategory
want ftypes.LicenseCategory
}{
{
name: "happy",
rpcCategory: common.DetectedLicense_RESTRICTED,
want: ftypes.CategoryRestricted,
},
{
name: "unspecified",
rpcCategory: common.DetectedLicense_UNSPECIFIED,
want: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := ConvertFromRPCLicenseCategory(tt.rpcCategory)
assert.Equal(t, tt.want, got)
})
}
}

View File

@@ -77,6 +77,70 @@ func (Severity) EnumDescriptor() ([]byte, []int) {
return file_rpc_common_service_proto_rawDescGZIP(), []int{0} return file_rpc_common_service_proto_rawDescGZIP(), []int{0}
} }
type DetectedLicense_LicenseCategory int32
const (
DetectedLicense_UNSPECIFIED DetectedLicense_LicenseCategory = 0
DetectedLicense_FORBIDDEN DetectedLicense_LicenseCategory = 1
DetectedLicense_RESTRICTED DetectedLicense_LicenseCategory = 2
DetectedLicense_RECIPROCAL DetectedLicense_LicenseCategory = 3
DetectedLicense_NOTICE DetectedLicense_LicenseCategory = 4
DetectedLicense_PERMISSIVE DetectedLicense_LicenseCategory = 5
DetectedLicense_UNENCUMBERED DetectedLicense_LicenseCategory = 6
DetectedLicense_UNKNOWN DetectedLicense_LicenseCategory = 7
)
// Enum value maps for DetectedLicense_LicenseCategory.
var (
DetectedLicense_LicenseCategory_name = map[int32]string{
0: "UNSPECIFIED",
1: "FORBIDDEN",
2: "RESTRICTED",
3: "RECIPROCAL",
4: "NOTICE",
5: "PERMISSIVE",
6: "UNENCUMBERED",
7: "UNKNOWN",
}
DetectedLicense_LicenseCategory_value = map[string]int32{
"UNSPECIFIED": 0,
"FORBIDDEN": 1,
"RESTRICTED": 2,
"RECIPROCAL": 3,
"NOTICE": 4,
"PERMISSIVE": 5,
"UNENCUMBERED": 6,
"UNKNOWN": 7,
}
)
func (x DetectedLicense_LicenseCategory) Enum() *DetectedLicense_LicenseCategory {
p := new(DetectedLicense_LicenseCategory)
*p = x
return p
}
func (x DetectedLicense_LicenseCategory) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (DetectedLicense_LicenseCategory) Descriptor() protoreflect.EnumDescriptor {
return file_rpc_common_service_proto_enumTypes[1].Descriptor()
}
func (DetectedLicense_LicenseCategory) Type() protoreflect.EnumType {
return &file_rpc_common_service_proto_enumTypes[1]
}
func (x DetectedLicense_LicenseCategory) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use DetectedLicense_LicenseCategory.Descriptor instead.
func (DetectedLicense_LicenseCategory) EnumDescriptor() ([]byte, []int) {
return file_rpc_common_service_proto_rawDescGZIP(), []int{19, 0}
}
type OS struct { type OS struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@@ -1806,6 +1870,101 @@ func (x *Secret) GetFindings() []*SecretFinding {
return nil return nil
} }
type DetectedLicense struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Severity Severity `protobuf:"varint,1,opt,name=severity,proto3,enum=trivy.common.Severity" json:"severity,omitempty"`
Category DetectedLicense_LicenseCategory `protobuf:"varint,2,opt,name=category,proto3,enum=trivy.common.DetectedLicense_LicenseCategory" json:"category,omitempty"`
PkgName string `protobuf:"bytes,3,opt,name=pkg_name,json=pkgName,proto3" json:"pkg_name,omitempty"`
FilePath string `protobuf:"bytes,4,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"`
Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"`
Confidence float32 `protobuf:"fixed32,6,opt,name=confidence,proto3" json:"confidence,omitempty"`
Link string `protobuf:"bytes,7,opt,name=link,proto3" json:"link,omitempty"`
}
func (x *DetectedLicense) Reset() {
*x = DetectedLicense{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_common_service_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DetectedLicense) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DetectedLicense) ProtoMessage() {}
func (x *DetectedLicense) ProtoReflect() protoreflect.Message {
mi := &file_rpc_common_service_proto_msgTypes[19]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DetectedLicense.ProtoReflect.Descriptor instead.
func (*DetectedLicense) Descriptor() ([]byte, []int) {
return file_rpc_common_service_proto_rawDescGZIP(), []int{19}
}
func (x *DetectedLicense) GetSeverity() Severity {
if x != nil {
return x.Severity
}
return Severity_UNKNOWN
}
func (x *DetectedLicense) GetCategory() DetectedLicense_LicenseCategory {
if x != nil {
return x.Category
}
return DetectedLicense_UNSPECIFIED
}
func (x *DetectedLicense) GetPkgName() string {
if x != nil {
return x.PkgName
}
return ""
}
func (x *DetectedLicense) GetFilePath() string {
if x != nil {
return x.FilePath
}
return ""
}
func (x *DetectedLicense) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *DetectedLicense) GetConfidence() float32 {
if x != nil {
return x.Confidence
}
return 0
}
func (x *DetectedLicense) GetLink() string {
if x != nil {
return x.Link
}
return ""
}
var File_rpc_common_service_proto protoreflect.FileDescriptor var File_rpc_common_service_proto protoreflect.FileDescriptor
var file_rpc_common_service_proto_rawDesc = []byte{ var file_rpc_common_service_proto_rawDesc = []byte{
@@ -2105,15 +2264,41 @@ var file_rpc_common_service_proto_rawDesc = []byte{
0x74, 0x68, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x02, 0x74, 0x68, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x02,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e,
0x67, 0x52, 0x08, 0x66, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x2a, 0x44, 0x0a, 0x08, 0x53, 0x67, 0x52, 0x08, 0x66, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x9f, 0x03, 0x0a, 0x0f,
0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12,
0x57, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x32, 0x0a, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
0x06, 0x4d, 0x45, 0x44, 0x49, 0x55, 0x4d, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x49, 0x47, 0x0e, 0x32, 0x16, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x48, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x52, 0x49, 0x54, 0x49, 0x43, 0x41, 0x4c, 0x10, 0x2e, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x52, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72,
0x04, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x74, 0x79, 0x12, 0x49, 0x0a, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18,
0x61, 0x71, 0x75, 0x61, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x2f, 0x74, 0x72, 0x69, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x63, 0x6f,
0x76, 0x79, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x63,
0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x65, 0x6e, 0x73, 0x65, 0x2e, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x43, 0x61, 0x74, 0x65,
0x67, 0x6f, 0x72, 0x79, 0x52, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x19,
0x0a, 0x08, 0x70, 0x6b, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x07, 0x70, 0x6b, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69, 0x6c,
0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69,
0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f,
0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a,
0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69,
0x6e, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x8c,
0x01, 0x0a, 0x0f, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f,
0x72, 0x79, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45,
0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x46, 0x4f, 0x52, 0x42, 0x49, 0x44, 0x44, 0x45, 0x4e,
0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x45, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x45, 0x44,
0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x45, 0x43, 0x49, 0x50, 0x52, 0x4f, 0x43, 0x41, 0x4c,
0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x4f, 0x54, 0x49, 0x43, 0x45, 0x10, 0x04, 0x12, 0x0e,
0x0a, 0x0a, 0x50, 0x45, 0x52, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x56, 0x45, 0x10, 0x05, 0x12, 0x10,
0x0a, 0x0c, 0x55, 0x4e, 0x45, 0x4e, 0x43, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x45, 0x44, 0x10, 0x06,
0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x07, 0x2a, 0x44, 0x0a,
0x08, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b,
0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12,
0x0a, 0x0a, 0x06, 0x4d, 0x45, 0x44, 0x49, 0x55, 0x4d, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x48,
0x49, 0x47, 0x48, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x52, 0x49, 0x54, 0x49, 0x43, 0x41,
0x4c, 0x10, 0x04, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x61, 0x71, 0x75, 0x61, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x2f, 0x74,
0x72, 0x69, 0x76, 0x79, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3b,
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@@ -2128,70 +2313,74 @@ func file_rpc_common_service_proto_rawDescGZIP() []byte {
return file_rpc_common_service_proto_rawDescData return file_rpc_common_service_proto_rawDescData
} }
var file_rpc_common_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_rpc_common_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_rpc_common_service_proto_msgTypes = make([]protoimpl.MessageInfo, 21) var file_rpc_common_service_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_rpc_common_service_proto_goTypes = []interface{}{ var file_rpc_common_service_proto_goTypes = []interface{}{
(Severity)(0), // 0: trivy.common.Severity (Severity)(0), // 0: trivy.common.Severity
(*OS)(nil), // 1: trivy.common.OS (DetectedLicense_LicenseCategory)(0), // 1: trivy.common.DetectedLicense.LicenseCategory
(*Repository)(nil), // 2: trivy.common.Repository (*OS)(nil), // 2: trivy.common.OS
(*PackageInfo)(nil), // 3: trivy.common.PackageInfo (*Repository)(nil), // 3: trivy.common.Repository
(*Application)(nil), // 4: trivy.common.Application (*PackageInfo)(nil), // 4: trivy.common.PackageInfo
(*Package)(nil), // 5: trivy.common.Package (*Application)(nil), // 5: trivy.common.Application
(*Misconfiguration)(nil), // 6: trivy.common.Misconfiguration (*Package)(nil), // 6: trivy.common.Package
(*MisconfResult)(nil), // 7: trivy.common.MisconfResult (*Misconfiguration)(nil), // 7: trivy.common.Misconfiguration
(*PolicyMetadata)(nil), // 8: trivy.common.PolicyMetadata (*MisconfResult)(nil), // 8: trivy.common.MisconfResult
(*DetectedMisconfiguration)(nil), // 9: trivy.common.DetectedMisconfiguration (*PolicyMetadata)(nil), // 9: trivy.common.PolicyMetadata
(*Vulnerability)(nil), // 10: trivy.common.Vulnerability (*DetectedMisconfiguration)(nil), // 10: trivy.common.DetectedMisconfiguration
(*DataSource)(nil), // 11: trivy.common.DataSource (*Vulnerability)(nil), // 11: trivy.common.Vulnerability
(*Layer)(nil), // 12: trivy.common.Layer (*DataSource)(nil), // 12: trivy.common.DataSource
(*CauseMetadata)(nil), // 13: trivy.common.CauseMetadata (*Layer)(nil), // 13: trivy.common.Layer
(*CVSS)(nil), // 14: trivy.common.CVSS (*CauseMetadata)(nil), // 14: trivy.common.CauseMetadata
(*CustomResource)(nil), // 15: trivy.common.CustomResource (*CVSS)(nil), // 15: trivy.common.CVSS
(*Line)(nil), // 16: trivy.common.Line (*CustomResource)(nil), // 16: trivy.common.CustomResource
(*Code)(nil), // 17: trivy.common.Code (*Line)(nil), // 17: trivy.common.Line
(*SecretFinding)(nil), // 18: trivy.common.SecretFinding (*Code)(nil), // 18: trivy.common.Code
(*Secret)(nil), // 19: trivy.common.Secret (*SecretFinding)(nil), // 19: trivy.common.SecretFinding
nil, // 20: trivy.common.Vulnerability.CvssEntry (*Secret)(nil), // 20: trivy.common.Secret
nil, // 21: trivy.common.Vulnerability.VendorSeverityEntry (*DetectedLicense)(nil), // 21: trivy.common.DetectedLicense
(*timestamppb.Timestamp)(nil), // 22: google.protobuf.Timestamp nil, // 22: trivy.common.Vulnerability.CvssEntry
(*structpb.Value)(nil), // 23: google.protobuf.Value nil, // 23: trivy.common.Vulnerability.VendorSeverityEntry
(*timestamppb.Timestamp)(nil), // 24: google.protobuf.Timestamp
(*structpb.Value)(nil), // 25: google.protobuf.Value
} }
var file_rpc_common_service_proto_depIdxs = []int32{ var file_rpc_common_service_proto_depIdxs = []int32{
5, // 0: trivy.common.PackageInfo.packages:type_name -> trivy.common.Package 6, // 0: trivy.common.PackageInfo.packages:type_name -> trivy.common.Package
5, // 1: trivy.common.Application.libraries:type_name -> trivy.common.Package 6, // 1: trivy.common.Application.libraries:type_name -> trivy.common.Package
12, // 2: trivy.common.Package.layer:type_name -> trivy.common.Layer 13, // 2: trivy.common.Package.layer:type_name -> trivy.common.Layer
7, // 3: trivy.common.Misconfiguration.successes:type_name -> trivy.common.MisconfResult 8, // 3: trivy.common.Misconfiguration.successes:type_name -> trivy.common.MisconfResult
7, // 4: trivy.common.Misconfiguration.warnings:type_name -> trivy.common.MisconfResult 8, // 4: trivy.common.Misconfiguration.warnings:type_name -> trivy.common.MisconfResult
7, // 5: trivy.common.Misconfiguration.failures:type_name -> trivy.common.MisconfResult 8, // 5: trivy.common.Misconfiguration.failures:type_name -> trivy.common.MisconfResult
7, // 6: trivy.common.Misconfiguration.exceptions:type_name -> trivy.common.MisconfResult 8, // 6: trivy.common.Misconfiguration.exceptions:type_name -> trivy.common.MisconfResult
8, // 7: trivy.common.MisconfResult.policy_metadata:type_name -> trivy.common.PolicyMetadata 9, // 7: trivy.common.MisconfResult.policy_metadata:type_name -> trivy.common.PolicyMetadata
13, // 8: trivy.common.MisconfResult.cause_metadata:type_name -> trivy.common.CauseMetadata 14, // 8: trivy.common.MisconfResult.cause_metadata:type_name -> trivy.common.CauseMetadata
0, // 9: trivy.common.DetectedMisconfiguration.severity:type_name -> trivy.common.Severity 0, // 9: trivy.common.DetectedMisconfiguration.severity:type_name -> trivy.common.Severity
12, // 10: trivy.common.DetectedMisconfiguration.layer:type_name -> trivy.common.Layer 13, // 10: trivy.common.DetectedMisconfiguration.layer:type_name -> trivy.common.Layer
13, // 11: trivy.common.DetectedMisconfiguration.cause_metadata:type_name -> trivy.common.CauseMetadata 14, // 11: trivy.common.DetectedMisconfiguration.cause_metadata:type_name -> trivy.common.CauseMetadata
0, // 12: trivy.common.Vulnerability.severity:type_name -> trivy.common.Severity 0, // 12: trivy.common.Vulnerability.severity:type_name -> trivy.common.Severity
12, // 13: trivy.common.Vulnerability.layer:type_name -> trivy.common.Layer 13, // 13: trivy.common.Vulnerability.layer:type_name -> trivy.common.Layer
20, // 14: trivy.common.Vulnerability.cvss:type_name -> trivy.common.Vulnerability.CvssEntry 22, // 14: trivy.common.Vulnerability.cvss:type_name -> trivy.common.Vulnerability.CvssEntry
22, // 15: trivy.common.Vulnerability.published_date:type_name -> google.protobuf.Timestamp 24, // 15: trivy.common.Vulnerability.published_date:type_name -> google.protobuf.Timestamp
22, // 16: trivy.common.Vulnerability.last_modified_date:type_name -> google.protobuf.Timestamp 24, // 16: trivy.common.Vulnerability.last_modified_date:type_name -> google.protobuf.Timestamp
23, // 17: trivy.common.Vulnerability.custom_advisory_data:type_name -> google.protobuf.Value 25, // 17: trivy.common.Vulnerability.custom_advisory_data:type_name -> google.protobuf.Value
23, // 18: trivy.common.Vulnerability.custom_vuln_data:type_name -> google.protobuf.Value 25, // 18: trivy.common.Vulnerability.custom_vuln_data:type_name -> google.protobuf.Value
11, // 19: trivy.common.Vulnerability.data_source:type_name -> trivy.common.DataSource 12, // 19: trivy.common.Vulnerability.data_source:type_name -> trivy.common.DataSource
21, // 20: trivy.common.Vulnerability.vendor_severity:type_name -> trivy.common.Vulnerability.VendorSeverityEntry 23, // 20: trivy.common.Vulnerability.vendor_severity:type_name -> trivy.common.Vulnerability.VendorSeverityEntry
17, // 21: trivy.common.CauseMetadata.code:type_name -> trivy.common.Code 18, // 21: trivy.common.CauseMetadata.code:type_name -> trivy.common.Code
12, // 22: trivy.common.CustomResource.layer:type_name -> trivy.common.Layer 13, // 22: trivy.common.CustomResource.layer:type_name -> trivy.common.Layer
23, // 23: trivy.common.CustomResource.data:type_name -> google.protobuf.Value 25, // 23: trivy.common.CustomResource.data:type_name -> google.protobuf.Value
16, // 24: trivy.common.Code.lines:type_name -> trivy.common.Line 17, // 24: trivy.common.Code.lines:type_name -> trivy.common.Line
17, // 25: trivy.common.SecretFinding.code:type_name -> trivy.common.Code 18, // 25: trivy.common.SecretFinding.code:type_name -> trivy.common.Code
12, // 26: trivy.common.SecretFinding.layer:type_name -> trivy.common.Layer 13, // 26: trivy.common.SecretFinding.layer:type_name -> trivy.common.Layer
18, // 27: trivy.common.Secret.findings:type_name -> trivy.common.SecretFinding 19, // 27: trivy.common.Secret.findings:type_name -> trivy.common.SecretFinding
14, // 28: trivy.common.Vulnerability.CvssEntry.value:type_name -> trivy.common.CVSS 0, // 28: trivy.common.DetectedLicense.severity:type_name -> trivy.common.Severity
0, // 29: trivy.common.Vulnerability.VendorSeverityEntry.value:type_name -> trivy.common.Severity 1, // 29: trivy.common.DetectedLicense.category:type_name -> trivy.common.DetectedLicense.LicenseCategory
30, // [30:30] is the sub-list for method output_type 15, // 30: trivy.common.Vulnerability.CvssEntry.value:type_name -> trivy.common.CVSS
30, // [30:30] is the sub-list for method input_type 0, // 31: trivy.common.Vulnerability.VendorSeverityEntry.value:type_name -> trivy.common.Severity
30, // [30:30] is the sub-list for extension type_name 32, // [32:32] is the sub-list for method output_type
30, // [30:30] is the sub-list for extension extendee 32, // [32:32] is the sub-list for method input_type
0, // [0:30] is the sub-list for field type_name 32, // [32:32] is the sub-list for extension type_name
32, // [32:32] is the sub-list for extension extendee
0, // [0:32] is the sub-list for field type_name
} }
func init() { file_rpc_common_service_proto_init() } func init() { file_rpc_common_service_proto_init() }
@@ -2428,14 +2617,26 @@ func file_rpc_common_service_proto_init() {
return nil return nil
} }
} }
file_rpc_common_service_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DetectedLicense); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_rpc_common_service_proto_rawDesc, RawDescriptor: file_rpc_common_service_proto_rawDesc,
NumEnums: 1, NumEnums: 2,
NumMessages: 21, NumMessages: 22,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@@ -202,3 +202,24 @@ message Secret {
string filepath = 1; string filepath = 1;
repeated SecretFinding findings = 2; repeated SecretFinding findings = 2;
} }
message DetectedLicense {
Severity severity = 1;
LicenseCategory category = 2;
string pkg_name = 3;
string file_path = 4;
string name = 5;
float confidence = 6;
string link = 7;
enum LicenseCategory {
UNSPECIFIED = 0;
FORBIDDEN = 1;
RESTRICTED = 2;
RECIPROCAL = 3;
NOTICE = 4;
PERMISSIVE = 5;
UNENCUMBERED = 6;
UNKNOWN = 7;
}
}

View File

@@ -289,6 +289,7 @@ type Result struct {
Packages []*common.Package `protobuf:"bytes,5,rep,name=packages,proto3" json:"packages,omitempty"` Packages []*common.Package `protobuf:"bytes,5,rep,name=packages,proto3" json:"packages,omitempty"`
CustomResources []*common.CustomResource `protobuf:"bytes,7,rep,name=custom_resources,json=customResources,proto3" json:"custom_resources,omitempty"` CustomResources []*common.CustomResource `protobuf:"bytes,7,rep,name=custom_resources,json=customResources,proto3" json:"custom_resources,omitempty"`
Secrets []*common.SecretFinding `protobuf:"bytes,8,rep,name=secrets,proto3" json:"secrets,omitempty"` Secrets []*common.SecretFinding `protobuf:"bytes,8,rep,name=secrets,proto3" json:"secrets,omitempty"`
Licenses []*common.DetectedLicense `protobuf:"bytes,9,rep,name=licenses,proto3" json:"licenses,omitempty"`
} }
func (x *Result) Reset() { func (x *Result) Reset() {
@@ -379,6 +380,13 @@ func (x *Result) GetSecrets() []*common.SecretFinding {
return nil return nil
} }
func (x *Result) GetLicenses() []*common.DetectedLicense {
if x != nil {
return x.Licenses
}
return nil
}
var File_rpc_scanner_service_proto protoreflect.FileDescriptor var File_rpc_scanner_service_proto protoreflect.FileDescriptor
var file_rpc_scanner_service_proto_rawDesc = []byte{ var file_rpc_scanner_service_proto_rawDesc = []byte{
@@ -427,7 +435,7 @@ var file_rpc_scanner_service_proto_rawDesc = []byte{
0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x18, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x2e, 0x18, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x2e,
0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c,
0x74, 0x73, 0x22, 0x9a, 0x03, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x74, 0x73, 0x22, 0xd5, 0x03, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a,
0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74,
0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x45, 0x0a, 0x0f, 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x45, 0x0a, 0x0f, 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61,
0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b,
@@ -452,16 +460,20 @@ var file_rpc_scanner_service_proto_rawDesc = []byte{
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x72,
0x65, 0x74, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x65, 0x74, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x72, 0x69, 0x76,
0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x46, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x46,
0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x32, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x12,
0x50, 0x0a, 0x07, 0x53, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x12, 0x45, 0x0a, 0x04, 0x53, 0x63, 0x39, 0x0a, 0x08, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28,
0x61, 0x6e, 0x12, 0x1d, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65,
0x74, 0x1a, 0x1e, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x73, 0x32, 0x50, 0x0a, 0x07, 0x53, 0x63,
0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x12, 0x45, 0x0a, 0x04, 0x53, 0x63, 0x61, 0x6e, 0x12, 0x1d, 0x2e,
0x65, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x2e, 0x76, 0x31,
0x61, 0x71, 0x75, 0x61, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x2f, 0x74, 0x72, 0x69, 0x2e, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x74,
0x76, 0x79, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x3b, 0x73, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e,
0x63, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x33, 0x5a, 0x31,
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x71, 0x75, 0x61, 0x73,
0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x2f, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2f, 0x72, 0x70,
0x63, 0x2f, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x3b, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65,
0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@@ -490,6 +502,7 @@ var file_rpc_scanner_service_proto_goTypes = []interface{}{
(*common.Package)(nil), // 9: trivy.common.Package (*common.Package)(nil), // 9: trivy.common.Package
(*common.CustomResource)(nil), // 10: trivy.common.CustomResource (*common.CustomResource)(nil), // 10: trivy.common.CustomResource
(*common.SecretFinding)(nil), // 11: trivy.common.SecretFinding (*common.SecretFinding)(nil), // 11: trivy.common.SecretFinding
(*common.DetectedLicense)(nil), // 12: trivy.common.DetectedLicense
} }
var file_rpc_scanner_service_proto_depIdxs = []int32{ var file_rpc_scanner_service_proto_depIdxs = []int32{
2, // 0: trivy.scanner.v1.ScanRequest.options:type_name -> trivy.scanner.v1.ScanOptions 2, // 0: trivy.scanner.v1.ScanRequest.options:type_name -> trivy.scanner.v1.ScanOptions
@@ -501,14 +514,15 @@ var file_rpc_scanner_service_proto_depIdxs = []int32{
9, // 6: trivy.scanner.v1.Result.packages:type_name -> trivy.common.Package 9, // 6: trivy.scanner.v1.Result.packages:type_name -> trivy.common.Package
10, // 7: trivy.scanner.v1.Result.custom_resources:type_name -> trivy.common.CustomResource 10, // 7: trivy.scanner.v1.Result.custom_resources:type_name -> trivy.common.CustomResource
11, // 8: trivy.scanner.v1.Result.secrets:type_name -> trivy.common.SecretFinding 11, // 8: trivy.scanner.v1.Result.secrets:type_name -> trivy.common.SecretFinding
1, // 9: trivy.scanner.v1.ScanOptions.LicenseCategoriesEntry.value:type_name -> trivy.scanner.v1.Licenses 12, // 9: trivy.scanner.v1.Result.licenses:type_name -> trivy.common.DetectedLicense
0, // 10: trivy.scanner.v1.Scanner.Scan:input_type -> trivy.scanner.v1.ScanRequest 1, // 10: trivy.scanner.v1.ScanOptions.LicenseCategoriesEntry.value:type_name -> trivy.scanner.v1.Licenses
3, // 11: trivy.scanner.v1.Scanner.Scan:output_type -> trivy.scanner.v1.ScanResponse 0, // 11: trivy.scanner.v1.Scanner.Scan:input_type -> trivy.scanner.v1.ScanRequest
11, // [11:12] is the sub-list for method output_type 3, // 12: trivy.scanner.v1.Scanner.Scan:output_type -> trivy.scanner.v1.ScanResponse
10, // [10:11] is the sub-list for method input_type 12, // [12:13] is the sub-list for method output_type
10, // [10:10] is the sub-list for extension type_name 11, // [11:12] is the sub-list for method input_type
10, // [10:10] is the sub-list for extension extendee 11, // [11:11] is the sub-list for extension type_name
0, // [0:10] is the sub-list for field type_name 11, // [11:11] is the sub-list for extension extendee
0, // [0:11] is the sub-list for field type_name
} }
func init() { file_rpc_scanner_service_proto_init() } func init() { file_rpc_scanner_service_proto_init() }

View File

@@ -45,4 +45,5 @@ message Result {
repeated common.Package packages = 5; repeated common.Package packages = 5;
repeated common.CustomResource custom_resources = 7; repeated common.CustomResource custom_resources = 7;
repeated common.SecretFinding secrets = 8; repeated common.SecretFinding secrets = 8;
repeated common.DetectedLicense licenses = 9;
} }

View File

@@ -1094,46 +1094,47 @@ func callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error)
} }
var twirpFileDescriptor0 = []byte{ var twirpFileDescriptor0 = []byte{
// 644 bytes of a gzipped FileDescriptorProto // 665 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0x4d, 0x6f, 0x13, 0x31, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xdd, 0x6e, 0xda, 0x4a,
0x10, 0x55, 0x92, 0xe6, 0xa3, 0x13, 0x44, 0x53, 0x0b, 0xaa, 0x6d, 0xca, 0x47, 0x94, 0x03, 0x8a, 0x10, 0x16, 0x10, 0xc0, 0x0c, 0x47, 0x27, 0x64, 0x75, 0x4e, 0xe4, 0x90, 0xa6, 0x45, 0x5c, 0x54,
0x38, 0x24, 0x34, 0x05, 0x81, 0xe0, 0x04, 0x6d, 0x41, 0x95, 0x40, 0xad, 0x9c, 0x8a, 0x03, 0x97, 0xa8, 0x17, 0xd0, 0x90, 0x56, 0xfd, 0xbb, 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