chore(rpc): update protoc and twirp (#1044)

This commit is contained in:
Teppei Fukuda
2021-06-06 16:33:25 +03:00
committed by GitHub
parent e4c32cdb77
commit f75a36945c
11 changed files with 2648 additions and 1319 deletions

View File

@@ -54,7 +54,7 @@ build:
.PHONY: protoc
protoc:
find ./rpc/ -name "*.proto" -type f -exec protoc --proto_path=$(GOSRC):. --twirp_out=. --go_out=. {} \;
find ./rpc/ -name "*.proto" -type f -exec protoc --proto_path=$(GOSRC):. --twirp_out=. --twirp_opt=paths=source_relative --go_out=. --go_opt=paths=source_relative {} \;
.PHONY: install
install:

2
go.mod
View File

@@ -44,7 +44,7 @@ require (
github.com/stretchr/objx v0.3.0 // indirect
github.com/stretchr/testify v1.7.0
github.com/testcontainers/testcontainers-go v0.9.1-0.20210218153226-c8e070a2f18d
github.com/twitchtv/twirp v5.10.1+incompatible
github.com/twitchtv/twirp v8.0.0+incompatible
github.com/urfave/cli/v2 v2.3.0
go.uber.org/zap v1.16.0
golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f // indirect

4
go.sum
View File

@@ -1196,8 +1196,8 @@ github.com/tommy-muehle/go-mnd v1.1.1/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaoz
github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig=
github.com/tonistiigi/fsutil v0.0.0-20201103201449-0834f99b7b85/go.mod h1:a7cilN64dG941IOXfhJhlH0qB92hxJ9A1ewrdUmJ6xo=
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea/go.mod h1:WPnis/6cRcDZSUvVmezrxJPkiO87ThFYsoUiMwWNDJk=
github.com/twitchtv/twirp v5.10.1+incompatible h1:35js8ID9rYPKkZ0qWnuZw+q+OuCWM1GIibu1F1YImjA=
github.com/twitchtv/twirp v5.10.1+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A=
github.com/twitchtv/twirp v8.0.0+incompatible h1:uYHA8+9cit/+LUfQjL6zo/0QDKTo4U2H/WAnJ6LfhBU=
github.com/twitchtv/twirp v8.0.0+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A=
github.com/uber/jaeger-client-go v2.25.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
syntax = "proto3";
package trivy.cache.v1;
option go_package = "cache";
option go_package = "github.com/aquasecurity/trivy/rpc/cache;cache";
import "google/protobuf/timestamp.proto";
import "github.com/aquasecurity/trivy/rpc/common/service.proto";

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@ syntax = "proto3";
import "google/protobuf/timestamp.proto";
package trivy.common;
option go_package = "common";
option go_package = "github.com/aquasecurity/trivy/rpc/common;common";
message OS {
string family = 1;

View File

@@ -1,302 +1,460 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.17.2
// source: rpc/scanner/service.proto
package scanner
import (
fmt "fmt"
common "github.com/aquasecurity/trivy/rpc/common"
proto "github.com/golang/protobuf/proto"
math "math"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ScanRequest struct {
Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
ArtifactId string `protobuf:"bytes,2,opt,name=artifact_id,json=artifactId,proto3" json:"artifact_id,omitempty"`
BlobIds []string `protobuf:"bytes,3,rep,name=blob_ids,json=blobIds,proto3" json:"blob_ids,omitempty"`
Options *ScanOptions `protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` // image name or tar file path
ArtifactId string `protobuf:"bytes,2,opt,name=artifact_id,json=artifactId,proto3" json:"artifact_id,omitempty"`
BlobIds []string `protobuf:"bytes,3,rep,name=blob_ids,json=blobIds,proto3" json:"blob_ids,omitempty"`
Options *ScanOptions `protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty"`
}
func (m *ScanRequest) Reset() { *m = ScanRequest{} }
func (m *ScanRequest) String() string { return proto.CompactTextString(m) }
func (*ScanRequest) ProtoMessage() {}
func (x *ScanRequest) Reset() {
*x = ScanRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_scanner_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ScanRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ScanRequest) ProtoMessage() {}
func (x *ScanRequest) ProtoReflect() protoreflect.Message {
mi := &file_rpc_scanner_service_proto_msgTypes[0]
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 ScanRequest.ProtoReflect.Descriptor instead.
func (*ScanRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_60d0e837512b18d4, []int{0}
return file_rpc_scanner_service_proto_rawDescGZIP(), []int{0}
}
func (m *ScanRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ScanRequest.Unmarshal(m, b)
}
func (m *ScanRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ScanRequest.Marshal(b, m, deterministic)
}
func (m *ScanRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ScanRequest.Merge(m, src)
}
func (m *ScanRequest) XXX_Size() int {
return xxx_messageInfo_ScanRequest.Size(m)
}
func (m *ScanRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ScanRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ScanRequest proto.InternalMessageInfo
func (m *ScanRequest) GetTarget() string {
if m != nil {
return m.Target
func (x *ScanRequest) GetTarget() string {
if x != nil {
return x.Target
}
return ""
}
func (m *ScanRequest) GetArtifactId() string {
if m != nil {
return m.ArtifactId
func (x *ScanRequest) GetArtifactId() string {
if x != nil {
return x.ArtifactId
}
return ""
}
func (m *ScanRequest) GetBlobIds() []string {
if m != nil {
return m.BlobIds
func (x *ScanRequest) GetBlobIds() []string {
if x != nil {
return x.BlobIds
}
return nil
}
func (m *ScanRequest) GetOptions() *ScanOptions {
if m != nil {
return m.Options
func (x *ScanRequest) GetOptions() *ScanOptions {
if x != nil {
return x.Options
}
return nil
}
type ScanOptions struct {
VulnType []string `protobuf:"bytes,1,rep,name=vuln_type,json=vulnType,proto3" json:"vuln_type,omitempty"`
SecurityChecks []string `protobuf:"bytes,2,rep,name=security_checks,json=securityChecks,proto3" json:"security_checks,omitempty"`
ListAllPackages bool `protobuf:"varint,3,opt,name=list_all_packages,json=listAllPackages,proto3" json:"list_all_packages,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
VulnType []string `protobuf:"bytes,1,rep,name=vuln_type,json=vulnType,proto3" json:"vuln_type,omitempty"`
SecurityChecks []string `protobuf:"bytes,2,rep,name=security_checks,json=securityChecks,proto3" json:"security_checks,omitempty"`
ListAllPackages bool `protobuf:"varint,3,opt,name=list_all_packages,json=listAllPackages,proto3" json:"list_all_packages,omitempty"`
}
func (m *ScanOptions) Reset() { *m = ScanOptions{} }
func (m *ScanOptions) String() string { return proto.CompactTextString(m) }
func (*ScanOptions) ProtoMessage() {}
func (x *ScanOptions) Reset() {
*x = ScanOptions{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_scanner_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ScanOptions) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ScanOptions) ProtoMessage() {}
func (x *ScanOptions) ProtoReflect() protoreflect.Message {
mi := &file_rpc_scanner_service_proto_msgTypes[1]
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 ScanOptions.ProtoReflect.Descriptor instead.
func (*ScanOptions) Descriptor() ([]byte, []int) {
return fileDescriptor_60d0e837512b18d4, []int{1}
return file_rpc_scanner_service_proto_rawDescGZIP(), []int{1}
}
func (m *ScanOptions) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ScanOptions.Unmarshal(m, b)
}
func (m *ScanOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ScanOptions.Marshal(b, m, deterministic)
}
func (m *ScanOptions) XXX_Merge(src proto.Message) {
xxx_messageInfo_ScanOptions.Merge(m, src)
}
func (m *ScanOptions) XXX_Size() int {
return xxx_messageInfo_ScanOptions.Size(m)
}
func (m *ScanOptions) XXX_DiscardUnknown() {
xxx_messageInfo_ScanOptions.DiscardUnknown(m)
}
var xxx_messageInfo_ScanOptions proto.InternalMessageInfo
func (m *ScanOptions) GetVulnType() []string {
if m != nil {
return m.VulnType
func (x *ScanOptions) GetVulnType() []string {
if x != nil {
return x.VulnType
}
return nil
}
func (m *ScanOptions) GetSecurityChecks() []string {
if m != nil {
return m.SecurityChecks
func (x *ScanOptions) GetSecurityChecks() []string {
if x != nil {
return x.SecurityChecks
}
return nil
}
func (m *ScanOptions) GetListAllPackages() bool {
if m != nil {
return m.ListAllPackages
func (x *ScanOptions) GetListAllPackages() bool {
if x != nil {
return x.ListAllPackages
}
return false
}
type ScanResponse struct {
Os *common.OS `protobuf:"bytes,1,opt,name=os,proto3" json:"os,omitempty"`
Eosl bool `protobuf:"varint,2,opt,name=eosl,proto3" json:"eosl,omitempty"`
Results []*Result `protobuf:"bytes,3,rep,name=results,proto3" json:"results,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Os *common.OS `protobuf:"bytes,1,opt,name=os,proto3" json:"os,omitempty"`
Eosl bool `protobuf:"varint,2,opt,name=eosl,proto3" json:"eosl,omitempty"`
Results []*Result `protobuf:"bytes,3,rep,name=results,proto3" json:"results,omitempty"`
}
func (m *ScanResponse) Reset() { *m = ScanResponse{} }
func (m *ScanResponse) String() string { return proto.CompactTextString(m) }
func (*ScanResponse) ProtoMessage() {}
func (x *ScanResponse) Reset() {
*x = ScanResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_scanner_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ScanResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ScanResponse) ProtoMessage() {}
func (x *ScanResponse) ProtoReflect() protoreflect.Message {
mi := &file_rpc_scanner_service_proto_msgTypes[2]
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 ScanResponse.ProtoReflect.Descriptor instead.
func (*ScanResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_60d0e837512b18d4, []int{2}
return file_rpc_scanner_service_proto_rawDescGZIP(), []int{2}
}
func (m *ScanResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ScanResponse.Unmarshal(m, b)
}
func (m *ScanResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ScanResponse.Marshal(b, m, deterministic)
}
func (m *ScanResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ScanResponse.Merge(m, src)
}
func (m *ScanResponse) XXX_Size() int {
return xxx_messageInfo_ScanResponse.Size(m)
}
func (m *ScanResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ScanResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ScanResponse proto.InternalMessageInfo
func (m *ScanResponse) GetOs() *common.OS {
if m != nil {
return m.Os
func (x *ScanResponse) GetOs() *common.OS {
if x != nil {
return x.Os
}
return nil
}
func (m *ScanResponse) GetEosl() bool {
if m != nil {
return m.Eosl
func (x *ScanResponse) GetEosl() bool {
if x != nil {
return x.Eosl
}
return false
}
func (m *ScanResponse) GetResults() []*Result {
if m != nil {
return m.Results
func (x *ScanResponse) GetResults() []*Result {
if x != nil {
return x.Results
}
return nil
}
// Result is the same as github.com/aquasecurity/trivy/pkg/report.Result
type Result struct {
Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
Vulnerabilities []*common.Vulnerability `protobuf:"bytes,2,rep,name=vulnerabilities,proto3" json:"vulnerabilities,omitempty"`
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
Packages []*common.Package `protobuf:"bytes,4,rep,name=packages,proto3" json:"packages,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
Vulnerabilities []*common.Vulnerability `protobuf:"bytes,2,rep,name=vulnerabilities,proto3" json:"vulnerabilities,omitempty"`
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
Packages []*common.Package `protobuf:"bytes,4,rep,name=packages,proto3" json:"packages,omitempty"`
}
func (m *Result) Reset() { *m = Result{} }
func (m *Result) String() string { return proto.CompactTextString(m) }
func (*Result) ProtoMessage() {}
func (x *Result) Reset() {
*x = Result{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_scanner_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Result) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Result) ProtoMessage() {}
func (x *Result) ProtoReflect() protoreflect.Message {
mi := &file_rpc_scanner_service_proto_msgTypes[3]
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 Result.ProtoReflect.Descriptor instead.
func (*Result) Descriptor() ([]byte, []int) {
return fileDescriptor_60d0e837512b18d4, []int{3}
return file_rpc_scanner_service_proto_rawDescGZIP(), []int{3}
}
func (m *Result) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Result.Unmarshal(m, b)
}
func (m *Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Result.Marshal(b, m, deterministic)
}
func (m *Result) XXX_Merge(src proto.Message) {
xxx_messageInfo_Result.Merge(m, src)
}
func (m *Result) XXX_Size() int {
return xxx_messageInfo_Result.Size(m)
}
func (m *Result) XXX_DiscardUnknown() {
xxx_messageInfo_Result.DiscardUnknown(m)
}
var xxx_messageInfo_Result proto.InternalMessageInfo
func (m *Result) GetTarget() string {
if m != nil {
return m.Target
func (x *Result) GetTarget() string {
if x != nil {
return x.Target
}
return ""
}
func (m *Result) GetVulnerabilities() []*common.Vulnerability {
if m != nil {
return m.Vulnerabilities
func (x *Result) GetVulnerabilities() []*common.Vulnerability {
if x != nil {
return x.Vulnerabilities
}
return nil
}
func (m *Result) GetType() string {
if m != nil {
return m.Type
func (x *Result) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (m *Result) GetPackages() []*common.Package {
if m != nil {
return m.Packages
func (x *Result) GetPackages() []*common.Package {
if x != nil {
return x.Packages
}
return nil
}
func init() {
proto.RegisterType((*ScanRequest)(nil), "trivy.scanner.v1.ScanRequest")
proto.RegisterType((*ScanOptions)(nil), "trivy.scanner.v1.ScanOptions")
proto.RegisterType((*ScanResponse)(nil), "trivy.scanner.v1.ScanResponse")
proto.RegisterType((*Result)(nil), "trivy.scanner.v1.Result")
var File_rpc_scanner_service_proto protoreflect.FileDescriptor
var file_rpc_scanner_service_proto_rawDesc = []byte{
0x0a, 0x19, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x2f, 0x73, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x74, 0x72, 0x69,
0x76, 0x79, 0x2e, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x1a, 0x36, 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, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9a, 0x01, 0x0a, 0x0b, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 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, 0x1f, 0x0a,
0x0b, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0a, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x49, 0x64, 0x12, 0x19,
0x0a, 0x08, 0x62, 0x6c, 0x6f, 0x62, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09,
0x52, 0x07, 0x62, 0x6c, 0x6f, 0x62, 0x49, 0x64, 0x73, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x72, 0x69,
0x76, 0x79, 0x2e, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63,
0x61, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x22, 0x7f, 0x0a, 0x0b, 0x53, 0x63, 0x61, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x12, 0x1b, 0x0a, 0x09, 0x76, 0x75, 0x6c, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01,
0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x76, 0x75, 0x6c, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x27,
0x0a, 0x0f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b,
0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74,
0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x6c, 0x69, 0x73, 0x74, 0x5f,
0x61, 0x6c, 0x6c, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01,
0x28, 0x08, 0x52, 0x0f, 0x6c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x50, 0x61, 0x63, 0x6b, 0x61,
0x67, 0x65, 0x73, 0x22, 0x78, 0x0a, 0x0c, 0x53, 0x63, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x02, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x10, 0x2e, 0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4f,
0x53, 0x52, 0x02, 0x6f, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x65, 0x6f, 0x73, 0x6c, 0x18, 0x02, 0x20,
0x01, 0x28, 0x08, 0x52, 0x04, 0x65, 0x6f, 0x73, 0x6c, 0x12, 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, 0x76, 0x31, 0x2e, 0x52, 0x65,
0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0xae, 0x01,
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, 0x2e, 0x74, 0x72, 0x69, 0x76,
0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x56, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61,
0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0f, 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62,
0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x31, 0x0a, 0x08, 0x70,
0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e,
0x74, 0x72, 0x69, 0x76, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x61, 0x63,
0x6b, 0x61, 0x67, 0x65, 0x52, 0x08, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 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,
}
func init() {
proto.RegisterFile("rpc/scanner/service.proto", fileDescriptor_60d0e837512b18d4)
var (
file_rpc_scanner_service_proto_rawDescOnce sync.Once
file_rpc_scanner_service_proto_rawDescData = file_rpc_scanner_service_proto_rawDesc
)
func file_rpc_scanner_service_proto_rawDescGZIP() []byte {
file_rpc_scanner_service_proto_rawDescOnce.Do(func() {
file_rpc_scanner_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_rpc_scanner_service_proto_rawDescData)
})
return file_rpc_scanner_service_proto_rawDescData
}
var fileDescriptor_60d0e837512b18d4 = []byte{
// 443 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x4f, 0x6f, 0xd3, 0x30,
0x1c, 0x55, 0xda, 0xaa, 0x49, 0x7f, 0x41, 0x74, 0x58, 0x02, 0x65, 0x9b, 0x80, 0xaa, 0x17, 0x2a,
0x0e, 0x89, 0x16, 0x24, 0x38, 0x03, 0xda, 0x61, 0xa7, 0x4d, 0x2e, 0xe2, 0xc0, 0x25, 0x72, 0x5c,
0xd3, 0x59, 0x73, 0xe3, 0xcc, 0x76, 0x2a, 0x72, 0xe2, 0x7b, 0xf0, 0x21, 0xf8, 0x8c, 0xc8, 0x7f,
0x32, 0xd1, 0x4d, 0xbd, 0xfd, 0xfc, 0x7e, 0x2f, 0x2f, 0xef, 0x3d, 0x1b, 0x4e, 0x55, 0x4b, 0x0b,
0x4d, 0x49, 0xd3, 0x30, 0x55, 0x68, 0xa6, 0xf6, 0x9c, 0xb2, 0xbc, 0x55, 0xd2, 0x48, 0x74, 0x62,
0x14, 0xdf, 0xf7, 0x79, 0x58, 0xe6, 0xfb, 0x8b, 0xb3, 0x8f, 0x5b, 0x6e, 0x6e, 0xbb, 0x3a, 0xa7,
0x72, 0x57, 0x90, 0xfb, 0x8e, 0x68, 0x46, 0x3b, 0xc5, 0x4d, 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x27, 0x21, 0x84, 0xaf, 0x35, 0xbf, 0x5e, 0xe3, 0x91, 0xd4, 0x08, 0xc1, 0x84, 0x49,
0x2d, 0x5c, 0x41, 0x09, 0x76, 0x33, 0x2a, 0x21, 0x56, 0x4c, 0x77, 0xc2, 0xf8, 0x66, 0xd2, 0x32,
0x7b, 0x9a, 0x1f, 0x3b, 0x02, 0x1e, 0x88, 0xcb, 0xbf, 0x11, 0x4c, 0x3d, 0x76, 0xf4, 0x4a, 0x2e,
0x61, 0x6e, 0xd3, 0x33, 0x45, 0x6a, 0x2e, 0xb8, 0xe1, 0xcc, 0x27, 0x4e, 0xcb, 0xf3, 0x43, 0x67,
0xdf, 0xff, 0x23, 0xf5, 0xf8, 0xf1, 0x37, 0xd6, 0xb1, 0x2b, 0x74, 0xec, 0xc4, 0xdd, 0x8c, 0x2e,
0x20, 0x79, 0xa8, 0x66, 0xe2, 0x34, 0x5f, 0x1e, 0x6a, 0x86, 0x86, 0xf0, 0x03, 0xad, 0xbc, 0x81,
0x78, 0xed, 0xe3, 0xa0, 0x4b, 0x98, 0xd8, 0x11, 0x1d, 0xb9, 0xe6, 0xf0, 0xd4, 0xce, 0xde, 0x1c,
0x5b, 0xfb, 0xb2, 0xbf, 0xcc, 0x7e, 0xc4, 0x61, 0x55, 0x4f, 0xdd, 0x63, 0xfd, 0xf0, 0x2f, 0x00,
0x00, 0xff, 0xff, 0x3a, 0xe6, 0x57, 0xdd, 0x13, 0x03, 0x00, 0x00,
var file_rpc_scanner_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_rpc_scanner_service_proto_goTypes = []interface{}{
(*ScanRequest)(nil), // 0: trivy.scanner.v1.ScanRequest
(*ScanOptions)(nil), // 1: trivy.scanner.v1.ScanOptions
(*ScanResponse)(nil), // 2: trivy.scanner.v1.ScanResponse
(*Result)(nil), // 3: trivy.scanner.v1.Result
(*common.OS)(nil), // 4: trivy.common.OS
(*common.Vulnerability)(nil), // 5: trivy.common.Vulnerability
(*common.Package)(nil), // 6: trivy.common.Package
}
var file_rpc_scanner_service_proto_depIdxs = []int32{
1, // 0: trivy.scanner.v1.ScanRequest.options:type_name -> trivy.scanner.v1.ScanOptions
4, // 1: trivy.scanner.v1.ScanResponse.os:type_name -> trivy.common.OS
3, // 2: trivy.scanner.v1.ScanResponse.results:type_name -> trivy.scanner.v1.Result
5, // 3: trivy.scanner.v1.Result.vulnerabilities:type_name -> trivy.common.Vulnerability
6, // 4: trivy.scanner.v1.Result.packages:type_name -> trivy.common.Package
0, // 5: trivy.scanner.v1.Scanner.Scan:input_type -> trivy.scanner.v1.ScanRequest
2, // 6: trivy.scanner.v1.Scanner.Scan:output_type -> trivy.scanner.v1.ScanResponse
6, // [6:7] is the sub-list for method output_type
5, // [5:6] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_rpc_scanner_service_proto_init() }
func file_rpc_scanner_service_proto_init() {
if File_rpc_scanner_service_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_rpc_scanner_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ScanRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_scanner_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ScanOptions); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_scanner_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ScanResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_scanner_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Result); 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_scanner_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_rpc_scanner_service_proto_goTypes,
DependencyIndexes: file_rpc_scanner_service_proto_depIdxs,
MessageInfos: file_rpc_scanner_service_proto_msgTypes,
}.Build()
File_rpc_scanner_service_proto = out.File
file_rpc_scanner_service_proto_rawDesc = nil
file_rpc_scanner_service_proto_goTypes = nil
file_rpc_scanner_service_proto_depIdxs = nil
}

View File

@@ -1,7 +1,7 @@
syntax = "proto3";
package trivy.scanner.v1;
option go_package = "scanner";
option go_package = "github.com/aquasecurity/trivy/rpc/scanner;scanner";
import "github.com/aquasecurity/trivy/rpc/common/service.proto";

View File

@@ -1,33 +1,39 @@
// Code generated by protoc-gen-twirp v5.10.1, DO NOT EDIT.
// Code generated by protoc-gen-twirp v8.0.0, DO NOT EDIT.
// source: rpc/scanner/service.proto
/*
Package scanner is a generated twirp stub package.
This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v5.10.1.
This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v8.0.0.
It is generated from these files:
rpc/scanner/service.proto
*/
package scanner
import bytes "bytes"
import strings "strings"
import context "context"
import fmt "fmt"
import ioutil "io/ioutil"
import http "net/http"
import ioutil "io/ioutil"
import json "encoding/json"
import strconv "strconv"
import strings "strings"
import jsonpb "github.com/golang/protobuf/jsonpb"
import proto "github.com/golang/protobuf/proto"
import protojson "google.golang.org/protobuf/encoding/protojson"
import proto "google.golang.org/protobuf/proto"
import twirp "github.com/twitchtv/twirp"
import ctxsetters "github.com/twitchtv/twirp/ctxsetters"
// Imports only used by utility functions:
import bytes "bytes"
import io "io"
import json "encoding/json"
import path "path"
import url "net/url"
// This is a compile-time assertion to ensure that this generated file
// is compatible with the twirp package used in your project.
// A compilation error at this line likely means your copy of the
// twirp package needs to be updated.
const _ = twirp.TwirpPackageIsVersion7
// =================
// Scanner Interface
// =================
@@ -41,14 +47,15 @@ type Scanner interface {
// =======================
type scannerProtobufClient struct {
client HTTPClient
urls [1]string
opts twirp.ClientOptions
client HTTPClient
urls [1]string
interceptor twirp.Interceptor
opts twirp.ClientOptions
}
// NewScannerProtobufClient creates a Protobuf client that implements the Scanner interface.
// It communicates using Protobuf and can be configured with a custom HTTPClient.
func NewScannerProtobufClient(addr string, client HTTPClient, opts ...twirp.ClientOption) Scanner {
func NewScannerProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Scanner {
if c, ok := client.(*http.Client); ok {
client = withoutRedirects(c)
}
@@ -58,15 +65,18 @@ func NewScannerProtobufClient(addr string, client HTTPClient, opts ...twirp.Clie
o(&clientOpts)
}
prefix := urlBase(addr) + ScannerPathPrefix
// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>
serviceURL := sanitizeBaseURL(baseURL)
serviceURL += baseServicePath(clientOpts.PathPrefix(), "trivy.scanner.v1", "Scanner")
urls := [1]string{
prefix + "Scan",
serviceURL + "Scan",
}
return &scannerProtobufClient{
client: client,
urls: urls,
opts: clientOpts,
client: client,
urls: urls,
interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),
opts: clientOpts,
}
}
@@ -74,8 +84,34 @@ func (c *scannerProtobufClient) Scan(ctx context.Context, in *ScanRequest) (*Sca
ctx = ctxsetters.WithPackageName(ctx, "trivy.scanner.v1")
ctx = ctxsetters.WithServiceName(ctx, "Scanner")
ctx = ctxsetters.WithMethodName(ctx, "Scan")
caller := c.callScan
if c.interceptor != nil {
caller = func(ctx context.Context, req *ScanRequest) (*ScanResponse, error) {
resp, err := c.interceptor(
func(ctx context.Context, req interface{}) (interface{}, error) {
typedReq, ok := req.(*ScanRequest)
if !ok {
return nil, twirp.InternalError("failed type assertion req.(*ScanRequest) when calling interceptor")
}
return c.callScan(ctx, typedReq)
},
)(ctx, req)
if resp != nil {
typedResp, ok := resp.(*ScanResponse)
if !ok {
return nil, twirp.InternalError("failed type assertion resp.(*ScanResponse) when calling interceptor")
}
return typedResp, err
}
return nil, err
}
}
return caller(ctx, in)
}
func (c *scannerProtobufClient) callScan(ctx context.Context, in *ScanRequest) (*ScanResponse, error) {
out := new(ScanResponse)
err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)
ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)
if err != nil {
twerr, ok := err.(twirp.Error)
if !ok {
@@ -95,14 +131,15 @@ func (c *scannerProtobufClient) Scan(ctx context.Context, in *ScanRequest) (*Sca
// ===================
type scannerJSONClient struct {
client HTTPClient
urls [1]string
opts twirp.ClientOptions
client HTTPClient
urls [1]string
interceptor twirp.Interceptor
opts twirp.ClientOptions
}
// NewScannerJSONClient creates a JSON client that implements the Scanner interface.
// It communicates using JSON and can be configured with a custom HTTPClient.
func NewScannerJSONClient(addr string, client HTTPClient, opts ...twirp.ClientOption) Scanner {
func NewScannerJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Scanner {
if c, ok := client.(*http.Client); ok {
client = withoutRedirects(c)
}
@@ -112,15 +149,18 @@ func NewScannerJSONClient(addr string, client HTTPClient, opts ...twirp.ClientOp
o(&clientOpts)
}
prefix := urlBase(addr) + ScannerPathPrefix
// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>
serviceURL := sanitizeBaseURL(baseURL)
serviceURL += baseServicePath(clientOpts.PathPrefix(), "trivy.scanner.v1", "Scanner")
urls := [1]string{
prefix + "Scan",
serviceURL + "Scan",
}
return &scannerJSONClient{
client: client,
urls: urls,
opts: clientOpts,
client: client,
urls: urls,
interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),
opts: clientOpts,
}
}
@@ -128,8 +168,34 @@ func (c *scannerJSONClient) Scan(ctx context.Context, in *ScanRequest) (*ScanRes
ctx = ctxsetters.WithPackageName(ctx, "trivy.scanner.v1")
ctx = ctxsetters.WithServiceName(ctx, "Scanner")
ctx = ctxsetters.WithMethodName(ctx, "Scan")
caller := c.callScan
if c.interceptor != nil {
caller = func(ctx context.Context, req *ScanRequest) (*ScanResponse, error) {
resp, err := c.interceptor(
func(ctx context.Context, req interface{}) (interface{}, error) {
typedReq, ok := req.(*ScanRequest)
if !ok {
return nil, twirp.InternalError("failed type assertion req.(*ScanRequest) when calling interceptor")
}
return c.callScan(ctx, typedReq)
},
)(ctx, req)
if resp != nil {
typedResp, ok := resp.(*ScanResponse)
if !ok {
return nil, twirp.InternalError("failed type assertion resp.(*ScanResponse) when calling interceptor")
}
return typedResp, err
}
return nil, err
}
}
return caller(ctx, in)
}
func (c *scannerJSONClient) callScan(ctx context.Context, in *ScanRequest) (*ScanResponse, error) {
out := new(ScanResponse)
err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)
ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)
if err != nil {
twerr, ok := err.(twirp.Error)
if !ok {
@@ -150,13 +216,36 @@ func (c *scannerJSONClient) Scan(ctx context.Context, in *ScanRequest) (*ScanRes
type scannerServer struct {
Scanner
hooks *twirp.ServerHooks
interceptor twirp.Interceptor
hooks *twirp.ServerHooks
pathPrefix string // prefix for routing
jsonSkipDefaults bool // do not include unpopulated fields (default values) in the response
}
func NewScannerServer(svc Scanner, hooks *twirp.ServerHooks) TwirpServer {
// NewScannerServer builds a TwirpServer that can be used as an http.Handler to handle
// HTTP requests that are routed to the right method in the provided svc implementation.
// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).
func NewScannerServer(svc Scanner, opts ...interface{}) TwirpServer {
serverOpts := twirp.ServerOptions{}
for _, opt := range opts {
switch o := opt.(type) {
case twirp.ServerOption:
o(&serverOpts)
case *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument
twirp.WithServerHooks(o)(&serverOpts)
case nil: // backwards compatibility, allow nil value for the argument
continue
default:
panic(fmt.Sprintf("Invalid option type %T on NewScannerServer", o))
}
}
return &scannerServer{
Scanner: svc,
hooks: hooks,
Scanner: svc,
pathPrefix: serverOpts.PathPrefix(),
interceptor: twirp.ChainInterceptors(serverOpts.Interceptors...),
hooks: serverOpts.Hooks,
jsonSkipDefaults: serverOpts.JSONSkipDefaults,
}
}
@@ -166,9 +255,23 @@ func (s *scannerServer) writeError(ctx context.Context, resp http.ResponseWriter
writeError(ctx, resp, err, s.hooks)
}
// ScannerPathPrefix is used for all URL paths on a twirp Scanner server.
// Requests are always: POST ScannerPathPrefix/method
// It can be used in an HTTP mux to route twirp requests along with non-twirp requests on other routes.
// handleRequestBodyError is used to handle error when the twirp server cannot read request
func (s *scannerServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {
if context.Canceled == ctx.Err() {
s.writeError(ctx, resp, twirp.NewError(twirp.Canceled, "failed to read request: context canceled"))
return
}
if context.DeadlineExceeded == ctx.Err() {
s.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, "failed to read request: deadline exceeded"))
return
}
s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))
}
// ScannerPathPrefix is a convenience constant that could used to identify URL paths.
// Should be used with caution, it only matches routes generated by Twirp Go clients,
// that add a "/twirp" prefix by default, and use CamelCase service and method names.
// More info: https://twitchtv.github.io/twirp/docs/routing.html
const ScannerPathPrefix = "/twirp/trivy.scanner.v1.Scanner/"
func (s *scannerServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
@@ -186,19 +289,30 @@ func (s *scannerServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
if req.Method != "POST" {
msg := fmt.Sprintf("unsupported method %q (only POST is allowed)", req.Method)
err = badRouteError(msg, req.Method, req.URL.Path)
s.writeError(ctx, resp, err)
s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))
return
}
switch req.URL.Path {
case "/twirp/trivy.scanner.v1.Scanner/Scan":
// Verify path format: [<prefix>]/<package>.<Service>/<Method>
prefix, pkgService, method := parseTwirpPath(req.URL.Path)
if pkgService != "trivy.scanner.v1.Scanner" {
msg := fmt.Sprintf("no handler for path %q", req.URL.Path)
s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))
return
}
if prefix != s.pathPrefix {
msg := fmt.Sprintf("invalid path prefix %q, expected %q, on path %q", prefix, s.pathPrefix, req.URL.Path)
s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))
return
}
switch method {
case "Scan":
s.serveScan(ctx, resp, req)
return
default:
msg := fmt.Sprintf("no handler for path %q", req.URL.Path)
err = badRouteError(msg, req.Method, req.URL.Path)
s.writeError(ctx, resp, err)
s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))
return
}
}
@@ -230,18 +344,47 @@ func (s *scannerServer) serveScanJSON(ctx context.Context, resp http.ResponseWri
return
}
reqContent := new(ScanRequest)
unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true}
if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil {
s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded"))
d := json.NewDecoder(req.Body)
rawReqBody := json.RawMessage{}
if err := d.Decode(&rawReqBody); err != nil {
s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
return
}
reqContent := new(ScanRequest)
unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
return
}
handler := s.Scanner.Scan
if s.interceptor != nil {
handler = func(ctx context.Context, req *ScanRequest) (*ScanResponse, error) {
resp, err := s.interceptor(
func(ctx context.Context, req interface{}) (interface{}, error) {
typedReq, ok := req.(*ScanRequest)
if !ok {
return nil, twirp.InternalError("failed type assertion req.(*ScanRequest) when calling interceptor")
}
return s.Scanner.Scan(ctx, typedReq)
},
)(ctx, req)
if resp != nil {
typedResp, ok := resp.(*ScanResponse)
if !ok {
return nil, twirp.InternalError("failed type assertion resp.(*ScanResponse) when calling interceptor")
}
return typedResp, err
}
return nil, err
}
}
// Call service method
var respContent *ScanResponse
func() {
defer ensurePanicResponses(ctx, resp, s.hooks)
respContent, err = s.Scanner.Scan(ctx, reqContent)
respContent, err = handler(ctx, reqContent)
}()
if err != nil {
@@ -255,15 +398,14 @@ func (s *scannerServer) serveScanJSON(ctx context.Context, resp http.ResponseWri
ctx = callResponsePrepared(ctx, s.hooks)
var buf bytes.Buffer
marshaler := &jsonpb.Marshaler{OrigName: true}
if err = marshaler.Marshal(&buf, respContent); err != nil {
marshaler := &protojson.MarshalOptions{UseProtoNames: true, EmitUnpopulated: !s.jsonSkipDefaults}
respBytes, err := marshaler.Marshal(respContent)
if err != nil {
s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
return
}
ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
respBytes := buf.Bytes()
resp.Header().Set("Content-Type", "application/json")
resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
resp.WriteHeader(http.StatusOK)
@@ -271,7 +413,7 @@ func (s *scannerServer) serveScanJSON(ctx context.Context, resp http.ResponseWri
if n, err := resp.Write(respBytes); err != nil {
msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
twerr := twirp.NewError(twirp.Unknown, msg)
callError(ctx, s.hooks, twerr)
ctx = callError(ctx, s.hooks, twerr)
}
callResponseSent(ctx, s.hooks)
}
@@ -287,7 +429,7 @@ func (s *scannerServer) serveScanProtobuf(ctx context.Context, resp http.Respons
buf, err := ioutil.ReadAll(req.Body)
if err != nil {
s.writeError(ctx, resp, wrapInternal(err, "failed to read request body"))
s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
return
}
reqContent := new(ScanRequest)
@@ -296,11 +438,34 @@ func (s *scannerServer) serveScanProtobuf(ctx context.Context, resp http.Respons
return
}
handler := s.Scanner.Scan
if s.interceptor != nil {
handler = func(ctx context.Context, req *ScanRequest) (*ScanResponse, error) {
resp, err := s.interceptor(
func(ctx context.Context, req interface{}) (interface{}, error) {
typedReq, ok := req.(*ScanRequest)
if !ok {
return nil, twirp.InternalError("failed type assertion req.(*ScanRequest) when calling interceptor")
}
return s.Scanner.Scan(ctx, typedReq)
},
)(ctx, req)
if resp != nil {
typedResp, ok := resp.(*ScanResponse)
if !ok {
return nil, twirp.InternalError("failed type assertion resp.(*ScanResponse) when calling interceptor")
}
return typedResp, err
}
return nil, err
}
}
// Call service method
var respContent *ScanResponse
func() {
defer ensurePanicResponses(ctx, resp, s.hooks)
respContent, err = s.Scanner.Scan(ctx, reqContent)
respContent, err = handler(ctx, reqContent)
}()
if err != nil {
@@ -327,7 +492,7 @@ func (s *scannerServer) serveScanProtobuf(ctx context.Context, resp http.Respons
if n, err := resp.Write(respBytes); err != nil {
msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
twerr := twirp.NewError(twirp.Unknown, msg)
callError(ctx, s.hooks, twerr)
ctx = callError(ctx, s.hooks, twerr)
}
callResponseSent(ctx, s.hooks)
}
@@ -337,11 +502,14 @@ func (s *scannerServer) ServiceDescriptor() ([]byte, int) {
}
func (s *scannerServer) ProtocGenTwirpVersion() string {
return "v5.10.1"
return "v8.0.0"
}
// PathPrefix returns the base service path, in the form: "/<prefix>/<package>.<Service>/"
// that is everything in a Twirp route except for the <Method>. This can be used for routing,
// for example to identify the requests that are targeted to this service in a mux.
func (s *scannerServer) PathPrefix() string {
return ScannerPathPrefix
return baseServicePath(s.pathPrefix, "trivy.scanner.v1", "Scanner")
}
// =====
@@ -366,21 +534,25 @@ type HTTPClient interface {
// Most people can think of TwirpServers as just http.Handlers.
type TwirpServer interface {
http.Handler
// ServiceDescriptor returns gzipped bytes describing the .proto file that
// this service was generated from. Once unzipped, the bytes can be
// unmarshalled as a
// github.com/golang/protobuf/protoc-gen-go/descriptor.FileDescriptorProto.
// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.
//
// The returned integer is the index of this particular service within that
// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a
// low-level field, expected to be used for reflection.
ServiceDescriptor() ([]byte, int)
// ProtocGenTwirpVersion is the semantic version string of the version of
// twirp used to generate this file.
ProtocGenTwirpVersion() string
// PathPrefix returns the HTTP URL path prefix for all methods handled by this
// service. This can be used with an HTTP mux to route twirp requests
// alongside non-twirp requests on one HTTP listener.
// service. This can be used with an HTTP mux to route Twirp requests.
// The path prefix is in the form: "/<prefix>/<package>.<Service>/"
// that is, everything in a Twirp route except for the <Method> at the end.
PathPrefix() string
}
@@ -431,19 +603,44 @@ func writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks
callResponseSent(ctx, hooks)
}
// urlBase helps ensure that addr specifies a scheme. If it is unparsable
// as a URL, it returns addr unchanged.
func urlBase(addr string) string {
// If the addr specifies a scheme, use it. If not, default to
// http. If url.Parse fails on it, return it unchanged.
url, err := url.Parse(addr)
// sanitizeBaseURL parses the the baseURL, and adds the "http" scheme if needed.
// If the URL is unparsable, the baseURL is returned unchaged.
func sanitizeBaseURL(baseURL string) string {
u, err := url.Parse(baseURL)
if err != nil {
return addr
return baseURL // invalid URL will fail later when making requests
}
if url.Scheme == "" {
url.Scheme = "http"
if u.Scheme == "" {
u.Scheme = "http"
}
return url.String()
return u.String()
}
// baseServicePath composes the path prefix for the service (without <Method>).
// e.g.: baseServicePath("/twirp", "my.pkg", "MyService")
// returns => "/twirp/my.pkg.MyService/"
// e.g.: baseServicePath("", "", "MyService")
// returns => "/MyService/"
func baseServicePath(prefix, pkg, service string) string {
fullServiceName := service
if pkg != "" {
fullServiceName = pkg + "." + service
}
return path.Join("/", prefix, fullServiceName) + "/"
}
// parseTwirpPath extracts path components form a valid Twirp route.
// Expected format: "[<prefix>]/<package>.<Service>/<Method>"
// e.g.: prefix, pkgService, method := parseTwirpPath("/twirp/pkg.Svc/MakeHat")
func parseTwirpPath(path string) (string, string, string) {
parts := strings.Split(path, "/")
if len(parts) < 2 {
return "", "", ""
}
method := parts[len(parts)-1]
pkgService := parts[len(parts)-2]
prefix := strings.Join(parts[0:len(parts)-2], "/")
return prefix, pkgService, method
}
// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in
@@ -478,7 +675,7 @@ func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType
}
req.Header.Set("Accept", contentType)
req.Header.Set("Content-Type", contentType)
req.Header.Set("Twirp-Version", "v5.10.1")
req.Header.Set("Twirp-Version", "v8.0.0")
return req, nil
}
@@ -546,7 +743,7 @@ func errorFromResponse(resp *http.Response) twirp.Error {
errorCode := twirp.ErrorCode(tj.Code)
if !twirp.IsValidErrorCode(errorCode) {
msg := "invalid type returned from server error response: " + tj.Code
return twirp.InternalError(msg)
return twirp.InternalError(msg).WithMeta("body", string(respBodyBytes))
}
twerr := twirp.NewError(errorCode, tj.Msg)
@@ -573,7 +770,9 @@ func twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) t
code = twirp.PermissionDenied
case 404: // Not Found
code = twirp.BadRoute
case 429, 502, 503, 504: // Too Many Requests, Bad Gateway, Service Unavailable, Gateway Timeout
case 429: // Too Many Requests
code = twirp.ResourceExhausted
case 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout
code = twirp.Unavailable
default: // All other codes
code = twirp.Unknown
@@ -606,8 +805,9 @@ type wrappedError struct {
cause error
}
func (e *wrappedError) Cause() error { return e.cause }
func (e *wrappedError) Error() string { return e.prefix + ": " + e.cause.Error() }
func (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As
func (e *wrappedError) Cause() error { return e.cause } // for github.com/pkg/errors
// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal
// error response (status 500), and error hooks are properly called with the panic wrapped as an error.
@@ -638,14 +838,16 @@ func errFromPanic(p interface{}) error {
return fmt.Errorf("panic: %v", p)
}
// internalWithCause is a Twirp Internal error wrapping an original error cause, accessible
// by github.com/pkg/errors.Cause, but the original error message is not exposed on Msg().
// internalWithCause is a Twirp Internal error wrapping an original error cause,
// but the original error message is not exposed on Msg(). The original error
// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap
type internalWithCause struct {
msg string
cause error
}
func (e *internalWithCause) Cause() error { return e.cause }
func (e *internalWithCause) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As
func (e *internalWithCause) Cause() error { return e.cause } // for github.com/pkg/errors
func (e *internalWithCause) Error() string { return e.msg + ": " + e.cause.Error() }
func (e *internalWithCause) Code() twirp.ErrorCode { return twirp.Internal }
func (e *internalWithCause) Msg() string { return e.msg }
@@ -690,29 +892,29 @@ func withoutRedirects(in *http.Client) *http.Client {
}
// doProtobufRequest makes a Protobuf request to the remote Twirp service.
func doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (err error) {
func doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {
reqBodyBytes, err := proto.Marshal(in)
if err != nil {
return wrapInternal(err, "failed to marshal proto request")
return ctx, wrapInternal(err, "failed to marshal proto request")
}
reqBody := bytes.NewBuffer(reqBodyBytes)
if err = ctx.Err(); err != nil {
return wrapInternal(err, "aborted because context was done")
return ctx, wrapInternal(err, "aborted because context was done")
}
req, err := newRequest(ctx, url, reqBody, "application/protobuf")
if err != nil {
return wrapInternal(err, "could not build request")
return ctx, wrapInternal(err, "could not build request")
}
ctx, err = callClientRequestPrepared(ctx, hooks, req)
if err != nil {
return err
return ctx, err
}
req = req.WithContext(ctx)
resp, err := client.Do(req)
if err != nil {
return wrapInternal(err, "failed to do request")
return ctx, wrapInternal(err, "failed to do request")
}
defer func() {
@@ -723,51 +925,51 @@ func doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.Clie
}()
if err = ctx.Err(); err != nil {
return wrapInternal(err, "aborted because context was done")
return ctx, wrapInternal(err, "aborted because context was done")
}
if resp.StatusCode != 200 {
return errorFromResponse(resp)
return ctx, errorFromResponse(resp)
}
respBodyBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return wrapInternal(err, "failed to read response body")
return ctx, wrapInternal(err, "failed to read response body")
}
if err = ctx.Err(); err != nil {
return wrapInternal(err, "aborted because context was done")
return ctx, wrapInternal(err, "aborted because context was done")
}
if err = proto.Unmarshal(respBodyBytes, out); err != nil {
return wrapInternal(err, "failed to unmarshal proto response")
return ctx, wrapInternal(err, "failed to unmarshal proto response")
}
return nil
return ctx, nil
}
// doJSONRequest makes a JSON request to the remote Twirp service.
func doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (err error) {
reqBody := bytes.NewBuffer(nil)
marshaler := &jsonpb.Marshaler{OrigName: true}
if err = marshaler.Marshal(reqBody, in); err != nil {
return wrapInternal(err, "failed to marshal json request")
func doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {
marshaler := &protojson.MarshalOptions{UseProtoNames: true}
reqBytes, err := marshaler.Marshal(in)
if err != nil {
return ctx, wrapInternal(err, "failed to marshal json request")
}
if err = ctx.Err(); err != nil {
return wrapInternal(err, "aborted because context was done")
return ctx, wrapInternal(err, "aborted because context was done")
}
req, err := newRequest(ctx, url, reqBody, "application/json")
req, err := newRequest(ctx, url, bytes.NewReader(reqBytes), "application/json")
if err != nil {
return wrapInternal(err, "could not build request")
return ctx, wrapInternal(err, "could not build request")
}
ctx, err = callClientRequestPrepared(ctx, hooks, req)
if err != nil {
return err
return ctx, err
}
req = req.WithContext(ctx)
resp, err := client.Do(req)
if err != nil {
return wrapInternal(err, "failed to do request")
return ctx, wrapInternal(err, "failed to do request")
}
defer func() {
@@ -778,21 +980,26 @@ func doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHo
}()
if err = ctx.Err(); err != nil {
return wrapInternal(err, "aborted because context was done")
return ctx, wrapInternal(err, "aborted because context was done")
}
if resp.StatusCode != 200 {
return errorFromResponse(resp)
return ctx, errorFromResponse(resp)
}
unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true}
if err = unmarshaler.Unmarshal(resp.Body, out); err != nil {
return wrapInternal(err, "failed to unmarshal json response")
d := json.NewDecoder(resp.Body)
rawRespBody := json.RawMessage{}
if err := d.Decode(&rawRespBody); err != nil {
return ctx, wrapInternal(err, "failed to unmarshal json response")
}
unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
if err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {
return ctx, wrapInternal(err, "failed to unmarshal json response")
}
if err = ctx.Err(); err != nil {
return wrapInternal(err, "aborted because context was done")
return ctx, wrapInternal(err, "aborted because context was done")
}
return nil
return ctx, nil
}
// Call twirp.ServerHooks.RequestReceived if the hook is available
@@ -857,33 +1064,34 @@ func callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error)
}
var twirpFileDescriptor0 = []byte{
// 443 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x4f, 0x6f, 0xd3, 0x30,
0x1c, 0x55, 0xda, 0xaa, 0x49, 0x7f, 0x41, 0x74, 0x58, 0x02, 0x65, 0x9b, 0x80, 0xaa, 0x17, 0x2a,
0x0e, 0x89, 0x16, 0x24, 0x38, 0x03, 0xda, 0x61, 0xa7, 0x4d, 0x2e, 0xe2, 0xc0, 0x25, 0x72, 0x5c,
0xd3, 0x59, 0x73, 0xe3, 0xcc, 0x76, 0x2a, 0x72, 0xe2, 0x7b, 0xf0, 0x21, 0xf8, 0x8c, 0xc8, 0x7f,
0x32, 0xd1, 0x4d, 0xbd, 0xfd, 0xfc, 0x7e, 0x2f, 0x2f, 0xef, 0x3d, 0x1b, 0x4e, 0x55, 0x4b, 0x0b,
0x4d, 0x49, 0xd3, 0x30, 0x55, 0x68, 0xa6, 0xf6, 0x9c, 0xb2, 0xbc, 0x55, 0xd2, 0x48, 0x74, 0x62,
0x14, 0xdf, 0xf7, 0x79, 0x58, 0xe6, 0xfb, 0x8b,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0x26,
0xc0, 0xcb, 0x5f, 0xf0, 0xcc, 0x97, 0xa3, 0x5b, 0xd9, 0x68, 0x86, 0x16, 0x30, 0x92, 0xda, 0x35,
0x93, 0x96, 0x27, 0x21, 0x84, 0xaf, 0x35, 0xbf, 0x5e, 0xe3, 0x91, 0xd4, 0x08, 0xc1, 0x84, 0x49,
0x2d, 0x5c, 0x41, 0x09, 0x76, 0x33, 0x2a, 0x21, 0x56, 0x4c, 0x77, 0xc2, 0xf8, 0x66, 0xd2, 0x32,
0x7b, 0x9a, 0x1f, 0x3b, 0x02, 0x1e, 0x88, 0xcb, 0xbf, 0x11, 0x4c, 0x3d, 0x76, 0xf4, 0x4a, 0x2e,
0x61, 0x6e, 0xd3, 0x33, 0x45, 0x6a, 0x2e, 0xb8, 0xe1, 0xcc, 0x27, 0x4e, 0xcb, 0xf3, 0x43, 0x67,
0xdf, 0xff, 0x23, 0xf5, 0xf8, 0xf1, 0x37, 0xd6, 0xb1, 0x2b, 0x74, 0xec, 0xc4, 0xdd, 0x8c, 0x2e,
0x20, 0x79, 0xa8, 0x66, 0xe2, 0x34, 0x5f, 0x1e, 0x6a, 0x86, 0x86, 0xf0, 0x03, 0xad, 0xbc, 0x81,
0x78, 0xed, 0xe3, 0xa0, 0x4b, 0x98, 0xd8, 0x11, 0x1d, 0xb9, 0xe6, 0xf0, 0xd4, 0xce, 0xde, 0x1c,
0x5b, 0xfb, 0xb2, 0xbf, 0xcc, 0x7e, 0xc4, 0x61, 0x55, 0x4f, 0xdd, 0x63, 0xfd, 0xf0, 0x2f, 0x00,
0x00, 0xff, 0xff, 0x3a, 0xe6, 0x57, 0xdd, 0x13, 0x03, 0x00, 0x00,
// 453 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0xcf, 0x6f, 0xd3, 0x30,
0x14, 0x56, 0xda, 0xaa, 0x4d, 0x5f, 0x10, 0x1d, 0x96, 0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