From dcd75ff73682b2d904ecc323764dc6d23a88f6ed Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Sat, 9 Mar 2024 16:40:38 -0500 Subject: [PATCH 1/4] fix: #71 add padding to size.max for validation --- validation/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/validation/src/lib.rs b/validation/src/lib.rs index ba3e4c2..41932d2 100644 --- a/validation/src/lib.rs +++ b/validation/src/lib.rs @@ -951,7 +951,9 @@ pub fn generate_checkfile(module: &modsurfer_module::Module) -> Result Date: Sat, 9 Mar 2024 16:41:04 -0500 Subject: [PATCH 2/4] chore: upgrade proto version, regenerate --- Cargo.toml | 2 +- Makefile | 2 +- cli/Cargo.toml | 2 +- proto/v1/go/modsurferpb/api.pb.go | 18 +-- proto/v1/src/api.rs | 127 +++++++++++++----- .../protobuf-list-modules-response/Cargo.toml | 2 +- validation/Cargo.toml | 2 +- 7 files changed, 107 insertions(+), 48 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 75ee738..8622707 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ modsurfer-convert = { path = "convert", version = "0.1" } modsurfer-module = { path = "module", version = "0.1" } modsurfer-proto-v1 = { path = "proto/v1", package = "modsurfer-proto" } modserver-demangle = { path = "demangle" } -protobuf = "3.2.0" +protobuf = "3.4.0" serde = { version = "1", features = ["derive"] } serde_json = "1" serde_yaml = "0.9.14" diff --git a/Makefile b/Makefile index 5a3e3ce..0128ba9 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ unknown-cli: install: @echo "check PROTOC: `which protoc`" go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.32.0 - cargo install protobuf-codegen@3.2.0 + cargo install protobuf-codegen@3.4.0 generate: install protoc --experimental_allow_proto3_optional \ diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 025d7ac..f85978b 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -12,7 +12,7 @@ futures = "0.3.25" human_bytes = "0.4" log = "0.4.17" parse-size = "1" -protobuf = "3.2.0" +protobuf = "3.4.0" reqwest = "0.11.16" serde = { workspace = true } serde_yaml = { workspace = true } diff --git a/proto/v1/go/modsurferpb/api.pb.go b/proto/v1/go/modsurferpb/api.pb.go index 0a54306..b28f570 100644 --- a/proto/v1/go/modsurferpb/api.pb.go +++ b/proto/v1/go/modsurferpb/api.pb.go @@ -1,15 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.32.0 -// protoc v3.12.4 +// protoc v3.15.8 // source: proto/v1/api.proto package modsurferpb import ( - timestamp "github.com/golang/protobuf/ptypes/timestamp" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -512,7 +512,7 @@ type Module struct { // arbitrary metadata provided by the operator of this module Metadata map[string]string `protobuf:"bytes,9,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // timestamp when this module was loaded and stored - InsertedAt *timestamp.Timestamp `protobuf:"bytes,10,opt,name=inserted_at,json=insertedAt,proto3" json:"inserted_at,omitempty"` + InsertedAt *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=inserted_at,json=insertedAt,proto3" json:"inserted_at,omitempty"` // the interned strings stored in the wasm binary (panic/abort messages, etc.) Strings []string `protobuf:"bytes,11,rep,name=strings,proto3" json:"strings,omitempty"` // the cyclomatic complexity @@ -612,7 +612,7 @@ func (x *Module) GetMetadata() map[string]string { return nil } -func (x *Module) GetInsertedAt() *timestamp.Timestamp { +func (x *Module) GetInsertedAt() *timestamppb.Timestamp { if x != nil { return x.InsertedAt } @@ -1279,9 +1279,9 @@ type SearchModulesRequest struct { // arbitrary metadata provided by the operator of this module Metadata map[string]string `protobuf:"bytes,10,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // timestamp when this module was loaded and stored - InsertedBefore *timestamp.Timestamp `protobuf:"bytes,11,opt,name=inserted_before,json=insertedBefore,proto3,oneof" json:"inserted_before,omitempty"` + InsertedBefore *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=inserted_before,json=insertedBefore,proto3,oneof" json:"inserted_before,omitempty"` // timestamp when this module was loaded and stored - InsertedAfter *timestamp.Timestamp `protobuf:"bytes,12,opt,name=inserted_after,json=insertedAfter,proto3,oneof" json:"inserted_after,omitempty"` + InsertedAfter *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=inserted_after,json=insertedAfter,proto3,oneof" json:"inserted_after,omitempty"` // the interned strings stored in the wasm binary (panic/abort messages, etc.) Strings []string `protobuf:"bytes,13,rep,name=strings,proto3" json:"strings,omitempty"` // match on any function name in an import or export. @@ -1387,14 +1387,14 @@ func (x *SearchModulesRequest) GetMetadata() map[string]string { return nil } -func (x *SearchModulesRequest) GetInsertedBefore() *timestamp.Timestamp { +func (x *SearchModulesRequest) GetInsertedBefore() *timestamppb.Timestamp { if x != nil { return x.InsertedBefore } return nil } -func (x *SearchModulesRequest) GetInsertedAfter() *timestamp.Timestamp { +func (x *SearchModulesRequest) GetInsertedAfter() *timestamppb.Timestamp { if x != nil { return x.InsertedAfter } @@ -2904,7 +2904,7 @@ var file_proto_v1_api_proto_goTypes = []interface{}{ nil, // 40: SearchModulesRequest.MetadataEntry nil, // 41: DeleteModulesResponse.ModuleIdHashEntry nil, // 42: AuditModulesResponse.InvalidModuleReportEntry - (*timestamp.Timestamp)(nil), // 43: google.protobuf.Timestamp + (*timestamppb.Timestamp)(nil), // 43: google.protobuf.Timestamp } var file_proto_v1_api_proto_depIdxs = []int32{ 0, // 0: Function.params:type_name -> ValType diff --git a/proto/v1/src/api.rs b/proto/v1/src/api.rs index 0d1a9e1..8c90e02 100644 --- a/proto/v1/src/api.rs +++ b/proto/v1/src/api.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 3.2.0. Do not edit +// This file is generated by rust-protobuf 3.4.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated @@ -23,11 +23,11 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_2_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_4_0; /// Contained by an import or export element within a wasm binary. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:Function) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Function { // message fields // @@protoc_insertion_point(field:Function.params) @@ -192,8 +192,8 @@ impl ::protobuf::reflect::ProtobufValue for Function { /// A function and module namespace that is defined outside of the current /// module, and referenced & called by the current module. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:Import) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Import { // message fields // @@protoc_insertion_point(field:Import.module_name) @@ -335,8 +335,8 @@ impl ::protobuf::reflect::ProtobufValue for Import { /// A function that is defined inside the current module, made available to /// outside modules / environments. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:Export) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Export { // message fields // @@protoc_insertion_point(field:Export.func) @@ -460,8 +460,8 @@ impl ::protobuf::reflect::ProtobufValue for Export { /// Details about a wasm module, either extracted directly from the binary, or /// inferred somehow. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:Module) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Module { // message fields /// ID for this module, generated by the database. @@ -845,8 +845,8 @@ impl ::protobuf::reflect::ProtobufValue for Module { } /// Details about a wasm module graph -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:ModuleGraph) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ModuleGraph { // message fields /// ID for this module, generated by the database. @@ -988,8 +988,8 @@ impl ::protobuf::reflect::ProtobufValue for ModuleGraph { } /// An error message indicating a problem in the API. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:Error) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Error { // message fields // @@protoc_insertion_point(field:Error.code) @@ -1130,8 +1130,8 @@ impl ::protobuf::reflect::ProtobufValue for Error { /// Control/limit the way results are paginated when working with large /// responses. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:Pagination) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Pagination { // message fields // @@protoc_insertion_point(field:Pagination.limit) @@ -1271,8 +1271,8 @@ impl ::protobuf::reflect::ProtobufValue for Pagination { } /// Determine how to sort results from the API -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:Sort) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Sort { // message fields // @@protoc_insertion_point(field:Sort.direction) @@ -1413,8 +1413,8 @@ impl ::protobuf::reflect::ProtobufValue for Sort { /// `PUT /api/v1/module:` /// Insert a module, extract data from binary. Return the module ID & hash. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:CreateModuleRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct CreateModuleRequest { // message fields // @@protoc_insertion_point(field:CreateModuleRequest.wasm) @@ -1589,8 +1589,8 @@ impl ::protobuf::reflect::ProtobufValue for CreateModuleRequest { } /// The message returned in response to a `CreateModuleRequest`. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:CreateModuleResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct CreateModuleResponse { // message fields // @@protoc_insertion_point(field:CreateModuleResponse.module_id) @@ -1750,8 +1750,8 @@ impl ::protobuf::reflect::ProtobufValue for CreateModuleResponse { /// `POST /api/v1/module:` /// Return a single module. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:GetModuleRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct GetModuleRequest { // message fields // @@protoc_insertion_point(field:GetModuleRequest.module_id) @@ -1873,8 +1873,8 @@ impl ::protobuf::reflect::ProtobufValue for GetModuleRequest { } /// The message returned in response to a `GetModuleRequest`. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:GetModuleResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct GetModuleResponse { // message fields // @@protoc_insertion_point(field:GetModuleResponse.module) @@ -2017,8 +2017,8 @@ impl ::protobuf::reflect::ProtobufValue for GetModuleResponse { /// `POST /api/v1/modules:` /// Return paginated list of all modules. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:ListModulesRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ListModulesRequest { // message fields // @@protoc_insertion_point(field:ListModulesRequest.pagination) @@ -2160,8 +2160,8 @@ impl ::protobuf::reflect::ProtobufValue for ListModulesRequest { } /// The message returned in response to a `ListModulesRequest`. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:ListModulesResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ListModulesResponse { // message fields // @@protoc_insertion_point(field:ListModulesResponse.modules) @@ -2364,8 +2364,8 @@ impl ::protobuf::reflect::ProtobufValue for ListModulesResponse { /// Search for modules based on filter params provided (which should be any /// dimension of the module schema, or string search in any metadata value). /// Return a paginated list of matching modules. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:SearchModulesRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct SearchModulesRequest { // message fields /// ID for this module, generated by the database. @@ -2783,8 +2783,8 @@ impl ::protobuf::reflect::ProtobufValue for SearchModulesRequest { } /// The message returned in response to a `SearchModulesRequest`. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:SearchModulesResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct SearchModulesResponse { // message fields // @@protoc_insertion_point(field:SearchModulesResponse.modules) @@ -2985,8 +2985,8 @@ impl ::protobuf::reflect::ProtobufValue for SearchModulesResponse { /// `DELETE /api/v1/module:` /// Remove a module from the database by its ID. Return the module IDs & hashes. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:DeleteModulesRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct DeleteModulesRequest { // message fields // @@protoc_insertion_point(field:DeleteModulesRequest.module_ids) @@ -3111,8 +3111,8 @@ impl ::protobuf::reflect::ProtobufValue for DeleteModulesRequest { } /// The message returned in response to a `DeleteModulesRequest`. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:DeleteModulesResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct DeleteModulesResponse { // message fields // @@protoc_insertion_point(field:DeleteModulesResponse.module_id_hash) @@ -3271,8 +3271,8 @@ impl ::protobuf::reflect::ProtobufValue for DeleteModulesResponse { /// `POST /api/v1/audit:` /// Return a list of modules which match the outcome requirements using the provided checkfile. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:AuditModulesRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct AuditModulesRequest { // message fields /// the YAML checkfile (e.g. mod.yaml) bytes @@ -3432,8 +3432,8 @@ impl ::protobuf::reflect::ProtobufValue for AuditModulesRequest { } /// The message returned in response to a `AuditModulesRequest`. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:AuditModulesResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct AuditModulesResponse { // message fields /// each record contains the ID of the invalid Module which failed the audit, as well as the failure @@ -3631,8 +3631,8 @@ impl ::protobuf::reflect::ProtobufValue for AuditModulesResponse { /// `POST /api/v1/diff:` /// Return the diff of two modules -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:DiffRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct DiffRequest { // message fields // @@protoc_insertion_point(field:DiffRequest.module1) @@ -3809,8 +3809,8 @@ impl ::protobuf::reflect::ProtobufValue for DiffRequest { /// The message returned in response to `DiffRequest`, contains a text representation of the difference /// between the two specified modules. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:DiffResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct DiffResponse { // message fields // @@protoc_insertion_point(field:DiffResponse.diff) @@ -3952,8 +3952,8 @@ impl ::protobuf::reflect::ProtobufValue for DiffResponse { /// `POST /api/v1/validate:` /// Return the failure report (if applicable) of a wasm module validation against a given checkfile. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:ValidateModuleRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ValidateModuleRequest { // message fields /// the YAML checkfile (e.g. mod.yaml) bytes @@ -4224,8 +4224,8 @@ pub mod validate_module_request { } /// The failure report produced by the validation check (encoded in JSON). -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:ValidateModuleResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ValidateModuleResponse { // message fields // @@protoc_insertion_point(field:ValidateModuleResponse.invalid_module_report) @@ -4367,8 +4367,8 @@ impl ::protobuf::reflect::ProtobufValue for ValidateModuleResponse { /// `POST /api/v1/module_graph:` /// Return a single module_graph. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:GetModuleGraphRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct GetModuleGraphRequest { // message fields // @@protoc_insertion_point(field:GetModuleGraphRequest.module_id) @@ -4490,8 +4490,8 @@ impl ::protobuf::reflect::ProtobufValue for GetModuleGraphRequest { } /// The message returned in response to a `GetModuleGraphRequest`. -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:GetModuleGraphResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct GetModuleGraphResponse { // message fields // @@protoc_insertion_point(field:GetModuleGraphResponse.module_graph) @@ -4633,8 +4633,8 @@ impl ::protobuf::reflect::ProtobufValue for GetModuleGraphResponse { } /// PUT /api/v1/plugin: -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:InstallPluginRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct InstallPluginRequest { // message fields // @@protoc_insertion_point(field:InstallPluginRequest.identifier) @@ -4809,8 +4809,8 @@ impl ::protobuf::reflect::ProtobufValue for InstallPluginRequest { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:InstallPluginResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct InstallPluginResponse { // message fields // @@protoc_insertion_point(field:InstallPluginResponse.hash) @@ -4951,8 +4951,8 @@ impl ::protobuf::reflect::ProtobufValue for InstallPluginResponse { } /// DELETE /api/v1/plugin: -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:UninstallPluginRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct UninstallPluginRequest { // message fields // @@protoc_insertion_point(field:UninstallPluginRequest.identifier) @@ -5073,8 +5073,8 @@ impl ::protobuf::reflect::ProtobufValue for UninstallPluginRequest { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:UninstallPluginResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct UninstallPluginResponse { // message fields // @@protoc_insertion_point(field:UninstallPluginResponse.error) @@ -5197,8 +5197,8 @@ impl ::protobuf::reflect::ProtobufValue for UninstallPluginResponse { } /// POST /api/v1/plugin: -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:CallPluginRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct CallPluginRequest { // message fields // @@protoc_insertion_point(field:CallPluginRequest.identifier) @@ -5373,8 +5373,8 @@ impl ::protobuf::reflect::ProtobufValue for CallPluginRequest { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:CallPluginResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct CallPluginResponse { // message fields // @@protoc_insertion_point(field:CallPluginResponse.output) @@ -5555,6 +5555,19 @@ impl ::protobuf::Enum for ValType { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "I32" => ::std::option::Option::Some(ValType::I32), + "I64" => ::std::option::Option::Some(ValType::I64), + "F32" => ::std::option::Option::Some(ValType::F32), + "F64" => ::std::option::Option::Some(ValType::F64), + "V128" => ::std::option::Option::Some(ValType::V128), + "FuncRef" => ::std::option::Option::Some(ValType::FuncRef), + "ExternRef" => ::std::option::Option::Some(ValType::ExternRef), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [ValType] = &[ ValType::I32, ValType::I64, @@ -5639,6 +5652,22 @@ impl ::protobuf::Enum for SourceLanguage { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "Unknown" => ::std::option::Option::Some(SourceLanguage::Unknown), + "Rust" => ::std::option::Option::Some(SourceLanguage::Rust), + "Go" => ::std::option::Option::Some(SourceLanguage::Go), + "C" => ::std::option::Option::Some(SourceLanguage::C), + "Cpp" => ::std::option::Option::Some(SourceLanguage::Cpp), + "AssemblyScript" => ::std::option::Option::Some(SourceLanguage::AssemblyScript), + "Swift" => ::std::option::Option::Some(SourceLanguage::Swift), + "JavaScript" => ::std::option::Option::Some(SourceLanguage::JavaScript), + "Haskell" => ::std::option::Option::Some(SourceLanguage::Haskell), + "Zig" => ::std::option::Option::Some(SourceLanguage::Zig), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [SourceLanguage] = &[ SourceLanguage::Unknown, SourceLanguage::Rust, @@ -5702,6 +5731,14 @@ impl ::protobuf::Enum for Direction { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "Desc" => ::std::option::Option::Some(Direction::Desc), + "Asc" => ::std::option::Option::Some(Direction::Asc), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [Direction] = &[ Direction::Desc, Direction::Asc, @@ -5775,6 +5812,20 @@ impl ::protobuf::Enum for Field { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "CreatedAt" => ::std::option::Option::Some(Field::CreatedAt), + "Name" => ::std::option::Option::Some(Field::Name), + "Size" => ::std::option::Option::Some(Field::Size), + "Language" => ::std::option::Option::Some(Field::Language), + "ImportsCount" => ::std::option::Option::Some(Field::ImportsCount), + "ExportsCount" => ::std::option::Option::Some(Field::ExportsCount), + "Sha256" => ::std::option::Option::Some(Field::Sha256), + "Complexity" => ::std::option::Option::Some(Field::Complexity), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [Field] = &[ Field::CreatedAt, Field::Name, @@ -5838,6 +5889,14 @@ impl ::protobuf::Enum for AuditOutcome { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "PASS" => ::std::option::Option::Some(AuditOutcome::PASS), + "FAIL" => ::std::option::Option::Some(AuditOutcome::FAIL), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [AuditOutcome] = &[ AuditOutcome::PASS, AuditOutcome::FAIL, diff --git a/scripts/protobuf-list-modules-response/Cargo.toml b/scripts/protobuf-list-modules-response/Cargo.toml index 6237af1..dcd763b 100644 --- a/scripts/protobuf-list-modules-response/Cargo.toml +++ b/scripts/protobuf-list-modules-response/Cargo.toml @@ -14,5 +14,5 @@ modsurfer = { path = "../../../private-modsurfer/modsurfer", features = [ ] } modsurfer-convert = { path = "../../convert" } modsurfer-module = { path = "../../module" } -protobuf = "3.2.0" +protobuf = "3.4.0" tokio = { version = "1", features = ["full"] } diff --git a/validation/Cargo.toml b/validation/Cargo.toml index 7c831c2..64c4b4f 100644 --- a/validation/Cargo.toml +++ b/validation/Cargo.toml @@ -11,7 +11,7 @@ futures = "0.3.25" human_bytes = "0.4" log = "0.4.17" parse-size = "1" -protobuf = "3.2.0" +protobuf = "3.4.0" serde = { workspace = true } serde_yaml = { workspace = true } serde_json = { workspace = true } From 4e1391fd1c6bfd7cc438643e4e4cfe5ba32ce21f Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Sat, 9 Mar 2024 16:41:37 -0500 Subject: [PATCH 3/4] chore: bump cli version --- cli/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/Cargo.toml b/cli/Cargo.toml index f85978b..6bba5f9 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "modsurfer-cli" -version = "0.0.9" +version = "0.0.10" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From 00f0538ace52fde843d34100b640cff5dfbe3d39 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Sat, 9 Mar 2024 19:53:19 -0600 Subject: [PATCH 4/4] chore: update Cargo.lock --- Cargo.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8733045..8f3697f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1497,7 +1497,7 @@ dependencies = [ [[package]] name = "modsurfer-cli" -version = "0.0.9" +version = "0.0.10" dependencies = [ "anyhow", "clap", @@ -1808,9 +1808,9 @@ dependencies = [ [[package]] name = "protobuf" -version = "3.2.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55bad9126f378a853655831eb7363b7b01b81d19f8cb1218861086ca4a1a61e" +checksum = "58678a64de2fced2bdec6bca052a6716a0efe692d6e3f53d1bda6a1def64cfc0" dependencies = [ "once_cell", "protobuf-support", @@ -1819,9 +1819,9 @@ dependencies = [ [[package]] name = "protobuf-support" -version = "3.2.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d4d7b8601c814cfb36bcebb79f0e61e45e1e93640cf778837833bbed05c372" +checksum = "e1ed294a835b0f30810e13616b1cd34943c6d1e84a8f3b0dcfe466d256c3e7e7" dependencies = [ "thiserror", ]