diff --git a/manifest/types.go b/manifest/types.go index cbaeb1c6..bbd85ba3 100644 --- a/manifest/types.go +++ b/manifest/types.go @@ -19,6 +19,7 @@ type AgentManifest struct { Documentation *string `json:"documentation"` ChainIDs []int64 `json:"chainIds"` ChainSettings map[string]AgentChainSettings `json:"chainSettings"` + External bool `json:"external"` } // AgentChainSettings is the per-chain configuration of a bot. @@ -49,11 +50,14 @@ func (sm *SignedAgentManifest) Validate() error { if sm.Manifest == nil { return validationErr("manifest is not present") } - if sm.Manifest.ImageReference == nil { - return validationErr("manifest.imageReference is not present") - } - if _, ok := utils.ValidateImageRef("", *sm.Manifest.ImageReference); !ok { - return validationErr("manifest.imageReference is not valid") + // validate images of non-external bots + if !sm.Manifest.External { + if sm.Manifest.ImageReference == nil { + return validationErr("manifest.imageReference is not present") + } + if _, ok := utils.ValidateImageRef("", *sm.Manifest.ImageReference); !ok { + return validationErr("manifest.imageReference is not valid") + } } return nil } diff --git a/protocol/alert.pb.go b/protocol/alert.pb.go index f1b7c0dc..65789445 100644 --- a/protocol/alert.pb.go +++ b/protocol/alert.pb.go @@ -1040,6 +1040,7 @@ type Finding struct { RelatedAlerts []string `protobuf:"bytes,13,rep,name=relatedAlerts,proto3" json:"relatedAlerts,omitempty"` UniqueKey string `protobuf:"bytes,14,opt,name=uniqueKey,proto3" json:"uniqueKey,omitempty"` Source *Source `protobuf:"bytes,15,opt,name=source,proto3" json:"source,omitempty"` + Timestamp string `protobuf:"bytes,16,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } func (x *Finding) Reset() { @@ -1172,6 +1173,84 @@ func (x *Finding) GetSource() *Source { return nil } +func (x *Finding) GetTimestamp() string { + if x != nil { + return x.Timestamp + } + return "" +} + +type APIAlert struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Type AlertType `protobuf:"varint,2,opt,name=type,proto3,enum=network.forta.AlertType" json:"type,omitempty"` + Finding *Finding `protobuf:"bytes,3,opt,name=finding,proto3" json:"finding,omitempty"` + Agent *APIAlert_APIAlertAgent `protobuf:"bytes,4,opt,name=agent,proto3" json:"agent,omitempty"` +} + +func (x *APIAlert) Reset() { + *x = APIAlert{} + if protoimpl.UnsafeEnabled { + mi := &file_alert_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *APIAlert) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*APIAlert) ProtoMessage() {} + +func (x *APIAlert) ProtoReflect() protoreflect.Message { + mi := &file_alert_proto_msgTypes[11] + 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 APIAlert.ProtoReflect.Descriptor instead. +func (*APIAlert) Descriptor() ([]byte, []int) { + return file_alert_proto_rawDescGZIP(), []int{11} +} + +func (x *APIAlert) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *APIAlert) GetType() AlertType { + if x != nil { + return x.Type + } + return AlertType_UNKNOWN_ALERT_TYPE +} + +func (x *APIAlert) GetFinding() *Finding { + if x != nil { + return x.Finding + } + return nil +} + +func (x *APIAlert) GetAgent() *APIAlert_APIAlertAgent { + if x != nil { + return x.Agent + } + return nil +} + type Source_TransactionSource struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1184,7 +1263,7 @@ type Source_TransactionSource struct { func (x *Source_TransactionSource) Reset() { *x = Source_TransactionSource{} if protoimpl.UnsafeEnabled { - mi := &file_alert_proto_msgTypes[13] + mi := &file_alert_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1197,7 +1276,7 @@ func (x *Source_TransactionSource) String() string { func (*Source_TransactionSource) ProtoMessage() {} func (x *Source_TransactionSource) ProtoReflect() protoreflect.Message { - mi := &file_alert_proto_msgTypes[13] + mi := &file_alert_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1240,7 +1319,7 @@ type Source_BlockSource struct { func (x *Source_BlockSource) Reset() { *x = Source_BlockSource{} if protoimpl.UnsafeEnabled { - mi := &file_alert_proto_msgTypes[14] + mi := &file_alert_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1253,7 +1332,7 @@ func (x *Source_BlockSource) String() string { func (*Source_BlockSource) ProtoMessage() {} func (x *Source_BlockSource) ProtoReflect() protoreflect.Message { - mi := &file_alert_proto_msgTypes[14] + mi := &file_alert_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1301,7 +1380,7 @@ type Source_URLSource struct { func (x *Source_URLSource) Reset() { *x = Source_URLSource{} if protoimpl.UnsafeEnabled { - mi := &file_alert_proto_msgTypes[15] + mi := &file_alert_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1314,7 +1393,7 @@ func (x *Source_URLSource) String() string { func (*Source_URLSource) ProtoMessage() {} func (x *Source_URLSource) ProtoReflect() protoreflect.Message { - mi := &file_alert_proto_msgTypes[15] + mi := &file_alert_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1348,7 +1427,7 @@ type Source_ChainSource struct { func (x *Source_ChainSource) Reset() { *x = Source_ChainSource{} if protoimpl.UnsafeEnabled { - mi := &file_alert_proto_msgTypes[16] + mi := &file_alert_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1361,7 +1440,7 @@ func (x *Source_ChainSource) String() string { func (*Source_ChainSource) ProtoMessage() {} func (x *Source_ChainSource) ProtoReflect() protoreflect.Message { - mi := &file_alert_proto_msgTypes[16] + mi := &file_alert_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1395,7 +1474,7 @@ type Source_AlertSource struct { func (x *Source_AlertSource) Reset() { *x = Source_AlertSource{} if protoimpl.UnsafeEnabled { - mi := &file_alert_proto_msgTypes[17] + mi := &file_alert_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1408,7 +1487,7 @@ func (x *Source_AlertSource) String() string { func (*Source_AlertSource) ProtoMessage() {} func (x *Source_AlertSource) ProtoReflect() protoreflect.Message { - mi := &file_alert_proto_msgTypes[17] + mi := &file_alert_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1443,7 +1522,7 @@ type Source_CustomSource struct { func (x *Source_CustomSource) Reset() { *x = Source_CustomSource{} if protoimpl.UnsafeEnabled { - mi := &file_alert_proto_msgTypes[18] + mi := &file_alert_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1456,7 +1535,7 @@ func (x *Source_CustomSource) String() string { func (*Source_CustomSource) ProtoMessage() {} func (x *Source_CustomSource) ProtoReflect() protoreflect.Message { - mi := &file_alert_proto_msgTypes[18] + mi := &file_alert_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1486,6 +1565,53 @@ func (x *Source_CustomSource) GetValue() string { return "" } +type APIAlert_APIAlertAgent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *APIAlert_APIAlertAgent) Reset() { + *x = APIAlert_APIAlertAgent{} + if protoimpl.UnsafeEnabled { + mi := &file_alert_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *APIAlert_APIAlertAgent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*APIAlert_APIAlertAgent) ProtoMessage() {} + +func (x *APIAlert_APIAlertAgent) ProtoReflect() protoreflect.Message { + mi := &file_alert_proto_msgTypes[22] + 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 APIAlert_APIAlertAgent.ProtoReflect.Descriptor instead. +func (*APIAlert_APIAlertAgent) Descriptor() ([]byte, []int) { + return file_alert_proto_rawDescGZIP(), []int{11, 0} +} + +func (x *APIAlert_APIAlertAgent) GetId() string { + if x != nil { + return x.Id + } + return "" +} + var File_alert_proto protoreflect.FileDescriptor var file_alert_proto_rawDesc = []byte{ @@ -1649,7 +1775,7 @@ var file_alert_proto_rawDesc = []byte{ 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x86, 0x07, 0x0a, 0x07, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x70, + 0xa4, 0x07, 0x0a, 0x07, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x74, 0x77, @@ -1685,34 +1811,50 @@ var file_alert_proto_rawDesc = []byte{ 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x66, 0x6f, 0x72, 0x74, 0x61, - 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x1a, - 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3d, 0x0a, 0x0f, - 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x4e, 0x0a, 0x08, 0x53, - 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, - 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x01, 0x12, 0x07, - 0x0a, 0x03, 0x4c, 0x4f, 0x57, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x45, 0x44, 0x49, 0x55, - 0x4d, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x49, 0x47, 0x48, 0x10, 0x04, 0x12, 0x0c, 0x0a, - 0x08, 0x43, 0x52, 0x49, 0x54, 0x49, 0x43, 0x41, 0x4c, 0x10, 0x05, 0x22, 0x65, 0x0a, 0x0b, 0x46, - 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, - 0x45, 0x58, 0x50, 0x4c, 0x4f, 0x49, 0x54, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x55, 0x53, - 0x50, 0x49, 0x43, 0x49, 0x4f, 0x55, 0x53, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x45, 0x47, - 0x52, 0x41, 0x44, 0x45, 0x44, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x4e, 0x46, 0x4f, 0x52, - 0x4d, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x43, 0x41, 0x4d, - 0x10, 0x05, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x2a, 0x5d, 0x0a, 0x09, 0x41, 0x6c, 0x65, 0x72, - 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, - 0x5f, 0x41, 0x4c, 0x45, 0x52, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x00, 0x12, 0x0f, 0x0a, - 0x0b, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x09, - 0x0a, 0x05, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x52, 0x49, - 0x56, 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x4f, 0x4d, 0x42, 0x49, 0x4e, - 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x3b, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x10, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x1a, 0x3b, 0x0a, + 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3d, 0x0a, 0x0f, 0x49, 0x6e, + 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x4e, 0x0a, 0x08, 0x53, 0x65, 0x76, + 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, + 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, + 0x4c, 0x4f, 0x57, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x45, 0x44, 0x49, 0x55, 0x4d, 0x10, + 0x03, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x49, 0x47, 0x48, 0x10, 0x04, 0x12, 0x0c, 0x0a, 0x08, 0x43, + 0x52, 0x49, 0x54, 0x49, 0x43, 0x41, 0x4c, 0x10, 0x05, 0x22, 0x65, 0x0a, 0x0b, 0x46, 0x69, 0x6e, + 0x64, 0x69, 0x6e, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x55, 0x4e, 0x4b, 0x4e, + 0x4f, 0x57, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x58, + 0x50, 0x4c, 0x4f, 0x49, 0x54, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x55, 0x53, 0x50, 0x49, + 0x43, 0x49, 0x4f, 0x55, 0x53, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x45, 0x47, 0x52, 0x41, + 0x44, 0x45, 0x44, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x4e, 0x46, 0x4f, 0x52, 0x4d, 0x41, + 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x43, 0x41, 0x4d, 0x10, 0x05, + 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x22, 0xd8, 0x01, 0x0a, 0x08, 0x41, 0x50, 0x49, 0x41, 0x6c, + 0x65, 0x72, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x66, 0x6f, 0x72, 0x74, + 0x61, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x30, 0x0a, 0x07, 0x66, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x66, 0x6f, 0x72, + 0x74, 0x61, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x66, 0x69, 0x6e, 0x64, + 0x69, 0x6e, 0x67, 0x12, 0x3b, 0x0a, 0x05, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x66, 0x6f, 0x72, + 0x74, 0x61, 0x2e, 0x41, 0x50, 0x49, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x2e, 0x41, 0x50, 0x49, 0x41, + 0x6c, 0x65, 0x72, 0x74, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x61, 0x67, 0x65, 0x6e, 0x74, + 0x1a, 0x1f, 0x0a, 0x0d, 0x41, 0x50, 0x49, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x41, 0x67, 0x65, 0x6e, + 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x2a, 0x5d, 0x0a, 0x09, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, + 0x0a, 0x12, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x41, 0x4c, 0x45, 0x52, 0x54, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x41, + 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x4c, 0x4f, 0x43, 0x4b, + 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, + 0x0f, 0x0a, 0x0b, 0x43, 0x4f, 0x4d, 0x42, 0x49, 0x4e, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x04, + 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1728,7 +1870,7 @@ func file_alert_proto_rawDescGZIP() []byte { } var file_alert_proto_enumTypes = make([]protoimpl.EnumInfo, 4) -var file_alert_proto_msgTypes = make([]protoimpl.MessageInfo, 21) +var file_alert_proto_msgTypes = make([]protoimpl.MessageInfo, 23) var file_alert_proto_goTypes = []interface{}{ (AlertType)(0), // 0: network.forta.AlertType (Label_EntityType)(0), // 1: network.forta.Label.EntityType @@ -1745,47 +1887,52 @@ var file_alert_proto_goTypes = []interface{}{ (*Label)(nil), // 12: network.forta.Label (*Source)(nil), // 13: network.forta.Source (*Finding)(nil), // 14: network.forta.Finding - nil, // 15: network.forta.Alert.MetadataEntry - nil, // 16: network.forta.Alert.TagsEntry - (*Source_TransactionSource)(nil), // 17: network.forta.Source.TransactionSource - (*Source_BlockSource)(nil), // 18: network.forta.Source.BlockSource - (*Source_URLSource)(nil), // 19: network.forta.Source.URLSource - (*Source_ChainSource)(nil), // 20: network.forta.Source.ChainSource - (*Source_AlertSource)(nil), // 21: network.forta.Source.AlertSource - (*Source_CustomSource)(nil), // 22: network.forta.Source.CustomSource - nil, // 23: network.forta.Finding.MetadataEntry - nil, // 24: network.forta.Finding.IndicatorsEntry + (*APIAlert)(nil), // 15: network.forta.APIAlert + nil, // 16: network.forta.Alert.MetadataEntry + nil, // 17: network.forta.Alert.TagsEntry + (*Source_TransactionSource)(nil), // 18: network.forta.Source.TransactionSource + (*Source_BlockSource)(nil), // 19: network.forta.Source.BlockSource + (*Source_URLSource)(nil), // 20: network.forta.Source.URLSource + (*Source_ChainSource)(nil), // 21: network.forta.Source.ChainSource + (*Source_AlertSource)(nil), // 22: network.forta.Source.AlertSource + (*Source_CustomSource)(nil), // 23: network.forta.Source.CustomSource + nil, // 24: network.forta.Finding.MetadataEntry + nil, // 25: network.forta.Finding.IndicatorsEntry + (*APIAlert_APIAlertAgent)(nil), // 26: network.forta.APIAlert.APIAlertAgent } var file_alert_proto_depIdxs = []int32{ 11, // 0: network.forta.AlertResponse.alerts:type_name -> network.forta.SignedAlert 0, // 1: network.forta.Alert.type:type_name -> network.forta.AlertType 14, // 2: network.forta.Alert.finding:type_name -> network.forta.Finding - 15, // 3: network.forta.Alert.metadata:type_name -> network.forta.Alert.MetadataEntry + 16, // 3: network.forta.Alert.metadata:type_name -> network.forta.Alert.MetadataEntry 5, // 4: network.forta.Alert.agent:type_name -> network.forta.AgentInfo - 16, // 5: network.forta.Alert.tags:type_name -> network.forta.Alert.TagsEntry + 17, // 5: network.forta.Alert.tags:type_name -> network.forta.Alert.TagsEntry 6, // 6: network.forta.Alert.scanner:type_name -> network.forta.ScannerInfo 4, // 7: network.forta.Alert.timestamps:type_name -> network.forta.TrackingTimestamps 9, // 8: network.forta.Alert.addressBloomFilter:type_name -> network.forta.BloomFilter 10, // 9: network.forta.SignedAlert.alert:type_name -> network.forta.Alert 8, // 10: network.forta.SignedAlert.signature:type_name -> network.forta.Signature 1, // 11: network.forta.Label.entityType:type_name -> network.forta.Label.EntityType - 17, // 12: network.forta.Source.transactions:type_name -> network.forta.Source.TransactionSource - 18, // 13: network.forta.Source.blocks:type_name -> network.forta.Source.BlockSource - 19, // 14: network.forta.Source.urls:type_name -> network.forta.Source.URLSource - 20, // 15: network.forta.Source.chains:type_name -> network.forta.Source.ChainSource - 21, // 16: network.forta.Source.alerts:type_name -> network.forta.Source.AlertSource - 22, // 17: network.forta.Source.customSources:type_name -> network.forta.Source.CustomSource + 18, // 12: network.forta.Source.transactions:type_name -> network.forta.Source.TransactionSource + 19, // 13: network.forta.Source.blocks:type_name -> network.forta.Source.BlockSource + 20, // 14: network.forta.Source.urls:type_name -> network.forta.Source.URLSource + 21, // 15: network.forta.Source.chains:type_name -> network.forta.Source.ChainSource + 22, // 16: network.forta.Source.alerts:type_name -> network.forta.Source.AlertSource + 23, // 17: network.forta.Source.customSources:type_name -> network.forta.Source.CustomSource 2, // 18: network.forta.Finding.severity:type_name -> network.forta.Finding.Severity - 23, // 19: network.forta.Finding.metadata:type_name -> network.forta.Finding.MetadataEntry + 24, // 19: network.forta.Finding.metadata:type_name -> network.forta.Finding.MetadataEntry 3, // 20: network.forta.Finding.type:type_name -> network.forta.Finding.FindingType - 24, // 21: network.forta.Finding.indicators:type_name -> network.forta.Finding.IndicatorsEntry + 25, // 21: network.forta.Finding.indicators:type_name -> network.forta.Finding.IndicatorsEntry 12, // 22: network.forta.Finding.labels:type_name -> network.forta.Label 13, // 23: network.forta.Finding.source:type_name -> network.forta.Source - 24, // [24:24] is the sub-list for method output_type - 24, // [24:24] is the sub-list for method input_type - 24, // [24:24] is the sub-list for extension type_name - 24, // [24:24] is the sub-list for extension extendee - 0, // [0:24] is the sub-list for field type_name + 0, // 24: network.forta.APIAlert.type:type_name -> network.forta.AlertType + 14, // 25: network.forta.APIAlert.finding:type_name -> network.forta.Finding + 26, // 26: network.forta.APIAlert.agent:type_name -> network.forta.APIAlert.APIAlertAgent + 27, // [27:27] is the sub-list for method output_type + 27, // [27:27] is the sub-list for method input_type + 27, // [27:27] is the sub-list for extension type_name + 27, // [27:27] is the sub-list for extension extendee + 0, // [0:27] is the sub-list for field type_name } func init() { file_alert_proto_init() } @@ -1926,8 +2073,8 @@ func file_alert_proto_init() { return nil } } - file_alert_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Source_TransactionSource); i { + file_alert_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*APIAlert); i { case 0: return &v.state case 1: @@ -1939,7 +2086,7 @@ func file_alert_proto_init() { } } file_alert_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Source_BlockSource); i { + switch v := v.(*Source_TransactionSource); i { case 0: return &v.state case 1: @@ -1951,7 +2098,7 @@ func file_alert_proto_init() { } } file_alert_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Source_URLSource); i { + switch v := v.(*Source_BlockSource); i { case 0: return &v.state case 1: @@ -1963,7 +2110,7 @@ func file_alert_proto_init() { } } file_alert_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Source_ChainSource); i { + switch v := v.(*Source_URLSource); i { case 0: return &v.state case 1: @@ -1975,7 +2122,7 @@ func file_alert_proto_init() { } } file_alert_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Source_AlertSource); i { + switch v := v.(*Source_ChainSource); i { case 0: return &v.state case 1: @@ -1987,6 +2134,18 @@ func file_alert_proto_init() { } } file_alert_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Source_AlertSource); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_alert_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Source_CustomSource); i { case 0: return &v.state @@ -1998,6 +2157,18 @@ func file_alert_proto_init() { return nil } } + file_alert_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*APIAlert_APIAlertAgent); 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{ @@ -2005,7 +2176,7 @@ func file_alert_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_alert_proto_rawDesc, NumEnums: 4, - NumMessages: 21, + NumMessages: 23, NumExtensions: 0, NumServices: 0, }, diff --git a/protocol/alert.proto b/protocol/alert.proto index fa6feb5c..093ec342 100644 --- a/protocol/alert.proto +++ b/protocol/alert.proto @@ -162,4 +162,15 @@ message Finding { repeated string relatedAlerts = 13; string uniqueKey = 14; Source source = 15; + string timestamp = 16; } + +message APIAlert { + message APIAlertAgent { + string id = 1; + } + string id = 1; + AlertType type = 2; + Finding finding = 3; + APIAlertAgent agent = 4; +} \ No newline at end of file