diff --git a/Cargo.lock b/Cargo.lock index d92ba9f..b6e0656 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,6 +28,15 @@ dependencies = [ "version_check", ] +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + [[package]] name = "ambient-authority" version = "0.0.2" @@ -109,12 +118,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2d098ff73c1ca148721f37baad5ea6a465a13f9573aba8641fbbbae8164a54e" -[[package]] -name = "arc-swap" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" - [[package]] name = "async-trait" version = "0.1.73" @@ -126,17 +129,6 @@ dependencies = [ "syn 2.0.31", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -200,6 +192,12 @@ version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +[[package]] +name = "bytemuck" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" + [[package]] name = "byteorder" version = "1.4.3" @@ -293,7 +291,6 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da6bc11b07529f16944307272d5bd9b22530bc7d05751717c9d416586cedab49" dependencies = [ - "clap 3.2.25", "heck", "indexmap 1.9.3", "log", @@ -337,21 +334,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "clap" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" -dependencies = [ - "atty", - "bitflags 1.3.2", - "clap_lex 0.2.4", - "indexmap 1.9.3", - "strsim", - "termcolor", - "textwrap", -] - [[package]] name = "clap" version = "4.4.2" @@ -369,19 +351,10 @@ checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08" dependencies = [ "anstream", "anstyle", - "clap_lex 0.5.1", + "clap_lex", "strsim", ] -[[package]] -name = "clap_lex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] - [[package]] name = "clap_lex" version = "0.5.1" @@ -709,23 +682,6 @@ dependencies = [ "serde", ] -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "destructure_traitobject" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c877555693c14d2f84191cfd3ad8582790fc52b5e2274b40b59cf5f5cea25c7" - [[package]] name = "digest" version = "0.10.7" @@ -821,21 +777,21 @@ dependencies = [ [[package]] name = "extism" -version = "1.0.0-alpha.0" -source = "git+https://github.com/extism/extism?branch=main#215d6838e909fc0ace30a4d76d9929a63682a2fe" +version = "0.0.0+replaced-by-ci" +source = "git+https://github.com/extism/extism?branch=main#211d55337d74dc8e679e687416ce8f3bae286d87" dependencies = [ "anyhow", "cbindgen", - "extism-convert 0.2.0 (git+https://github.com/extism/extism?branch=main)", + "extism-convert", "extism-manifest", "glob", "libc", - "log", - "log4rs", "serde", "serde_json", "sha2", "toml 0.8.6", + "tracing", + "tracing-subscriber", "ureq", "url", "uuid", @@ -845,26 +801,14 @@ dependencies = [ [[package]] name = "extism-convert" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74ab6cd70509e6d74b7c3587f823a2061cfb65b111b4173bd882858eaa87e4a3" -dependencies = [ - "anyhow", - "base64", - "prost", - "rmp-serde", - "serde", - "serde_json", -] - -[[package]] -name = "extism-convert" -version = "0.2.0" -source = "git+https://github.com/extism/extism?branch=main#215d6838e909fc0ace30a4d76d9929a63682a2fe" +version = "0.0.0+replaced-by-ci" +source = "git+https://github.com/extism/extism?branch=main#211d55337d74dc8e679e687416ce8f3bae286d87" dependencies = [ "anyhow", "base64", + "bytemuck", "prost", + "protobuf", "rmp-serde", "serde", "serde_json", @@ -872,11 +816,12 @@ dependencies = [ [[package]] name = "extism-manifest" -version = "1.0.0-alpha.0" -source = "git+https://github.com/extism/extism?branch=main#215d6838e909fc0ace30a4d76d9929a63682a2fe" +version = "0.0.0+replaced-by-ci" +source = "git+https://github.com/extism/extism?branch=main#211d55337d74dc8e679e687416ce8f3bae286d87" dependencies = [ "base64", "serde", + "serde_json", ] [[package]] @@ -1153,15 +1098,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.3.2" @@ -1214,12 +1150,6 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27e2b089f28ad15597b48d8c0a8fe94eeb1c1cb26ca99b6f66ac9582ae10c5e6" -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "hyper" version = "0.14.27" @@ -1340,7 +1270,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi", "libc", "windows-sys", ] @@ -1363,7 +1293,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi", "rustix 0.38.11", "windows-sys", ] @@ -1448,12 +1378,6 @@ version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - [[package]] name = "linux-raw-sys" version = "0.3.8" @@ -1481,49 +1405,23 @@ name = "log" version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -dependencies = [ - "serde", -] [[package]] -name = "log-mdc" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a94d21414c1f4a51209ad204c1776a3d0765002c76c6abcb602a6f09f1e881c7" - -[[package]] -name = "log4rs" -version = "1.2.0" +name = "mach" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d36ca1786d9e79b8193a68d480a0907b612f109537115c6ff655a3a1967533fd" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" dependencies = [ - "anyhow", - "arc-swap", - "chrono", - "derivative", - "fnv", - "humantime", "libc", - "log", - "log-mdc", - "parking_lot", - "serde", - "serde-value", - "serde_json", - "serde_yaml 0.8.26", - "thiserror", - "thread-id", - "typemap-ors", - "winapi", ] [[package]] -name = "mach" -version = "0.3.2" +name = "matchers" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "libc", + "regex-automata 0.1.10", ] [[package]] @@ -1606,7 +1504,7 @@ name = "modsurfer-cli" version = "0.0.9" dependencies = [ "anyhow", - "clap 4.4.2", + "clap", "colored", "comfy-table", "extism", @@ -1624,7 +1522,7 @@ dependencies = [ "serde", "serde_json", "serde_with", - "serde_yaml 0.9.25", + "serde_yaml", "tokio", "url", ] @@ -1680,7 +1578,7 @@ dependencies = [ "colored", "comfy-table", "extism", - "extism-convert 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "extism-convert", "futures", "getrandom", "human_bytes", @@ -1695,7 +1593,7 @@ dependencies = [ "serde", "serde_json", "serde_with", - "serde_yaml 0.9.25", + "serde_yaml", "similar", "tokio", "url", @@ -1719,6 +1617,16 @@ dependencies = [ "tempfile", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-traits" version = "0.2.16" @@ -1734,7 +1642,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi", "libc", ] @@ -1801,19 +1709,10 @@ dependencies = [ ] [[package]] -name = "ordered-float" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" -dependencies = [ - "num-traits", -] - -[[package]] -name = "os_str_bytes" -version = "6.5.1" +name = "overload" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "parking_lot" @@ -2044,6 +1943,50 @@ dependencies = [ "smallvec", ] +[[package]] +name = "regex" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + [[package]] name = "reqwest" version = "0.11.20" @@ -2266,16 +2209,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-value" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" -dependencies = [ - "ordered-float", - "serde", -] - [[package]] name = "serde_derive" version = "1.0.188" @@ -2348,18 +2281,6 @@ dependencies = [ "syn 2.0.31", ] -[[package]] -name = "serde_yaml" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" -dependencies = [ - "indexmap 1.9.3", - "ryu", - "serde", - "yaml-rust", -] - [[package]] name = "serde_yaml" version = "0.9.25" @@ -2384,6 +2305,15 @@ dependencies = [ "digest", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "shellexpand" version = "2.1.2" @@ -2570,21 +2500,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" - [[package]] name = "thiserror" version = "1.0.48" @@ -2606,14 +2521,13 @@ dependencies = [ ] [[package]] -name = "thread-id" -version = "4.2.0" +name = "thread_local" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79474f573561cdc4871a0de34a51c92f7f5a56039113fbb5b9c9f96bdb756669" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ - "libc", - "redox_syscall 0.2.16", - "winapi", + "cfg-if", + "once_cell", ] [[package]] @@ -2793,23 +2707,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", + "valuable", ] [[package]] -name = "try-lock" -version = "0.2.4" +name = "tracing-log" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] [[package]] -name = "typemap-ors" -version = "1.0.0" +name = "tracing-subscriber" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a68c24b707f02dd18f1e4ccceb9d49f2058c2fb86384ef9972592904d7a28867" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ - "unsafe-any-ors", + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", ] +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + [[package]] name = "typenum" version = "1.16.0" @@ -2849,15 +2784,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" -[[package]] -name = "unsafe-any-ors" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a303d30665362d9680d7d91d78b23f5f899504d4f08b3c4cf08d055d87c0ad" -dependencies = [ - "destructure_traitobject", -] - [[package]] name = "unsafe-libyaml" version = "0.2.9" @@ -2912,6 +2838,12 @@ dependencies = [ "getrandom", ] +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "vcpkg" version = "0.2.15" @@ -3555,15 +3487,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -3719,15 +3642,6 @@ dependencies = [ "wast 35.0.2", ] -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "zstd" version = "0.11.2+zstd.1.5.2" diff --git a/cli/src/cmd/mod.rs b/cli/src/cmd/mod.rs index 9b84330..9d95ae3 100644 --- a/cli/src/cmd/mod.rs +++ b/cli/src/cmd/mod.rs @@ -2,4 +2,5 @@ pub mod api_result; pub mod exec; pub mod generate; +#[allow(unused_imports)] pub use exec::*; diff --git a/convert/src/from_api.rs b/convert/src/from_api.rs index 83f21ef..86b319f 100644 --- a/convert/src/from_api.rs +++ b/convert/src/from_api.rs @@ -130,13 +130,13 @@ pub fn search(mut req: api::SearchModulesRequest) -> Search { function_name: req.function_name, module_name: req.module_name, inserted_after: req.inserted_after.as_ref().and_then(|x| { - Some(chrono::DateTime::::from_utc( + Some(chrono::DateTime::from_naive_utc_and_offset( chrono::NaiveDateTime::from_timestamp_opt(x.seconds, x.nanos as u32)?, chrono::Utc, )) }), inserted_before: req.inserted_before.as_ref().and_then(|x| { - Some(chrono::DateTime::::from_utc( + Some(chrono::DateTime::::from_naive_utc_and_offset( chrono::NaiveDateTime::from_timestamp_opt(x.seconds, x.nanos as u32)?, chrono::Utc, )) diff --git a/validation/Cargo.toml b/validation/Cargo.toml index 92f7da2..c939dd5 100644 --- a/validation/Cargo.toml +++ b/validation/Cargo.toml @@ -25,7 +25,7 @@ colored = { workspace = true } [target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dependencies] extism = { git = "https://github.com/extism/extism", branch = "main" } -extism-convert = "0.2.0" +extism-convert = { git = "https://github.com/extism/extism", branch = "main", default-features = false, features = ["protobuf"]} getrandom = { version = "*", features = ["js"] } tokio = { workspace = true } modsurfer-plugins = { workspace = true } diff --git a/validation/src/lib.rs b/validation/src/lib.rs index 31a0585..3358ac1 100644 --- a/validation/src/lib.rs +++ b/validation/src/lib.rs @@ -8,6 +8,8 @@ use comfy_table::{modifiers::UTF8_SOLID_INNER_BORDERS, presets::UTF8_FULL, Row, #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] use extism::Plugin; #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] +use extism_convert::Protobuf; +#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] use modsurfer_convert::from_api; use anyhow::Result; @@ -951,21 +953,3 @@ pub fn generate_checkfile(module: &modsurfer_module::Module) -> Result(pub T); - -impl<'a, T: protobuf::Message> ToBytes<'a> for Protobuf { - type Bytes = Vec; - - fn to_bytes(&self) -> Result { - Ok(self.0.write_to_bytes()?) - } -} - -impl<'a, T: Default + protobuf::Message> FromBytesOwned for Protobuf { - fn from_bytes_owned(data: &[u8]) -> Result { - Ok(Protobuf(T::parse_from_bytes(data)?)) - } -}