From 13238da10dcec39e79b18a776b6dbb5e3e3a01ed Mon Sep 17 00:00:00 2001 From: Nikita Pivkin <100182843+nikpivkin@users.noreply.github.com> Date: Tue, 8 Aug 2023 10:21:59 +0300 Subject: [PATCH] fix(server): add licenses to the Result message (#4955) --- pkg/rpc/convert.go | 75 ++++++-- pkg/rpc/convert_test.go | 144 +++++++++++++++ rpc/common/service.pb.go | 341 ++++++++++++++++++++++++++++------- rpc/common/service.proto | 21 +++ rpc/scanner/service.pb.go | 52 ++++-- rpc/scanner/service.proto | 1 + rpc/scanner/service.twirp.go | 85 ++++----- 7 files changed, 577 insertions(+), 142 deletions(-) diff --git a/pkg/rpc/convert.go b/pkg/rpc/convert.go index 6cec3f55d482..fbfb727a5942 100644 --- a/pkg/rpc/convert.go +++ b/pkg/rpc/convert.go @@ -1,12 +1,12 @@ package rpc import ( + "strings" "time" - "github.com/golang/protobuf/ptypes" + "github.com/samber/lo" "google.golang.org/protobuf/types/known/timestamppb" - "github.com/golang/protobuf/ptypes/timestamp" "google.golang.org/protobuf/types/known/structpb" 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) } - var lastModifiedDate, publishedDate *timestamp.Timestamp + var lastModifiedDate, publishedDate *timestamppb.Timestamp if vuln.LastModifiedDate != nil { lastModifiedDate = timestamppb.New(*vuln.LastModifiedDate) // nolint: errcheck } @@ -295,11 +295,36 @@ func ConvertFromRPCResults(rpcResults []*scanner.Result) []types.Result { Packages: ConvertFromRPCPkgs(result.Packages), CustomResources: ConvertFromRPCCustomResources(result.CustomResources), Secrets: ConvertFromRPCSecretFindings(result.Secrets), + Licenses: ConvertFromRPCLicenses(result.Licenses), }) } 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 func ConvertFromRPCCustomResources(rpcCustomResources []*common.CustomResource) []ftypes.CustomResource { var resources []ftypes.CustomResource @@ -390,12 +415,10 @@ func ConvertFromRPCVulns(rpcVulns []*common.Vulnerability) []types.DetectedVulne var lastModifiedDate, publishedDate *time.Time if vuln.LastModifiedDate != nil { - t, _ := ptypes.Timestamp(vuln.LastModifiedDate) // nolint: errcheck - lastModifiedDate = &t + lastModifiedDate = lo.ToPtr(vuln.LastModifiedDate.AsTime()) } if vuln.PublishedDate != nil { - t, _ := ptypes.Timestamp(vuln.PublishedDate) // nolint: errcheck - publishedDate = &t + publishedDate = lo.ToPtr(vuln.PublishedDate.AsTime()) } vulns = append(vulns, types.DetectedVulnerability{ @@ -591,11 +614,10 @@ func ConvertFromRPCMisconfResults(rpcResults []*common.MisconfResult) []ftypes.M // ConvertFromRPCPutArtifactRequest converts cache.PutArtifactRequest to fanal.PutArtifactRequest func ConvertFromRPCPutArtifactRequest(req *cache.PutArtifactRequest) ftypes.ArtifactInfo { - created, _ := ptypes.Timestamp(req.ArtifactInfo.Created) // nolint: errcheck return ftypes.ArtifactInfo{ SchemaVersion: int(req.ArtifactInfo.SchemaVersion), Architecture: req.ArtifactInfo.Architecture, - Created: created, + Created: req.ArtifactInfo.Created.AsTime(), DockerVersion: req.ArtifactInfo.DockerVersion, OS: req.ArtifactInfo.Os, HistoryPackages: ConvertFromRPCPkgs(req.ArtifactInfo.HistoryPackages), @@ -643,8 +665,9 @@ func ConvertToRPCRepository(repo *ftypes.Repository) *common.Repository { // ConvertToRPCArtifactInfo returns 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) } @@ -765,6 +788,7 @@ func ConvertToRPCScanResponse(results types.Results, fos ftypes.OS) *scanner.Sca Packages: ConvertToRPCPkgs(result.Packages), CustomResources: ConvertToRPCCustomResources(result.CustomResources), 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 { return &cache.DeleteBlobsRequest{BlobIds: blobIDs} } diff --git a/pkg/rpc/convert_test.go b/pkg/rpc/convert_test.go index 1fa4637601bd..fac1b9fd3f8f 100644 --- a/pkg/rpc/convert_test.go +++ b/pkg/rpc/convert_test.go @@ -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) + }) + } +} diff --git a/rpc/common/service.pb.go b/rpc/common/service.pb.go index 16a08f6cbcc4..0e7fe6173420 100644 --- a/rpc/common/service.pb.go +++ b/rpc/common/service.pb.go @@ -77,6 +77,70 @@ func (Severity) EnumDescriptor() ([]byte, []int) { 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 { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1806,6 +1870,101 @@ func (x *Secret) GetFindings() []*SecretFinding { 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_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, 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, - 0x67, 0x52, 0x08, 0x66, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 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, + 0x67, 0x52, 0x08, 0x66, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x9f, 0x03, 0x0a, 0x0f, + 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, + 0x32, 0x0a, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x16, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x52, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, + 0x69, 0x74, 0x79, 0x12, 0x49, 0x0a, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x63, + 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 ( @@ -2128,70 +2313,74 @@ func file_rpc_common_service_proto_rawDescGZIP() []byte { return file_rpc_common_service_proto_rawDescData } -var file_rpc_common_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_rpc_common_service_proto_msgTypes = make([]protoimpl.MessageInfo, 21) +var file_rpc_common_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_rpc_common_service_proto_msgTypes = make([]protoimpl.MessageInfo, 22) var file_rpc_common_service_proto_goTypes = []interface{}{ - (Severity)(0), // 0: trivy.common.Severity - (*OS)(nil), // 1: trivy.common.OS - (*Repository)(nil), // 2: trivy.common.Repository - (*PackageInfo)(nil), // 3: trivy.common.PackageInfo - (*Application)(nil), // 4: trivy.common.Application - (*Package)(nil), // 5: trivy.common.Package - (*Misconfiguration)(nil), // 6: trivy.common.Misconfiguration - (*MisconfResult)(nil), // 7: trivy.common.MisconfResult - (*PolicyMetadata)(nil), // 8: trivy.common.PolicyMetadata - (*DetectedMisconfiguration)(nil), // 9: trivy.common.DetectedMisconfiguration - (*Vulnerability)(nil), // 10: trivy.common.Vulnerability - (*DataSource)(nil), // 11: trivy.common.DataSource - (*Layer)(nil), // 12: trivy.common.Layer - (*CauseMetadata)(nil), // 13: trivy.common.CauseMetadata - (*CVSS)(nil), // 14: trivy.common.CVSS - (*CustomResource)(nil), // 15: trivy.common.CustomResource - (*Line)(nil), // 16: trivy.common.Line - (*Code)(nil), // 17: trivy.common.Code - (*SecretFinding)(nil), // 18: trivy.common.SecretFinding - (*Secret)(nil), // 19: trivy.common.Secret - nil, // 20: trivy.common.Vulnerability.CvssEntry - nil, // 21: trivy.common.Vulnerability.VendorSeverityEntry - (*timestamppb.Timestamp)(nil), // 22: google.protobuf.Timestamp - (*structpb.Value)(nil), // 23: google.protobuf.Value + (Severity)(0), // 0: trivy.common.Severity + (DetectedLicense_LicenseCategory)(0), // 1: trivy.common.DetectedLicense.LicenseCategory + (*OS)(nil), // 2: trivy.common.OS + (*Repository)(nil), // 3: trivy.common.Repository + (*PackageInfo)(nil), // 4: trivy.common.PackageInfo + (*Application)(nil), // 5: trivy.common.Application + (*Package)(nil), // 6: trivy.common.Package + (*Misconfiguration)(nil), // 7: trivy.common.Misconfiguration + (*MisconfResult)(nil), // 8: trivy.common.MisconfResult + (*PolicyMetadata)(nil), // 9: trivy.common.PolicyMetadata + (*DetectedMisconfiguration)(nil), // 10: trivy.common.DetectedMisconfiguration + (*Vulnerability)(nil), // 11: trivy.common.Vulnerability + (*DataSource)(nil), // 12: trivy.common.DataSource + (*Layer)(nil), // 13: trivy.common.Layer + (*CauseMetadata)(nil), // 14: trivy.common.CauseMetadata + (*CVSS)(nil), // 15: trivy.common.CVSS + (*CustomResource)(nil), // 16: trivy.common.CustomResource + (*Line)(nil), // 17: trivy.common.Line + (*Code)(nil), // 18: trivy.common.Code + (*SecretFinding)(nil), // 19: trivy.common.SecretFinding + (*Secret)(nil), // 20: trivy.common.Secret + (*DetectedLicense)(nil), // 21: trivy.common.DetectedLicense + nil, // 22: trivy.common.Vulnerability.CvssEntry + 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{ - 5, // 0: trivy.common.PackageInfo.packages:type_name -> trivy.common.Package - 5, // 1: trivy.common.Application.libraries:type_name -> trivy.common.Package - 12, // 2: trivy.common.Package.layer:type_name -> trivy.common.Layer - 7, // 3: trivy.common.Misconfiguration.successes:type_name -> trivy.common.MisconfResult - 7, // 4: trivy.common.Misconfiguration.warnings:type_name -> trivy.common.MisconfResult - 7, // 5: trivy.common.Misconfiguration.failures:type_name -> trivy.common.MisconfResult - 7, // 6: trivy.common.Misconfiguration.exceptions:type_name -> trivy.common.MisconfResult - 8, // 7: trivy.common.MisconfResult.policy_metadata:type_name -> trivy.common.PolicyMetadata - 13, // 8: trivy.common.MisconfResult.cause_metadata:type_name -> trivy.common.CauseMetadata + 6, // 0: trivy.common.PackageInfo.packages:type_name -> trivy.common.Package + 6, // 1: trivy.common.Application.libraries:type_name -> trivy.common.Package + 13, // 2: trivy.common.Package.layer:type_name -> trivy.common.Layer + 8, // 3: trivy.common.Misconfiguration.successes:type_name -> trivy.common.MisconfResult + 8, // 4: trivy.common.Misconfiguration.warnings:type_name -> trivy.common.MisconfResult + 8, // 5: trivy.common.Misconfiguration.failures:type_name -> trivy.common.MisconfResult + 8, // 6: trivy.common.Misconfiguration.exceptions:type_name -> trivy.common.MisconfResult + 9, // 7: trivy.common.MisconfResult.policy_metadata:type_name -> trivy.common.PolicyMetadata + 14, // 8: trivy.common.MisconfResult.cause_metadata:type_name -> trivy.common.CauseMetadata 0, // 9: trivy.common.DetectedMisconfiguration.severity:type_name -> trivy.common.Severity - 12, // 10: trivy.common.DetectedMisconfiguration.layer:type_name -> trivy.common.Layer - 13, // 11: trivy.common.DetectedMisconfiguration.cause_metadata:type_name -> trivy.common.CauseMetadata + 13, // 10: trivy.common.DetectedMisconfiguration.layer:type_name -> trivy.common.Layer + 14, // 11: trivy.common.DetectedMisconfiguration.cause_metadata:type_name -> trivy.common.CauseMetadata 0, // 12: trivy.common.Vulnerability.severity:type_name -> trivy.common.Severity - 12, // 13: trivy.common.Vulnerability.layer:type_name -> trivy.common.Layer - 20, // 14: trivy.common.Vulnerability.cvss:type_name -> trivy.common.Vulnerability.CvssEntry - 22, // 15: trivy.common.Vulnerability.published_date:type_name -> google.protobuf.Timestamp - 22, // 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 - 23, // 18: trivy.common.Vulnerability.custom_vuln_data:type_name -> google.protobuf.Value - 11, // 19: trivy.common.Vulnerability.data_source:type_name -> trivy.common.DataSource - 21, // 20: trivy.common.Vulnerability.vendor_severity:type_name -> trivy.common.Vulnerability.VendorSeverityEntry - 17, // 21: trivy.common.CauseMetadata.code:type_name -> trivy.common.Code - 12, // 22: trivy.common.CustomResource.layer:type_name -> trivy.common.Layer - 23, // 23: trivy.common.CustomResource.data:type_name -> google.protobuf.Value - 16, // 24: trivy.common.Code.lines:type_name -> trivy.common.Line - 17, // 25: trivy.common.SecretFinding.code:type_name -> trivy.common.Code - 12, // 26: trivy.common.SecretFinding.layer:type_name -> trivy.common.Layer - 18, // 27: trivy.common.Secret.findings:type_name -> trivy.common.SecretFinding - 14, // 28: trivy.common.Vulnerability.CvssEntry.value:type_name -> trivy.common.CVSS - 0, // 29: trivy.common.Vulnerability.VendorSeverityEntry.value:type_name -> trivy.common.Severity - 30, // [30:30] is the sub-list for method output_type - 30, // [30:30] is the sub-list for method input_type - 30, // [30:30] is the sub-list for extension type_name - 30, // [30:30] is the sub-list for extension extendee - 0, // [0:30] is the sub-list for field type_name + 13, // 13: trivy.common.Vulnerability.layer:type_name -> trivy.common.Layer + 22, // 14: trivy.common.Vulnerability.cvss:type_name -> trivy.common.Vulnerability.CvssEntry + 24, // 15: trivy.common.Vulnerability.published_date:type_name -> google.protobuf.Timestamp + 24, // 16: trivy.common.Vulnerability.last_modified_date:type_name -> google.protobuf.Timestamp + 25, // 17: trivy.common.Vulnerability.custom_advisory_data:type_name -> google.protobuf.Value + 25, // 18: trivy.common.Vulnerability.custom_vuln_data:type_name -> google.protobuf.Value + 12, // 19: trivy.common.Vulnerability.data_source:type_name -> trivy.common.DataSource + 23, // 20: trivy.common.Vulnerability.vendor_severity:type_name -> trivy.common.Vulnerability.VendorSeverityEntry + 18, // 21: trivy.common.CauseMetadata.code:type_name -> trivy.common.Code + 13, // 22: trivy.common.CustomResource.layer:type_name -> trivy.common.Layer + 25, // 23: trivy.common.CustomResource.data:type_name -> google.protobuf.Value + 17, // 24: trivy.common.Code.lines:type_name -> trivy.common.Line + 18, // 25: trivy.common.SecretFinding.code:type_name -> trivy.common.Code + 13, // 26: trivy.common.SecretFinding.layer:type_name -> trivy.common.Layer + 19, // 27: trivy.common.Secret.findings:type_name -> trivy.common.SecretFinding + 0, // 28: trivy.common.DetectedLicense.severity:type_name -> trivy.common.Severity + 1, // 29: trivy.common.DetectedLicense.category:type_name -> trivy.common.DetectedLicense.LicenseCategory + 15, // 30: trivy.common.Vulnerability.CvssEntry.value:type_name -> trivy.common.CVSS + 0, // 31: trivy.common.Vulnerability.VendorSeverityEntry.value:type_name -> trivy.common.Severity + 32, // [32:32] is the sub-list for method output_type + 32, // [32:32] is the sub-list for method input_type + 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() } @@ -2428,14 +2617,26 @@ func file_rpc_common_service_proto_init() { 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{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_rpc_common_service_proto_rawDesc, - NumEnums: 1, - NumMessages: 21, + NumEnums: 2, + NumMessages: 22, NumExtensions: 0, NumServices: 0, }, diff --git a/rpc/common/service.proto b/rpc/common/service.proto index 847382b226ad..cb3fd4e656c8 100644 --- a/rpc/common/service.proto +++ b/rpc/common/service.proto @@ -202,3 +202,24 @@ message Secret { string filepath = 1; 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; + } +} diff --git a/rpc/scanner/service.pb.go b/rpc/scanner/service.pb.go index 2e31a8ae9254..eb75c1d582b6 100644 --- a/rpc/scanner/service.pb.go +++ b/rpc/scanner/service.pb.go @@ -289,6 +289,7 @@ type Result struct { 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"` 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() { @@ -379,6 +380,13 @@ func (x *Result) GetSecrets() []*common.SecretFinding { 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_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, 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, - 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, 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, @@ -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, 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, - 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x32, - 0x50, 0x0a, 0x07, 0x53, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x12, 0x45, 0x0a, 0x04, 0x53, 0x63, - 0x61, 0x6e, 0x12, 0x1d, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x73, 0x63, 0x61, 0x6e, 0x6e, - 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1e, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, - 0x72, 0x2e, 0x76, 0x31, 0x2e, 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, + 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x12, + 0x39, 0x0a, 0x08, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, + 0x52, 0x08, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x73, 0x32, 0x50, 0x0a, 0x07, 0x53, 0x63, + 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x12, 0x45, 0x0a, 0x04, 0x53, 0x63, 0x61, 0x6e, 0x12, 0x1d, 0x2e, + 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x2e, 0x76, 0x31, + 0x2e, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x74, + 0x72, 0x69, 0x76, 0x79, 0x2e, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, + 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 ( @@ -490,6 +502,7 @@ var file_rpc_scanner_service_proto_goTypes = []interface{}{ (*common.Package)(nil), // 9: trivy.common.Package (*common.CustomResource)(nil), // 10: trivy.common.CustomResource (*common.SecretFinding)(nil), // 11: trivy.common.SecretFinding + (*common.DetectedLicense)(nil), // 12: trivy.common.DetectedLicense } var file_rpc_scanner_service_proto_depIdxs = []int32{ 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 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 - 1, // 9: trivy.scanner.v1.ScanOptions.LicenseCategoriesEntry.value:type_name -> trivy.scanner.v1.Licenses - 0, // 10: trivy.scanner.v1.Scanner.Scan:input_type -> trivy.scanner.v1.ScanRequest - 3, // 11: trivy.scanner.v1.Scanner.Scan:output_type -> trivy.scanner.v1.ScanResponse - 11, // [11:12] is the sub-list for method output_type - 10, // [10:11] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name + 12, // 9: trivy.scanner.v1.Result.licenses:type_name -> trivy.common.DetectedLicense + 1, // 10: trivy.scanner.v1.ScanOptions.LicenseCategoriesEntry.value:type_name -> trivy.scanner.v1.Licenses + 0, // 11: trivy.scanner.v1.Scanner.Scan:input_type -> trivy.scanner.v1.ScanRequest + 3, // 12: trivy.scanner.v1.Scanner.Scan:output_type -> trivy.scanner.v1.ScanResponse + 12, // [12:13] is the sub-list for method output_type + 11, // [11:12] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension 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() } diff --git a/rpc/scanner/service.proto b/rpc/scanner/service.proto index f3ac739b1277..63f98d2779c6 100644 --- a/rpc/scanner/service.proto +++ b/rpc/scanner/service.proto @@ -45,4 +45,5 @@ message Result { repeated common.Package packages = 5; repeated common.CustomResource custom_resources = 7; repeated common.SecretFinding secrets = 8; + repeated common.DetectedLicense licenses = 9; } \ No newline at end of file diff --git a/rpc/scanner/service.twirp.go b/rpc/scanner/service.twirp.go index ef30e349e90a..4c88aec5db46 100644 --- a/rpc/scanner/service.twirp.go +++ b/rpc/scanner/service.twirp.go @@ -1094,46 +1094,47 @@ func callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) } var twirpFileDescriptor0 = []byte{ - // 644 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0x4d, 0x6f, 0x13, 0x31, - 0x10, 0x55, 0x92, 0xe6, 0xa3, 0x13, 0x44, 0x53, 0x0b, 0xaa, 0x6d, 0xca, 0x47, 0x94, 0x03, 0x8a, - 0x38, 0x24, 0x34, 0x05, 0x81, 0xe0, 0x04, 0x6d, 0x41, 0x95, 0x40, 0xad, 0x9c, 0x8a, 0x03, 0x97, - 0xc5, 0xf1, 0x4e, 0x83, 0xd5, 0xcd, 0xee, 0xd6, 0xe3, 0x8d, 0x94, 0xbf, 0xd2, 0xbf, 0xc7, 0x1f, - 0x41, 0xf6, 0x7a, 0xab, 0x26, 0x6d, 0x39, 0xad, 0x67, 0xe6, 0xcd, 0x9b, 0x67, 0xfb, 0xad, 0x61, - 0x57, 0x67, 0x72, 0x44, 0x52, 0x24, 0x09, 0xea, 0x11, 0xa1, 0x5e, 0x28, 0x89, 0xc3, 0x4c, 0xa7, - 0x26, 0x65, 0x1d, 0xa3, 0xd5, 0x62, 0x39, 0xf4, 0xc5, 0xe1, 0x62, 0xbf, 0x1b, 0x58, 0xb0, 0x4c, - 0xe7, 0xf3, 0x34, 0x59, 0xc5, 0xf6, 0xaf, 0x2b, 0xd0, 0x9e, 0x48, 0x91, 0x70, 0xbc, 0xca, 0x91, - 0x0c, 0xdb, 0x81, 0x86, 0x11, 0x7a, 0x86, 0x26, 0xa8, 0xf4, 0x2a, 0x83, 0x4d, 0xee, 0x23, 0xf6, - 0x12, 0xda, 0x42, 0x1b, 0x75, 0x21, 0xa4, 0x09, 0x55, 0x14, 0x54, 0x5d, 0x11, 0xca, 0xd4, 0x49, - 0xc4, 0x76, 0xa1, 0x35, 0x8d, 0xd3, 0x69, 0xa8, 0x22, 0x0a, 0x6a, 0xbd, 0xda, 0x60, 0x93, 0x37, - 0x6d, 0x7c, 0x12, 0x11, 0x7b, 0x0f, 0xcd, 0x34, 0x33, 0x2a, 0x4d, 0x28, 0xd8, 0xe8, 0x55, 0x06, - 0xed, 0xf1, 0xf3, 0xe1, 0xba, 0xc2, 0xa1, 0xd5, 0x70, 0x5a, 0x80, 0x78, 0x89, 0xee, 0xf7, 0xa0, - 0xf5, 0x5d, 0x49, 0x4c, 0x08, 0x89, 0x3d, 0x81, 0x7a, 0x22, 0xe6, 0x48, 0x41, 0xc5, 0x91, 0x17, - 0x41, 0xff, 0x6f, 0xb5, 0x90, 0xef, 0x5b, 0xd9, 0x1e, 0x6c, 0x2e, 0xf2, 0x38, 0x09, 0xcd, 0x32, - 0x43, 0x8f, 0x6c, 0xd9, 0xc4, 0xf9, 0x32, 0x43, 0xd6, 0x85, 0x96, 0x9f, 0x48, 0x41, 0xb5, 0xa8, - 0x95, 0x31, 0x7b, 0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 0xdf, 0x69, 0xc3, 0xbd, 0x5a, 0x07, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa8, 0x6f, 0x32, 0xf0, - 0xfe, 0x04, 0x00, 0x00, + // 665 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xdd, 0x6e, 0xda, 0x4a, + 0x10, 0x16, 0x10, 0xc0, 0x0c, 0x47, 0x27, 0x64, 0x75, 0x4e, 0xe4, 0x90, 0xa6, 0x45, 0x5c, 0x54, + 0xa8, 0x17, 0xd0, 0x90, 0x56, 0xfd, 0xbb, 0x6a, 0x93, 0xb4, 0x8a, 0xd4, 0x2a, 0xd1, 0x12, 0xf5, + 0xa2, 0x37, 0xee, 0xb2, 0x9e, 0xd0, 0x55, 0x8c, 0xed, 0xec, 0xac, 0x91, 0x78, 0x95, 0xbe, 0x57, + 0x9f, 0xa0, 0x2f, 0x52, 0x79, 0xbd, 0x46, 0x81, 0x24, 0xbd, 0xb2, 0x67, 0xe6, 0x9b, 0x6f, 0xbe, + 0xdd, 0xfd, 0x34, 0xb0, 0xa7, 0x53, 0x39, 0x22, 0x29, 0xe2, 0x18, 0xf5, 0x88, 0x50, 0x2f, 0x94, + 0xc4, 0x61, 0xaa, 0x13, 0x93, 0xb0, 0x8e, 0xd1, 0x6a, 0xb1, 0x1c, 0xba, 0xe2, 0x70, 0x71, 0xd8, + 0xf5, 0x73, 0xb0, 0x4c, 0xe6, 0xf3, 0x24, 0x5e, 0xc7, 0xf6, 0x7f, 0x56, 0xa0, 0x3d, 0x91, 0x22, + 0xe6, 0x78, 0x93, 0x21, 0x19, 0xb6, 0x0b, 0x0d, 0x23, 0xf4, 0x0c, 0x8d, 0x5f, 0xe9, 0x55, 0x06, + 0x2d, 0xee, 0x22, 0xf6, 0x04, 0xda, 0x42, 0x1b, 0x75, 0x25, 0xa4, 0x09, 0x54, 0xe8, 0x57, 0x6d,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