fix: Add identifiers to JSON report spec for threats

This commit is contained in:
abhisek 2023-12-29 13:10:06 +05:30
parent f4df5f845f
commit 4efa6111ed
No known key found for this signature in database
GPG Key ID: CB92A4990C02A88F
5 changed files with 260 additions and 161 deletions

View File

@ -44,20 +44,27 @@ message ReportThreat {
CWE = 1;
}
enum Subject {
enum SubjectType {
UnknownSubject = 0;
Package = 1;
Manifest = 2;
}
string id = 1;
string message = 2;
Subject subject_type = 3;
string subject = 4;
Confidence confidence = 5;
Source source = 6;
string source_id = 7;
enum ReportThreatId {
UnknownReportThreatId = 0;
LockfilePoisoning = 1;
}
ReportThreatId id = 1;
string instanceId = 2; // Unique threat instance ID per (ID, SubjectType, Subject) tuple
string message = 3;
SubjectType subject_type = 4;
string subject = 5;
Confidence confidence = 6;
Source source = 7;
string source_id = 8;
}
message PackageManifestReport {

View File

@ -172,55 +172,101 @@ func (ReportThreat_Source) EnumDescriptor() ([]byte, []int) {
return file_json_report_spec_proto_rawDescGZIP(), []int{1, 1}
}
type ReportThreat_Subject int32
type ReportThreat_SubjectType int32
const (
ReportThreat_UnknownSubject ReportThreat_Subject = 0
ReportThreat_Package ReportThreat_Subject = 1
ReportThreat_Manifest ReportThreat_Subject = 2
ReportThreat_UnknownSubject ReportThreat_SubjectType = 0
ReportThreat_Package ReportThreat_SubjectType = 1
ReportThreat_Manifest ReportThreat_SubjectType = 2
)
// Enum value maps for ReportThreat_Subject.
// Enum value maps for ReportThreat_SubjectType.
var (
ReportThreat_Subject_name = map[int32]string{
ReportThreat_SubjectType_name = map[int32]string{
0: "UnknownSubject",
1: "Package",
2: "Manifest",
}
ReportThreat_Subject_value = map[string]int32{
ReportThreat_SubjectType_value = map[string]int32{
"UnknownSubject": 0,
"Package": 1,
"Manifest": 2,
}
)
func (x ReportThreat_Subject) Enum() *ReportThreat_Subject {
p := new(ReportThreat_Subject)
func (x ReportThreat_SubjectType) Enum() *ReportThreat_SubjectType {
p := new(ReportThreat_SubjectType)
*p = x
return p
}
func (x ReportThreat_Subject) String() string {
func (x ReportThreat_SubjectType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ReportThreat_Subject) Descriptor() protoreflect.EnumDescriptor {
func (ReportThreat_SubjectType) Descriptor() protoreflect.EnumDescriptor {
return file_json_report_spec_proto_enumTypes[3].Descriptor()
}
func (ReportThreat_Subject) Type() protoreflect.EnumType {
func (ReportThreat_SubjectType) Type() protoreflect.EnumType {
return &file_json_report_spec_proto_enumTypes[3]
}
func (x ReportThreat_Subject) Number() protoreflect.EnumNumber {
func (x ReportThreat_SubjectType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use ReportThreat_Subject.Descriptor instead.
func (ReportThreat_Subject) EnumDescriptor() ([]byte, []int) {
// Deprecated: Use ReportThreat_SubjectType.Descriptor instead.
func (ReportThreat_SubjectType) EnumDescriptor() ([]byte, []int) {
return file_json_report_spec_proto_rawDescGZIP(), []int{1, 2}
}
type ReportThreat_ReportThreatId int32
const (
ReportThreat_UnknownReportThreatId ReportThreat_ReportThreatId = 0
ReportThreat_LockfilePoisoning ReportThreat_ReportThreatId = 1
)
// Enum value maps for ReportThreat_ReportThreatId.
var (
ReportThreat_ReportThreatId_name = map[int32]string{
0: "UnknownReportThreatId",
1: "LockfilePoisoning",
}
ReportThreat_ReportThreatId_value = map[string]int32{
"UnknownReportThreatId": 0,
"LockfilePoisoning": 1,
}
)
func (x ReportThreat_ReportThreatId) Enum() *ReportThreat_ReportThreatId {
p := new(ReportThreat_ReportThreatId)
*p = x
return p
}
func (x ReportThreat_ReportThreatId) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ReportThreat_ReportThreatId) Descriptor() protoreflect.EnumDescriptor {
return file_json_report_spec_proto_enumTypes[4].Descriptor()
}
func (ReportThreat_ReportThreatId) Type() protoreflect.EnumType {
return &file_json_report_spec_proto_enumTypes[4]
}
func (x ReportThreat_ReportThreatId) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use ReportThreat_ReportThreatId.Descriptor instead.
func (ReportThreat_ReportThreatId) EnumDescriptor() ([]byte, []int) {
return file_json_report_spec_proto_rawDescGZIP(), []int{1, 3}
}
type RemediationAdvice struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -320,13 +366,14 @@ type ReportThreat struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
SubjectType ReportThreat_Subject `protobuf:"varint,3,opt,name=subject_type,json=subjectType,proto3,enum=ReportThreat_Subject" json:"subject_type,omitempty"`
Subject string `protobuf:"bytes,4,opt,name=subject,proto3" json:"subject,omitempty"`
Confidence ReportThreat_Confidence `protobuf:"varint,5,opt,name=confidence,proto3,enum=ReportThreat_Confidence" json:"confidence,omitempty"`
Source ReportThreat_Source `protobuf:"varint,6,opt,name=source,proto3,enum=ReportThreat_Source" json:"source,omitempty"`
SourceId string `protobuf:"bytes,7,opt,name=source_id,json=sourceId,proto3" json:"source_id,omitempty"`
Id ReportThreat_ReportThreatId `protobuf:"varint,1,opt,name=id,proto3,enum=ReportThreat_ReportThreatId" json:"id,omitempty"`
InstanceId string `protobuf:"bytes,2,opt,name=instanceId,proto3" json:"instanceId,omitempty"` // Unique threat instance ID per (ID, SubjectType, Subject) tuple
Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
SubjectType ReportThreat_SubjectType `protobuf:"varint,4,opt,name=subject_type,json=subjectType,proto3,enum=ReportThreat_SubjectType" json:"subject_type,omitempty"`
Subject string `protobuf:"bytes,5,opt,name=subject,proto3" json:"subject,omitempty"`
Confidence ReportThreat_Confidence `protobuf:"varint,6,opt,name=confidence,proto3,enum=ReportThreat_Confidence" json:"confidence,omitempty"`
Source ReportThreat_Source `protobuf:"varint,7,opt,name=source,proto3,enum=ReportThreat_Source" json:"source,omitempty"`
SourceId string `protobuf:"bytes,8,opt,name=source_id,json=sourceId,proto3" json:"source_id,omitempty"`
}
func (x *ReportThreat) Reset() {
@ -361,10 +408,17 @@ func (*ReportThreat) Descriptor() ([]byte, []int) {
return file_json_report_spec_proto_rawDescGZIP(), []int{1}
}
func (x *ReportThreat) GetId() string {
func (x *ReportThreat) GetId() ReportThreat_ReportThreatId {
if x != nil {
return x.Id
}
return ReportThreat_UnknownReportThreatId
}
func (x *ReportThreat) GetInstanceId() string {
if x != nil {
return x.InstanceId
}
return ""
}
@ -375,7 +429,7 @@ func (x *ReportThreat) GetMessage() string {
return ""
}
func (x *ReportThreat) GetSubjectType() ReportThreat_Subject {
func (x *ReportThreat) GetSubjectType() ReportThreat_SubjectType {
if x != nil {
return x.SubjectType
}
@ -736,91 +790,99 @@ var file_json_report_spec_proto_rawDesc = []byte{
0x74, 0x65, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69,
0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1d, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,
0x41, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65,
0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xb5, 0x03, 0x0a, 0x0c, 0x52, 0x65, 0x70, 0x6f,
0x72, 0x74, 0x54, 0x68, 0x72, 0x65, 0x61, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x12, 0x38, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79,
0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72,
0x74, 0x54, 0x68, 0x72, 0x65, 0x61, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52,
0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07,
0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73,
0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x38, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64,
0x65, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x52, 0x65, 0x70,
0x6f, 0x72, 0x74, 0x54, 0x68, 0x72, 0x65, 0x61, 0x74, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x64,
0x65, 0x6e, 0x63, 0x65, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65,
0x12, 0x2c, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e,
0x32, 0x14, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x68, 0x72, 0x65, 0x61, 0x74, 0x2e,
0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1b,
0x0a, 0x09, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x22, 0x42, 0x0a, 0x0a, 0x43,
0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x55, 0x6e, 0x6b,
0x6e, 0x6f, 0x77, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x10, 0x00,
0x12, 0x08, 0x0a, 0x04, 0x48, 0x69, 0x67, 0x68, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x65,
0x64, 0x69, 0x75, 0x6d, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x4c, 0x6f, 0x77, 0x10, 0x03, 0x22,
0x24, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x55, 0x6e, 0x6b,
0x6e, 0x6f, 0x77, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03,
0x43, 0x57, 0x45, 0x10, 0x01, 0x22, 0x38, 0x0a, 0x07, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74,
0x12, 0x12, 0x0a, 0x0e, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x53, 0x75, 0x62, 0x6a, 0x65,
0x63, 0x74, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x10,
0x01, 0x12, 0x0c, 0x0a, 0x08, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x10, 0x02, 0x22,
0x8e, 0x01, 0x0a, 0x15, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x4d, 0x61, 0x6e, 0x69, 0x66,
0x65, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x09, 0x65, 0x63, 0x6f,
0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45,
0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x09, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73,
0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x27, 0x0a, 0x07, 0x74, 0x68, 0x72, 0x65, 0x61,
0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72,
0x74, 0x54, 0x68, 0x72, 0x65, 0x61, 0x74, 0x52, 0x07, 0x74, 0x68, 0x72, 0x65, 0x61, 0x74, 0x73,
0x22, 0xc6, 0x02, 0x0a, 0x0d, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f,
0x72, 0x74, 0x12, 0x22, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x07, 0x70,
0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65,
0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x61, 0x6e, 0x69, 0x66,
0x65, 0x73, 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x56, 0x69, 0x6f, 0x6c, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x12, 0x2c, 0x0a, 0x07, 0x61, 0x64, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x12, 0x2e, 0x52, 0x65, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41,
0x64, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x61, 0x64, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x3f,
0x0a, 0x0f, 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65,
0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x49, 0x6e, 0x73, 0x69, 0x67, 0x68,
0x74, 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,
0x2f, 0x0a, 0x08, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x13, 0x2e, 0x49, 0x6e, 0x73, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x69, 0x63, 0x65, 0x6e,
0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x73,
0x12, 0x27, 0x0a, 0x07, 0x74, 0x68, 0x72, 0x65, 0x61, 0x74, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x0d, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x68, 0x72, 0x65, 0x61, 0x74,
0x52, 0x07, 0x74, 0x68, 0x72, 0x65, 0x61, 0x74, 0x73, 0x22, 0x6b, 0x0a, 0x0a, 0x52, 0x65, 0x70,
0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x6f, 0x6c, 0x5f,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x6f, 0x6c,
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x65, 0x72,
0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x74, 0x6f, 0x6f, 0x6c,
0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74,
0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65,
0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x8b, 0x01, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6f, 0x72,
0x74, 0x12, 0x1f, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x0b, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x04, 0x6d, 0x65,
0x74, 0x61, 0x12, 0x34, 0x0a, 0x09, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x18,
0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x4d,
0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x09, 0x6d,
0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x70, 0x61, 0x63, 0x6b,
0x61, 0x67, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x50, 0x61, 0x63,
0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x08, 0x70, 0x61, 0x63, 0x6b,
0x61, 0x67, 0x65, 0x73, 0x2a, 0x7b, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x15, 0x0a,
0x11, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79,
0x70, 0x65, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x50,
0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x41, 0x6c, 0x74, 0x65,
0x72, 0x6e, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x70, 0x75, 0x6c, 0x61, 0x72, 0x50, 0x61, 0x63, 0x6b,
0x61, 0x67, 0x65, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61,
0x74, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x10,
0x03, 0x42, 0x2b, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x73, 0x61, 0x66, 0x65, 0x64, 0x65, 0x70, 0x2f, 0x76, 0x65, 0x74, 0x2f, 0x67, 0x65, 0x6e, 0x2f,
0x6a, 0x73, 0x6f, 0x6e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x70, 0x65, 0x63, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xbf, 0x04, 0x0a, 0x0c, 0x52, 0x65, 0x70, 0x6f,
0x72, 0x74, 0x54, 0x68, 0x72, 0x65, 0x61, 0x74, 0x12, 0x2c, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x68, 0x72,
0x65, 0x61, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x68, 0x72, 0x65, 0x61, 0x74,
0x49, 0x64, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e,
0x63, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74,
0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x12, 0x3c, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65,
0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x54,
0x68, 0x72, 0x65, 0x61, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70,
0x65, 0x52, 0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18,
0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x38, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66,
0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x52,
0x65, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x68, 0x72, 0x65, 0x61, 0x74, 0x2e, 0x43, 0x6f, 0x6e, 0x66,
0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e,
0x63, 0x65, 0x12, 0x2c, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01,
0x28, 0x0e, 0x32, 0x14, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x68, 0x72, 0x65, 0x61,
0x74, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x12, 0x1b, 0x0a, 0x09, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x22, 0x42, 0x0a,
0x0a, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x55,
0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65,
0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x69, 0x67, 0x68, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06,
0x4d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x4c, 0x6f, 0x77, 0x10,
0x03, 0x22, 0x24, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x55,
0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x10, 0x00, 0x12, 0x07,
0x0a, 0x03, 0x43, 0x57, 0x45, 0x10, 0x01, 0x22, 0x3c, 0x0a, 0x0b, 0x53, 0x75, 0x62, 0x6a, 0x65,
0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77,
0x6e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x61,
0x63, 0x6b, 0x61, 0x67, 0x65, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x4d, 0x61, 0x6e, 0x69, 0x66,
0x65, 0x73, 0x74, 0x10, 0x02, 0x22, 0x42, 0x0a, 0x0e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x54,
0x68, 0x72, 0x65, 0x61, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x6e, 0x6b, 0x6e, 0x6f,
0x77, 0x6e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x68, 0x72, 0x65, 0x61, 0x74, 0x49, 0x64,
0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x4c, 0x6f, 0x63, 0x6b, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x6f,
0x69, 0x73, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x10, 0x01, 0x22, 0x8e, 0x01, 0x0a, 0x15, 0x50, 0x61,
0x63, 0x6b, 0x61, 0x67, 0x65, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x70,
0x6f, 0x72, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x09, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74,
0x65, 0x6d, 0x52, 0x09, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a,
0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74,
0x68, 0x12, 0x27, 0x0a, 0x07, 0x74, 0x68, 0x72, 0x65, 0x61, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x68, 0x72, 0x65, 0x61,
0x74, 0x52, 0x07, 0x74, 0x68, 0x72, 0x65, 0x61, 0x74, 0x73, 0x22, 0xc6, 0x02, 0x0a, 0x0d, 0x50,
0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x22, 0x0a, 0x07,
0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e,
0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65,
0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x18, 0x02, 0x20,
0x03, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x12, 0x2a,
0x0a, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a,
0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x07, 0x61, 0x64,
0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x52, 0x65,
0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x52,
0x07, 0x61, 0x64, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x0f, 0x76, 0x75, 0x6c, 0x6e,
0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x15, 0x2e, 0x49, 0x6e, 0x73, 0x69, 0x67, 0x68, 0x74, 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, 0x2f, 0x0a, 0x08, 0x6c, 0x69, 0x63,
0x65, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x49, 0x6e,
0x73, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x08, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x07, 0x74, 0x68,
0x72, 0x65, 0x61, 0x74, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x52, 0x65,
0x70, 0x6f, 0x72, 0x74, 0x54, 0x68, 0x72, 0x65, 0x61, 0x74, 0x52, 0x07, 0x74, 0x68, 0x72, 0x65,
0x61, 0x74, 0x73, 0x22, 0x6b, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74,
0x61, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x6f, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x6f, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21,
0x0a, 0x0c, 0x74, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x74, 0x6f, 0x6f, 0x6c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f,
0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74,
0x22, 0x8b, 0x01, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1f, 0x0a, 0x04, 0x6d,
0x65, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x52, 0x65, 0x70, 0x6f,
0x72, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x12, 0x34, 0x0a, 0x09,
0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x16, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73,
0x74, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x09, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73,
0x74, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x18, 0x03,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65,
0x70, 0x6f, 0x72, 0x74, 0x52, 0x08, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x2a, 0x7b,
0x0a, 0x15, 0x52, 0x65, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x76,
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x55, 0x6e, 0x6b, 0x6e, 0x6f,
0x77, 0x6e, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x10, 0x00, 0x12, 0x12,
0x0a, 0x0e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65,
0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x65, 0x50,
0x6f, 0x70, 0x75, 0x6c, 0x61, 0x72, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x10, 0x02, 0x12,
0x1a, 0x0a, 0x16, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x65, 0x53, 0x65, 0x63, 0x75,
0x72, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x10, 0x03, 0x42, 0x2b, 0x5a, 0x29, 0x67,
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x61, 0x66, 0x65, 0x64, 0x65,
0x70, 0x2f, 0x76, 0x65, 0x74, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x72, 0x65,
0x70, 0x6f, 0x72, 0x74, 0x73, 0x70, 0x65, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -835,47 +897,49 @@ func file_json_report_spec_proto_rawDescGZIP() []byte {
return file_json_report_spec_proto_rawDescData
}
var file_json_report_spec_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
var file_json_report_spec_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
var file_json_report_spec_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_json_report_spec_proto_goTypes = []interface{}{
(RemediationAdviceType)(0), // 0: RemediationAdviceType
(ReportThreat_Confidence)(0), // 1: ReportThreat.Confidence
(ReportThreat_Source)(0), // 2: ReportThreat.Source
(ReportThreat_Subject)(0), // 3: ReportThreat.Subject
(*RemediationAdvice)(nil), // 4: RemediationAdvice
(*ReportThreat)(nil), // 5: ReportThreat
(*PackageManifestReport)(nil), // 6: PackageManifestReport
(*PackageReport)(nil), // 7: PackageReport
(*ReportMeta)(nil), // 8: ReportMeta
(*Report)(nil), // 9: Report
(*models.Package)(nil), // 10: Package
(models.Ecosystem)(0), // 11: Ecosystem
(*violations.Violation)(nil), // 12: Violation
(*models.InsightVulnerability)(nil), // 13: InsightVulnerability
(*models.InsightLicenseInfo)(nil), // 14: InsightLicenseInfo
(ReportThreat_SubjectType)(0), // 3: ReportThreat.SubjectType
(ReportThreat_ReportThreatId)(0), // 4: ReportThreat.ReportThreatId
(*RemediationAdvice)(nil), // 5: RemediationAdvice
(*ReportThreat)(nil), // 6: ReportThreat
(*PackageManifestReport)(nil), // 7: PackageManifestReport
(*PackageReport)(nil), // 8: PackageReport
(*ReportMeta)(nil), // 9: ReportMeta
(*Report)(nil), // 10: Report
(*models.Package)(nil), // 11: Package
(models.Ecosystem)(0), // 12: Ecosystem
(*violations.Violation)(nil), // 13: Violation
(*models.InsightVulnerability)(nil), // 14: InsightVulnerability
(*models.InsightLicenseInfo)(nil), // 15: InsightLicenseInfo
}
var file_json_report_spec_proto_depIdxs = []int32{
0, // 0: RemediationAdvice.type:type_name -> RemediationAdviceType
10, // 1: RemediationAdvice.package:type_name -> Package
3, // 2: ReportThreat.subject_type:type_name -> ReportThreat.Subject
1, // 3: ReportThreat.confidence:type_name -> ReportThreat.Confidence
2, // 4: ReportThreat.source:type_name -> ReportThreat.Source
11, // 5: PackageManifestReport.ecosystem:type_name -> Ecosystem
5, // 6: PackageManifestReport.threats:type_name -> ReportThreat
10, // 7: PackageReport.package:type_name -> Package
12, // 8: PackageReport.violations:type_name -> Violation
4, // 9: PackageReport.advices:type_name -> RemediationAdvice
13, // 10: PackageReport.vulnerabilities:type_name -> InsightVulnerability
14, // 11: PackageReport.licenses:type_name -> InsightLicenseInfo
5, // 12: PackageReport.threats:type_name -> ReportThreat
8, // 13: Report.meta:type_name -> ReportMeta
6, // 14: Report.manifests:type_name -> PackageManifestReport
7, // 15: Report.packages:type_name -> PackageReport
16, // [16:16] is the sub-list for method output_type
16, // [16:16] is the sub-list for method input_type
16, // [16:16] is the sub-list for extension type_name
16, // [16:16] is the sub-list for extension extendee
0, // [0:16] is the sub-list for field type_name
11, // 1: RemediationAdvice.package:type_name -> Package
4, // 2: ReportThreat.id:type_name -> ReportThreat.ReportThreatId
3, // 3: ReportThreat.subject_type:type_name -> ReportThreat.SubjectType
1, // 4: ReportThreat.confidence:type_name -> ReportThreat.Confidence
2, // 5: ReportThreat.source:type_name -> ReportThreat.Source
12, // 6: PackageManifestReport.ecosystem:type_name -> Ecosystem
6, // 7: PackageManifestReport.threats:type_name -> ReportThreat
11, // 8: PackageReport.package:type_name -> Package
13, // 9: PackageReport.violations:type_name -> Violation
5, // 10: PackageReport.advices:type_name -> RemediationAdvice
14, // 11: PackageReport.vulnerabilities:type_name -> InsightVulnerability
15, // 12: PackageReport.licenses:type_name -> InsightLicenseInfo
6, // 13: PackageReport.threats:type_name -> ReportThreat
9, // 14: Report.meta:type_name -> ReportMeta
7, // 15: Report.manifests:type_name -> PackageManifestReport
8, // 16: Report.packages:type_name -> PackageReport
17, // [17:17] is the sub-list for method output_type
17, // [17:17] is the sub-list for method input_type
17, // [17:17] is the sub-list for extension type_name
17, // [17:17] is the sub-list for extension extendee
0, // [0:17] is the sub-list for field type_name
}
func init() { file_json_report_spec_proto_init() }
@ -962,7 +1026,7 @@ func file_json_report_spec_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_json_report_spec_proto_rawDesc,
NumEnums: 4,
NumEnums: 5,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,

View File

@ -1,5 +1,12 @@
package analyzer
import (
"fmt"
jsonreportspec "github.com/safedep/vet/gen/jsonreport"
"github.com/safedep/vet/pkg/models"
)
func (ev *AnalyzerEvent) IsFailOnError() bool {
return ev.Type == ET_AnalyzerFailOnError
}
@ -11,3 +18,9 @@ func (ev *AnalyzerEvent) IsFilterMatch() bool {
func (ev *AnalyzerEvent) IsLockfilePoisoningSignal() bool {
return ev.Type == ET_LockfilePoisoningSignal
}
func ThreatInstanceId(id jsonreportspec.ReportThreat_ReportThreatId,
st jsonreportspec.ReportThreat_SubjectType,
s string) string {
return models.IdGen(fmt.Sprintf("%s-%s-%s", id.String(), st.String(), s))
}

View File

@ -122,6 +122,10 @@ func (npm *npmLockfilePoisoningAnalyzer) Analyze(manifest *models.PackageManifes
Manifest: manifest,
Package: pkg,
Threat: &jsonreportspec.ReportThreat{
Id: jsonreportspec.ReportThreat_LockfilePoisoning,
InstanceId: ThreatInstanceId(jsonreportspec.ReportThreat_LockfilePoisoning,
jsonreportspec.ReportThreat_Manifest,
manifest.GetDisplayPath()),
Message: message,
SubjectType: jsonreportspec.ReportThreat_Manifest,
Subject: manifest.GetDisplayPath(),
@ -146,6 +150,10 @@ func (npm *npmLockfilePoisoningAnalyzer) Analyze(manifest *models.PackageManifes
Manifest: manifest,
Package: pkg,
Threat: &jsonreportspec.ReportThreat{
Id: jsonreportspec.ReportThreat_LockfilePoisoning,
InstanceId: ThreatInstanceId(jsonreportspec.ReportThreat_LockfilePoisoning,
jsonreportspec.ReportThreat_Manifest,
manifest.GetDisplayPath()),
Message: message,
SubjectType: jsonreportspec.ReportThreat_Manifest,
Subject: manifest.GetDisplayPath(),

View File

@ -75,11 +75,8 @@ func (pm *PackageManifest) GetDisplayPath() string {
}
func (pm *PackageManifest) Id() string {
h := fnv.New64a()
h.Write([]byte(fmt.Sprintf("%s/%s",
pm.Ecosystem, pm.Path)))
return strconv.FormatUint(h.Sum64(), 16)
return hashedId(fmt.Sprintf("%s/%s",
pm.Ecosystem, pm.Path))
}
func (pm *PackageManifest) GetPackagesCount() int {
@ -136,13 +133,10 @@ type Package struct {
}
func (p *Package) Id() string {
h := fnv.New64a()
h.Write([]byte(fmt.Sprintf("%s/%s/%s",
return hashedId(fmt.Sprintf("%s/%s/%s",
strings.ToLower(string(p.PackageDetails.Ecosystem)),
strings.ToLower(p.PackageDetails.Name),
strings.ToLower(p.PackageDetails.Version))))
return strconv.FormatUint(h.Sum64(), 16)
strings.ToLower(p.PackageDetails.Version)))
}
// FIXME: For SPDX/CycloneDX, package ecosystem may be different
@ -173,3 +167,16 @@ func NewPackageDetail(e, n, v string) lockfile.PackageDetails {
Version: v,
}
}
// This is probably not the best place for IdGen but keeping it here
// since this package is the most stable (SDP)
func IdGen(data string) string {
return hashedId(data)
}
func hashedId(str string) string {
h := fnv.New64a()
h.Write([]byte(str))
return strconv.FormatUint(h.Sum64(), 16)
}