From 688e6128d432a00ca3a11fe310d8d96a69e62239 Mon Sep 17 00:00:00 2001 From: Anand Krishnamoorthi <35780660+anakrish@users.noreply.github.com> Date: Mon, 17 Nov 2025 14:21:13 -0600 Subject: [PATCH] feat: Detect incorrect multi-threaded use from c based ffi (#499) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add runtime detection for shared handle misuse wrap the FFI engine handle with parking_lot::RwLock when the new contention_checks feature is enabled, surfacing a clear “handle is already in use” error instead of allowing undefined behavior keep the feature optional so no_std builds or environments that supply their own synchronization can opt out caution users that this guards the handle itself but does not make the engine’s operations globally thread-safe on its own Signed-off-by: Anand Krishnamoorthi --- .github/workflows/test-ffi.yml | 1 + Cargo.lock | 168 +++------- bindings/c-nostd/main.c | 87 +++-- bindings/ffi/Cargo.lock | 117 ++----- bindings/ffi/Cargo.toml | 4 +- bindings/ffi/src/allocator.rs | 2 +- bindings/ffi/src/common.rs | 47 +-- bindings/ffi/src/compile.rs | 22 +- bindings/ffi/src/compiled_policy.rs | 7 +- bindings/ffi/src/engine.rs | 232 ++++++++----- bindings/ffi/src/lib.rs | 5 + bindings/ffi/src/lock.rs | 103 ++++++ bindings/java/Cargo.lock | 20 +- bindings/python/Cargo.lock | 16 +- bindings/ruby/Cargo.lock | 486 ++++++++++------------------ bindings/wasm/Cargo.lock | 16 +- 16 files changed, 638 insertions(+), 695 deletions(-) create mode 100644 bindings/ffi/src/lock.rs diff --git a/.github/workflows/test-ffi.yml b/.github/workflows/test-ffi.yml index b32eaea..3d05de4 100644 --- a/.github/workflows/test-ffi.yml +++ b/.github/workflows/test-ffi.yml @@ -24,4 +24,5 @@ jobs: cargo fetch cargo build -r --frozen cargo clippy --all-targets --no-deps -- -Dwarnings + cargo test --features contention_checks --frozen working-directory: ./bindings/ffi diff --git a/Cargo.lock b/Cargo.lock index f88f90f..8575e36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -72,22 +72,22 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.60.2", + "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.10" +version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.60.2", + "windows-sys", ] [[package]] @@ -175,9 +175,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.44" +version = "1.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37521ac7aabe3d13122dc382493e20c9416f299d2ccd5b3a5340a2570cdeb0f3" +checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36" dependencies = [ "find-msvc-tools", "shlex", @@ -241,9 +241,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.51" +version = "4.5.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5" +checksum = "aa8120877db0e5c011242f96806ce3c94e0737ab8108532a76a3300a01db2ab8" dependencies = [ "clap_builder", "clap_derive", @@ -251,9 +251,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.51" +version = "4.5.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a" +checksum = "02576b399397b659c26064fbc92a75fede9d18ffd5f80ca1cd74ddab167016e1" dependencies = [ "anstream", "anstyle", @@ -269,8 +269,8 @@ checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" dependencies = [ "heck", "proc-macro2 1.0.103", - "quote 1.0.41", - "syn 2.0.108", + "quote 1.0.42", + "syn 2.0.110", ] [[package]] @@ -382,8 +382,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2 1.0.103", - "quote 1.0.41", - "syn 2.0.108", + "quote 1.0.42", + "syn 2.0.110", ] [[package]] @@ -428,9 +428,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" [[package]] name = "fluent-uri" @@ -1043,9 +1043,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.41" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2 1.0.103", ] @@ -1130,8 +1130,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" dependencies = [ "proc-macro2 1.0.103", - "quote 1.0.41", - "syn 2.0.108", + "quote 1.0.42", + "syn 2.0.110", ] [[package]] @@ -1278,8 +1278,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2 1.0.103", - "quote 1.0.41", - "syn 2.0.108", + "quote 1.0.42", + "syn 2.0.110", ] [[package]] @@ -1357,12 +1357,12 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.108" +version = "2.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" dependencies = [ "proc-macro2 1.0.103", - "quote 1.0.41", + "quote 1.0.42", "unicode-ident", ] @@ -1373,8 +1373,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2 1.0.103", - "quote 1.0.41", - "syn 2.0.108", + "quote 1.0.42", + "syn 2.0.110", ] [[package]] @@ -1405,8 +1405,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2 1.0.103", - "quote 1.0.41", - "syn 2.0.108", + "quote 1.0.42", + "syn 2.0.110", ] [[package]] @@ -1574,7 +1574,7 @@ version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" dependencies = [ - "quote 1.0.41", + "quote 1.0.42", "wasm-bindgen-macro-support", ] @@ -1586,8 +1586,8 @@ checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" dependencies = [ "bumpalo", "proc-macro2 1.0.103", - "quote 1.0.41", - "syn 2.0.108", + "quote 1.0.42", + "syn 2.0.110", "wasm-bindgen-shared", ] @@ -1616,7 +1616,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys", ] [[package]] @@ -1639,8 +1639,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2 1.0.103", - "quote 1.0.41", - "syn 2.0.108", + "quote 1.0.42", + "syn 2.0.110", ] [[package]] @@ -1650,8 +1650,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2 1.0.103", - "quote 1.0.41", - "syn 2.0.108", + "quote 1.0.42", + "syn 2.0.110", ] [[package]] @@ -1678,15 +1678,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-sys" version = "0.61.2" @@ -1696,71 +1687,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "windows-targets" -version = "0.53.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" -dependencies = [ - "windows-link", - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" - [[package]] name = "winnow" version = "0.7.13" @@ -1811,8 +1737,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2 1.0.103", - "quote 1.0.41", - "syn 2.0.108", + "quote 1.0.42", + "syn 2.0.110", "synstructure", ] @@ -1832,8 +1758,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2 1.0.103", - "quote 1.0.41", - "syn 2.0.108", + "quote 1.0.42", + "syn 2.0.110", ] [[package]] @@ -1852,8 +1778,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2 1.0.103", - "quote 1.0.41", - "syn 2.0.108", + "quote 1.0.42", + "syn 2.0.110", "synstructure", ] @@ -1886,6 +1812,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2 1.0.103", - "quote 1.0.41", - "syn 2.0.108", + "quote 1.0.42", + "syn 2.0.110", ] diff --git a/bindings/c-nostd/main.c b/bindings/c-nostd/main.c index 36127c7..6d6ff75 100644 --- a/bindings/c-nostd/main.c +++ b/bindings/c-nostd/main.c @@ -1,70 +1,100 @@ #include +#include +#if defined(_WIN32) +#include +#endif #include "regorus.h" - // Regorus has been built for no_std and cannot access files. -char* file_to_string(const char* file) { - char * buffer = 0; +char *file_to_string(const char *file) +{ + char *buffer = 0; long length; - FILE * f = fopen (file, "rb"); + FILE *f = fopen(file, "rb"); if (f) { - fseek (f, 0, SEEK_END); - length = ftell (f); - fseek (f, 0, SEEK_SET); - buffer = malloc (length + 1); - buffer[length] = '\0'; - if (buffer) - { - fread (buffer, 1, length, f); - } - fclose (f); + fseek(f, 0, SEEK_END); + length = ftell(f); + fseek(f, 0, SEEK_SET); + buffer = malloc(length + 1); + buffer[length] = '\0'; + if (buffer) + { + fread(buffer, 1, length, f); + } + fclose(f); } return buffer; } // If regorus is built with custom-allocator, then provide implementation. -uint8_t* regorus_aligned_alloc(size_t alignment, size_t size) { - return (uint8_t*) aligned_alloc(alignment, size); +uint8_t *regorus_aligned_alloc(size_t alignment, size_t size) +{ + // Aligned allocations must respect platform quirks: Windows offers + // _aligned_malloc/_aligned_free, while macOS/Linux reject aligned_alloc + // calls when size is not a multiple of alignment, so we rely on + // posix_memalign for the no_std build. +#if defined(_WIN32) + return (uint8_t *)_aligned_malloc(size, alignment); +#else + void *ptr = NULL; + // posix_memalign requires alignment to be at least sizeof(void*) + // and a power of two; normalize here so small requests succeed. + if (alignment < sizeof(void *)) + { + alignment = sizeof(void *); + } + + if (posix_memalign(&ptr, alignment, size) != 0) + { + return NULL; + } + return (uint8_t *)ptr; +#endif } -void regorus_free(uint8_t* ptr) { +void regorus_free(uint8_t *ptr) +{ +#if defined(_WIN32) + _aligned_free(ptr); +#else free(ptr); +#endif } - -int main() { +int main() +{ // Create engine. - RegorusEngine* engine = regorus_engine_new(); + RegorusEngine *engine = regorus_engine_new(); RegorusResult r; - char* buffer = NULL; + char *buffer = NULL; // Turn on rego v0 since policy uses v0. r = regorus_engine_set_rego_v0(engine, true); if (r.status != Ok) - goto error; + goto error; // Load policies. r = regorus_engine_add_policy(engine, "framework.rego", (buffer = file_to_string("../../../tests/aci/framework.rego"))); free(buffer); if (r.status != Ok) - goto error; + goto error; printf("Loaded package %s\n", r.output); regorus_result_drop(r); r = regorus_engine_add_policy(engine, "api.rego", (buffer = file_to_string("../../../tests/aci/api.rego"))); free(buffer); if (r.status != Ok) - goto error; + goto error; printf("Loaded package %s\n", r.output); regorus_result_drop(r); r = regorus_engine_add_policy(engine, "policy.rego", (buffer = file_to_string("../../../tests/aci/policy.rego"))); free(buffer); if (r.status != Ok) - goto error; + goto error; printf("Loaded package %s\n", r.output); regorus_result_drop(r); @@ -72,26 +102,25 @@ int main() { r = regorus_engine_add_data_json(engine, (buffer = file_to_string("../../../tests/aci/data.json"))); free(buffer); if (r.status != Ok) - goto error; + goto error; regorus_result_drop(r); // Set input r = regorus_engine_set_input_json(engine, (buffer = file_to_string("../../../tests/aci/input.json"))); free(buffer); if (r.status != Ok) - goto error; + goto error; regorus_result_drop(r); // Eval rule. r = regorus_engine_eval_rule(engine, "data.framework.mount_overlay"); if (r.status != Ok) - goto error; + goto error; // Print output printf("%s", r.output); regorus_result_drop(r); - // Free the engine. regorus_engine_drop(engine); diff --git a/bindings/ffi/Cargo.lock b/bindings/ffi/Cargo.lock index 94ed006..8cdd0ba 100644 --- a/bindings/ffi/Cargo.lock +++ b/bindings/ffi/Cargo.lock @@ -66,22 +66,22 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.60.2", + "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.10" +version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.60.2", + "windows-sys", ] [[package]] @@ -172,9 +172,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.44" +version = "1.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37521ac7aabe3d13122dc382493e20c9416f299d2ccd5b3a5340a2570cdeb0f3" +checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36" dependencies = [ "find-msvc-tools", "shlex", @@ -211,18 +211,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.51" +version = "4.5.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5" +checksum = "aa8120877db0e5c011242f96806ce3c94e0737ab8108532a76a3300a01db2ab8" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.51" +version = "4.5.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a" +checksum = "02576b399397b659c26064fbc92a75fede9d18ffd5f80ca1cd74ddab167016e1" dependencies = [ "anstream", "anstyle", @@ -307,7 +307,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys", ] [[package]] @@ -329,9 +329,9 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "find-msvc-tools" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" [[package]] name = "fluent-uri" @@ -836,9 +836,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.41" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] @@ -983,6 +983,7 @@ version = "0.5.0" dependencies = [ "anyhow", "cbindgen", + "parking_lot", "regorus", "serde_json", ] @@ -997,7 +998,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys", ] [[package]] @@ -1127,9 +1128,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.108" +version = "2.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" dependencies = [ "proc-macro2", "quote", @@ -1157,7 +1158,7 @@ dependencies = [ "getrandom", "once_cell", "rustix", - "windows-sys 0.61.2", + "windows-sys", ] [[package]] @@ -1415,15 +1416,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-sys" version = "0.61.2" @@ -1433,71 +1425,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "windows-targets" -version = "0.53.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" -dependencies = [ - "windows-link", - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" - [[package]] name = "winnow" version = "0.7.13" diff --git a/bindings/ffi/Cargo.toml b/bindings/ffi/Cargo.toml index dc6f933..c89ff5b 100644 --- a/bindings/ffi/Cargo.toml +++ b/bindings/ffi/Cargo.toml @@ -13,6 +13,7 @@ crate-type = ["cdylib", "staticlib"] anyhow = "1.0" regorus = { path = "../..", default-features = false } serde_json = "1.0.140" +parking_lot = { version = "0.12", optional = true } [profile.release] # Enable full debug info for optimized builds. @@ -23,11 +24,12 @@ lto = true codegen-units = 1 [features] -default = ["ast", "azure_policy", "std", "coverage", "regorus/arc", "regorus/full-opa"] +default = ["ast", "azure_policy", "std", "coverage", "regorus/arc", "regorus/full-opa", "contention_checks"] ast = ["regorus/ast"] azure_policy = ["regorus/azure_policy"] std = ["regorus/std"] coverage = ["regorus/coverage"] +contention_checks = ["parking_lot"] custom_allocator = [] [build-dependencies] diff --git a/bindings/ffi/src/allocator.rs b/bindings/ffi/src/allocator.rs index b19cd82..64f90cf 100644 --- a/bindings/ffi/src/allocator.rs +++ b/bindings/ffi/src/allocator.rs @@ -9,7 +9,7 @@ extern "C" { #[cfg(feature = "custom_allocator")] mod allocator { - use std::alloc::{GlobalAlloc, Layout}; + use core::alloc::{GlobalAlloc, Layout}; struct RegorusAllocator {} diff --git a/bindings/ffi/src/common.rs b/bindings/ffi/src/common.rs index e48b3e8..2fe9b9a 100644 --- a/bindings/ffi/src/common.rs +++ b/bindings/ffi/src/common.rs @@ -1,9 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +use alloc::ffi::CString; +use alloc::format; +use alloc::string::{String, ToString}; use anyhow::{anyhow, bail, Result}; -use std::ffi::{CStr, CString}; -use std::os::raw::{c_char, c_longlong}; +use core::ffi::{c_char, c_longlong, c_void, CStr}; +use core::ptr; /// Status of a call on `RegorusEngine`. #[repr(C)] @@ -74,7 +77,7 @@ pub struct RegorusResult { /// Pointer value. /// Valid when data_type is Pointer. - pub(crate) pointer_value: *mut std::os::raw::c_void, + pub(crate) pointer_value: *mut c_void, /// Errors produced by the call. /// Owned by Rust. @@ -87,11 +90,11 @@ impl RegorusResult { Self { status: RegorusStatus::Ok, data_type: RegorusDataType::None, - output: std::ptr::null_mut(), + output: ptr::null_mut(), bool_value: false, int_value: 0, - pointer_value: std::ptr::null_mut(), - error_message: std::ptr::null_mut(), + pointer_value: ptr::null_mut(), + error_message: ptr::null_mut(), } } @@ -103,8 +106,8 @@ impl RegorusResult { output: to_c_str(output), bool_value: false, int_value: 0, - pointer_value: std::ptr::null_mut(), - error_message: std::ptr::null_mut(), + pointer_value: ptr::null_mut(), + error_message: ptr::null_mut(), } } @@ -114,11 +117,11 @@ impl RegorusResult { Self { status: RegorusStatus::Ok, data_type: RegorusDataType::Boolean, - output: std::ptr::null_mut(), + output: ptr::null_mut(), bool_value: value, int_value: 0, - pointer_value: std::ptr::null_mut(), - error_message: std::ptr::null_mut(), + pointer_value: ptr::null_mut(), + error_message: ptr::null_mut(), } } @@ -128,24 +131,24 @@ impl RegorusResult { Self { status: RegorusStatus::Ok, data_type: RegorusDataType::Integer, - output: std::ptr::null_mut(), + output: ptr::null_mut(), bool_value: false, int_value: value as c_longlong, - pointer_value: std::ptr::null_mut(), - error_message: std::ptr::null_mut(), + pointer_value: ptr::null_mut(), + error_message: ptr::null_mut(), } } /// Create a successful result with pointer value. - pub(crate) fn ok_pointer(pointer: *mut std::os::raw::c_void) -> Self { + pub(crate) fn ok_pointer(pointer: *mut c_void) -> Self { Self { status: RegorusStatus::Ok, data_type: RegorusDataType::Pointer, - output: std::ptr::null_mut(), + output: ptr::null_mut(), bool_value: false, int_value: 0, pointer_value: pointer, - error_message: std::ptr::null_mut(), + error_message: ptr::null_mut(), } } @@ -154,11 +157,11 @@ impl RegorusResult { Self { status, data_type: RegorusDataType::None, - output: std::ptr::null_mut(), + output: ptr::null_mut(), bool_value: false, int_value: 0, - pointer_value: std::ptr::null_mut(), - error_message: std::ptr::null_mut(), + pointer_value: ptr::null_mut(), + error_message: ptr::null_mut(), } } @@ -167,10 +170,10 @@ impl RegorusResult { Self { status, data_type: RegorusDataType::None, - output: std::ptr::null_mut(), + output: ptr::null_mut(), bool_value: false, int_value: 0, - pointer_value: std::ptr::null_mut(), + pointer_value: ptr::null_mut(), error_message: to_c_str(message), } } diff --git a/bindings/ffi/src/compile.rs b/bindings/ffi/src/compile.rs index 9d7f672..c175d00 100644 --- a/bindings/ffi/src/compile.rs +++ b/bindings/ffi/src/compile.rs @@ -2,13 +2,15 @@ // Licensed under the MIT License. use crate::common::{from_c_str, RegorusResult, RegorusStatus}; use crate::compiled_policy::RegorusCompiledPolicy; +use alloc::boxed::Box; +use alloc::format; +use alloc::vec::Vec; +use core::ffi::{c_char, c_void}; use regorus::{compile_policy_with_entrypoint, PolicyModule, Value}; #[cfg(feature = "azure_policy")] use regorus::compile_policy_for_target; -use std::os::raw::c_char; - /// FFI wrapper for PolicyModule struct. #[repr(C)] pub struct RegorusPolicyModule { @@ -83,7 +85,7 @@ pub extern "C" fn regorus_compile_policy_with_entrypoint( Ok(compiled_policy) => { let wrapped_policy = RegorusCompiledPolicy { compiled_policy }; let boxed_policy = Box::new(wrapped_policy); - RegorusResult::ok_pointer(Box::into_raw(boxed_policy) as *mut std::os::raw::c_void) + RegorusResult::ok_pointer(Box::into_raw(boxed_policy) as *mut c_void) } Err(e) => RegorusResult::err_with_message( RegorusStatus::CompilationFailed, @@ -152,7 +154,7 @@ pub extern "C" fn regorus_compile_policy_for_target( Ok(compiled_policy) => { let wrapped_policy = RegorusCompiledPolicy { compiled_policy }; let boxed_policy = Box::new(wrapped_policy); - RegorusResult::ok_pointer(Box::into_raw(boxed_policy) as *mut std::os::raw::c_void) + RegorusResult::ok_pointer(Box::into_raw(boxed_policy) as *mut c_void) } Err(e) => RegorusResult::err_with_message( RegorusStatus::CompilationFailed, @@ -184,7 +186,7 @@ fn convert_c_modules_to_rust( let id = match from_c_str(module_ref.id) { Ok(s) => s, Err(e) => { - eprintln!("Invalid module ID at index {}: {}", i, e); + report_module_error(i, "module ID", &e); return Err(RegorusStatus::InvalidModuleId); } }; @@ -192,7 +194,7 @@ fn convert_c_modules_to_rust( let content = match from_c_str(module_ref.content) { Ok(s) => s, Err(e) => { - eprintln!("Invalid module content at index {}: {}", i, e); + report_module_error(i, "module content", &e); return Err(RegorusStatus::InvalidPolicy); } }; @@ -206,3 +208,11 @@ fn convert_c_modules_to_rust( Ok(policy_modules) } + +#[cfg(feature = "std")] +fn report_module_error(index: usize, kind: &str, err: &anyhow::Error) { + eprintln!("Invalid {} at index {}: {}", kind, index, err); +} + +#[cfg(not(feature = "std"))] +fn report_module_error(_index: usize, _kind: &str, _err: &anyhow::Error) {} diff --git a/bindings/ffi/src/compiled_policy.rs b/bindings/ffi/src/compiled_policy.rs index 20aff13..8600535 100644 --- a/bindings/ffi/src/compiled_policy.rs +++ b/bindings/ffi/src/compiled_policy.rs @@ -2,8 +2,11 @@ // Licensed under the MIT License. use crate::common::*; +use alloc::boxed::Box; +use alloc::string::String; use anyhow::Result; -use std::os::raw::c_char; +use core::ffi::c_char; +use core::ptr; /// Wrapper for `regorus::CompiledPolicy`. #[derive(Clone)] @@ -16,7 +19,7 @@ pub struct RegorusCompiledPolicy { pub extern "C" fn regorus_compiled_policy_drop(compiled_policy: *mut RegorusCompiledPolicy) { if let Ok(cp) = to_ref(compiled_policy) { unsafe { - let _ = Box::from_raw(std::ptr::from_mut(cp)); + let _ = Box::from_raw(ptr::from_mut(cp)); } } } diff --git a/bindings/ffi/src/engine.rs b/bindings/ffi/src/engine.rs index 864e75f..8fc09f7 100644 --- a/bindings/ffi/src/engine.rs +++ b/bindings/ffi/src/engine.rs @@ -5,13 +5,66 @@ use crate::common::{ from_c_str, to_ref, to_regorus_result, to_regorus_string_result, RegorusResult, RegorusStatus, }; use crate::compiled_policy::RegorusCompiledPolicy; -use anyhow::Result; -use std::os::raw::c_char; +use crate::lock::{new_handle, read, try_read, try_write, Handle, ReadGuard, WriteGuard}; +use alloc::boxed::Box; +use alloc::format; +use alloc::string::String; +use anyhow::{anyhow, Result}; +use core::ffi::{c_char, c_void}; +use core::ptr; /// Wrapper for `regorus::Engine`. -#[derive(Clone)] pub struct RegorusEngine { - engine: ::regorus::Engine, + engine: Handle<::regorus::Engine>, +} + +impl RegorusEngine { + fn new(engine: ::regorus::Engine) -> Self { + Self { + engine: new_handle(engine), + } + } + + fn contention_error() -> anyhow::Error { + anyhow!( + "regorus engine handle is already in use; clone the engine before sharing across threads" + ) + } + + fn try_write(&self) -> Result> { + try_write(&self.engine).ok_or_else(Self::contention_error) + } + + fn try_read(&self) -> Result> { + try_read(&self.engine).ok_or_else(Self::contention_error) + } +} + +impl Clone for RegorusEngine { + fn clone(&self) -> Self { + let guard = read(&self.engine); + Self::new((*guard).clone()) + } +} + +#[cfg(all(test, feature = "contention_checks", feature = "std"))] +mod tests { + use super::RegorusEngine; + + #[test] + fn detects_handle_contention() { + let engine = RegorusEngine::new(::regorus::Engine::new()); + + let _first_guard = engine.try_write().expect("initial lock should succeed"); + let err = engine + .try_write() + .expect_err("contention detection must reject the second lock"); + + assert!( + err.to_string().contains("engine handle is already in use"), + "unexpected error message: {err}" + ); + } } #[no_mangle] @@ -25,7 +78,7 @@ pub extern "C" fn regorus_engine_new() -> *mut RegorusEngine { // instead of raising errors in certain failure scenarios. engine.set_strict_builtin_errors(false); - Box::into_raw(Box::new(RegorusEngine { engine })) + Box::into_raw(Box::new(RegorusEngine::new(engine))) } /// Clone a [`RegorusEngine`] @@ -37,7 +90,7 @@ pub extern "C" fn regorus_engine_new() -> *mut RegorusEngine { pub extern "C" fn regorus_engine_clone(engine: *mut RegorusEngine) -> *mut RegorusEngine { match to_ref(engine) { Ok(e) => Box::into_raw(Box::new(e.clone())), - _ => std::ptr::null_mut(), + _ => ptr::null_mut(), } } @@ -45,7 +98,7 @@ pub extern "C" fn regorus_engine_clone(engine: *mut RegorusEngine) -> *mut Regor pub extern "C" fn regorus_engine_drop(engine: *mut RegorusEngine) { if let Ok(e) = to_ref(engine) { unsafe { - let _ = Box::from_raw(std::ptr::from_mut(e)); + let _ = Box::from_raw(ptr::from_mut(e)); } } } @@ -64,9 +117,9 @@ pub extern "C" fn regorus_engine_add_policy( rego: *const c_char, ) -> RegorusResult { to_regorus_string_result(|| -> Result { - to_ref(engine)? - .engine - .add_policy(from_c_str(path)?, from_c_str(rego)?) + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + guard.add_policy(from_c_str(path)?, from_c_str(rego)?) }()) } @@ -77,9 +130,9 @@ pub extern "C" fn regorus_engine_add_policy_from_file( path: *const c_char, ) -> RegorusResult { to_regorus_string_result(|| -> Result { - to_ref(engine)? - .engine - .add_policy_from_file(from_c_str(path)?) + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + guard.add_policy_from_file(from_c_str(path)?) }()) } @@ -93,9 +146,9 @@ pub extern "C" fn regorus_engine_add_data_json( data: *const c_char, ) -> RegorusResult { to_regorus_result(|| -> Result<()> { - to_ref(engine)? - .engine - .add_data(regorus::Value::from_json_str(&from_c_str(data)?)?) + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + guard.add_data(regorus::Value::from_json_str(&from_c_str(data)?)?) }()) } @@ -105,8 +158,9 @@ pub extern "C" fn regorus_engine_add_data_json( #[no_mangle] pub extern "C" fn regorus_engine_get_packages(engine: *mut RegorusEngine) -> RegorusResult { to_regorus_string_result(|| -> Result { - serde_json::to_string_pretty(&to_ref(engine)?.engine.get_packages()?) - .map_err(anyhow::Error::msg) + let engine = to_ref(engine)?; + let guard = engine.try_read()?; + serde_json::to_string_pretty(&guard.get_packages()?).map_err(anyhow::Error::msg) }()) } @@ -116,7 +170,9 @@ pub extern "C" fn regorus_engine_get_packages(engine: *mut RegorusEngine) -> Reg #[no_mangle] pub extern "C" fn regorus_engine_get_policies(engine: *mut RegorusEngine) -> RegorusResult { to_regorus_string_result(|| -> Result { - to_ref(engine)?.engine.get_policies_as_json() + let engine = to_ref(engine)?; + let guard = engine.try_read()?; + guard.get_policies_as_json() }()) } @@ -127,9 +183,9 @@ pub extern "C" fn regorus_engine_add_data_from_json_file( path: *const c_char, ) -> RegorusResult { to_regorus_result(|| -> Result<()> { - to_ref(engine)? - .engine - .add_data(regorus::Value::from_json_file(from_c_str(path)?)?) + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + guard.add_data(regorus::Value::from_json_file(from_c_str(path)?)?) }()) } @@ -139,7 +195,9 @@ pub extern "C" fn regorus_engine_add_data_from_json_file( #[no_mangle] pub extern "C" fn regorus_engine_clear_data(engine: *mut RegorusEngine) -> RegorusResult { to_regorus_result(|| -> Result<()> { - to_ref(engine)?.engine.clear_data(); + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + guard.clear_data(); Ok(()) }()) } @@ -154,9 +212,9 @@ pub extern "C" fn regorus_engine_set_input_json( input: *const c_char, ) -> RegorusResult { to_regorus_result(|| -> Result<()> { - to_ref(engine)? - .engine - .set_input(regorus::Value::from_json_str(&from_c_str(input)?)?); + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + guard.set_input(regorus::Value::from_json_str(&from_c_str(input)?)?); Ok(()) }()) } @@ -168,9 +226,9 @@ pub extern "C" fn regorus_engine_set_input_from_json_file( path: *const c_char, ) -> RegorusResult { to_regorus_result(|| -> Result<()> { - to_ref(engine)? - .engine - .set_input(regorus::Value::from_json_file(from_c_str(path)?)?); + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + guard.set_input(regorus::Value::from_json_file(from_c_str(path)?)?); Ok(()) }()) } @@ -185,9 +243,9 @@ pub extern "C" fn regorus_engine_eval_query( query: *const c_char, ) -> RegorusResult { let output = || -> Result { - let results = to_ref(engine)? - .engine - .eval_query(from_c_str(query)?, false)?; + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + let results = guard.eval_query(from_c_str(query)?, false)?; Ok(serde_json::to_string_pretty(&results)?) }(); match output { @@ -206,10 +264,9 @@ pub extern "C" fn regorus_engine_eval_rule( rule: *const c_char, ) -> RegorusResult { let output = || -> Result { - to_ref(engine)? - .engine - .eval_rule(from_c_str(rule)?)? - .to_json_str() + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + guard.eval_rule(from_c_str(rule)?)?.to_json_str() }(); match output { Ok(out) => RegorusResult::ok_string(out), @@ -228,7 +285,9 @@ pub extern "C" fn regorus_engine_set_enable_coverage( enable: bool, ) -> RegorusResult { to_regorus_result(|| -> Result<()> { - to_ref(engine)?.engine.set_enable_coverage(enable); + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + guard.set_enable_coverage(enable); Ok(()) }()) } @@ -240,9 +299,9 @@ pub extern "C" fn regorus_engine_set_enable_coverage( #[cfg(feature = "coverage")] pub extern "C" fn regorus_engine_get_coverage_report(engine: *mut RegorusEngine) -> RegorusResult { let output = || -> Result { - Ok(serde_json::to_string_pretty( - &to_ref(engine)?.engine.get_coverage_report()?, - )?) + let engine = to_ref(engine)?; + let guard = engine.try_read()?; + Ok(serde_json::to_string_pretty(&guard.get_coverage_report()?)?) }(); match output { Ok(out) => RegorusResult::ok_string(out), @@ -260,7 +319,9 @@ pub extern "C" fn regorus_engine_set_strict_builtin_errors( strict: bool, ) -> RegorusResult { to_regorus_result(|| -> Result<()> { - to_ref(engine)?.engine.set_strict_builtin_errors(strict); + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + guard.set_strict_builtin_errors(strict); Ok(()) }()) } @@ -274,10 +335,9 @@ pub extern "C" fn regorus_engine_get_coverage_report_pretty( engine: *mut RegorusEngine, ) -> RegorusResult { let output = || -> Result { - to_ref(engine)? - .engine - .get_coverage_report()? - .to_string_pretty() + let engine = to_ref(engine)?; + let guard = engine.try_read()?; + guard.get_coverage_report()?.to_string_pretty() }(); match output { Ok(out) => RegorusResult::ok_string(out), @@ -292,7 +352,9 @@ pub extern "C" fn regorus_engine_get_coverage_report_pretty( #[cfg(feature = "coverage")] pub extern "C" fn regorus_engine_clear_coverage_data(engine: *mut RegorusEngine) -> RegorusResult { to_regorus_result(|| -> Result<()> { - to_ref(engine)?.engine.clear_coverage_data(); + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + guard.clear_coverage_data(); Ok(()) }()) } @@ -307,7 +369,9 @@ pub extern "C" fn regorus_engine_set_gather_prints( enable: bool, ) -> RegorusResult { to_regorus_result(|| -> Result<()> { - to_ref(engine)?.engine.set_gather_prints(enable); + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + guard.set_gather_prints(enable); Ok(()) }()) } @@ -318,9 +382,9 @@ pub extern "C" fn regorus_engine_set_gather_prints( #[no_mangle] pub extern "C" fn regorus_engine_take_prints(engine: *mut RegorusEngine) -> RegorusResult { let output = || -> Result { - Ok(serde_json::to_string_pretty( - &to_ref(engine)?.engine.take_prints()?, - )?) + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + Ok(serde_json::to_string_pretty(&guard.take_prints()?)?) }(); match output { Ok(out) => RegorusResult::ok_string(out), @@ -334,7 +398,11 @@ pub extern "C" fn regorus_engine_take_prints(engine: *mut RegorusEngine) -> Rego #[no_mangle] #[cfg(feature = "ast")] pub extern "C" fn regorus_engine_get_ast_as_json(engine: *mut RegorusEngine) -> RegorusResult { - let output = || -> Result { to_ref(engine)?.engine.get_ast_as_json() }(); + let output = || -> Result { + let engine = to_ref(engine)?; + let guard = engine.try_read()?; + guard.get_ast_as_json() + }(); match output { Ok(out) => RegorusResult::ok_string(out), Err(e) => to_regorus_result(Err(e)), @@ -350,8 +418,9 @@ pub extern "C" fn regorus_engine_get_policy_package_names( engine: *mut RegorusEngine, ) -> RegorusResult { let output = || -> Result { - serde_json::to_string_pretty(&to_ref(engine)?.engine.get_policy_package_names()?) - .map_err(anyhow::Error::msg) + let engine = to_ref(engine)?; + let guard = engine.try_read()?; + serde_json::to_string_pretty(&guard.get_policy_package_names()?).map_err(anyhow::Error::msg) }(); match output { Ok(out) => RegorusResult::ok_string(out), @@ -368,8 +437,9 @@ pub extern "C" fn regorus_engine_get_policy_parameters( engine: *mut RegorusEngine, ) -> RegorusResult { let output = || -> Result { - serde_json::to_string_pretty(&to_ref(engine)?.engine.get_policy_parameters()?) - .map_err(anyhow::Error::msg) + let engine = to_ref(engine)?; + let guard = engine.try_read()?; + serde_json::to_string_pretty(&guard.get_policy_parameters()?).map_err(anyhow::Error::msg) }(); match output { Ok(out) => RegorusResult::ok_string(out), @@ -386,7 +456,9 @@ pub extern "C" fn regorus_engine_set_rego_v0( enable: bool, ) -> RegorusResult { let output = || -> Result<()> { - to_ref(engine)?.engine.set_rego_v0(enable); + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + guard.set_rego_v0(enable); Ok(()) }(); match output { @@ -404,21 +476,35 @@ pub extern "C" fn regorus_engine_set_rego_v0( #[no_mangle] #[cfg(feature = "azure_policy")] pub extern "C" fn regorus_engine_compile_for_target(engine: *mut RegorusEngine) -> RegorusResult { - match to_ref(engine) { - Ok(e) => match e.engine.compile_for_target() { - Ok(compiled_policy) => { - let wrapped_policy = RegorusCompiledPolicy { compiled_policy }; - let boxed_policy = Box::new(wrapped_policy); - RegorusResult::ok_pointer(Box::into_raw(boxed_policy) as *mut std::os::raw::c_void) - } - Err(e) => RegorusResult::err_with_message( - RegorusStatus::CompilationFailed, - format!("Failed to compile for target: {e}"), - ), - }, + let engine = match to_ref(engine) { + Ok(engine) => engine, + Err(e) => { + return RegorusResult::err_with_message( + RegorusStatus::InvalidArgument, + format!("Failed to get engine reference: {e}"), + ) + } + }; + + let mut guard = match engine.try_write() { + Ok(guard) => guard, + Err(e) => { + return RegorusResult::err_with_message( + RegorusStatus::Error, + format!("Failed to lock engine: {e}"), + ) + } + }; + + match guard.compile_for_target() { + Ok(compiled_policy) => { + let wrapped_policy = RegorusCompiledPolicy { compiled_policy }; + let boxed_policy = Box::new(wrapped_policy); + RegorusResult::ok_pointer(Box::into_raw(boxed_policy) as *mut c_void) + } Err(e) => RegorusResult::err_with_message( - RegorusStatus::InvalidArgument, - format!("Failed to get engine reference: {e}"), + RegorusStatus::CompilationFailed, + format!("Failed to compile for target: {e}"), ), } } @@ -437,14 +523,16 @@ pub extern "C" fn regorus_engine_compile_with_entrypoint( let result = || -> Result { let rule_str = from_c_str(rule)?; let rule_rc: regorus::Rc = rule_str.into(); - let compiled_policy = to_ref(engine)?.engine.compile_with_entrypoint(&rule_rc)?; + let engine = to_ref(engine)?; + let mut guard = engine.try_write()?; + let compiled_policy = guard.compile_with_entrypoint(&rule_rc)?; Ok(RegorusCompiledPolicy { compiled_policy }) }(); match result { Ok(wrapped_policy) => { let boxed_policy = Box::new(wrapped_policy); - RegorusResult::ok_pointer(Box::into_raw(boxed_policy) as *mut std::os::raw::c_void) + RegorusResult::ok_pointer(Box::into_raw(boxed_policy) as *mut c_void) } Err(e) => RegorusResult::err_with_message( RegorusStatus::CompilationFailed, diff --git a/bindings/ffi/src/lib.rs b/bindings/ffi/src/lib.rs index 6227392..0b4eb82 100644 --- a/bindings/ffi/src/lib.rs +++ b/bindings/ffi/src/lib.rs @@ -1,11 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![cfg_attr(not(feature = "std"), no_std)] + +extern crate alloc; + mod allocator; mod common; mod compile; mod compiled_policy; mod effect_registry; mod engine; +mod lock; mod schema_registry; mod target_registry; diff --git a/bindings/ffi/src/lock.rs b/bindings/ffi/src/lock.rs new file mode 100644 index 0000000..1383c26 --- /dev/null +++ b/bindings/ffi/src/lock.rs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +//! Abstractions over synchronization primitives used by the FFI layer. +//! +//! For `std` builds we rely on `parking_lot::RwLock` so we can detect +//! contention across threads. For `no_std` builds we fall back to +//! `RefCell`, which still lets us detect aliasing within a single thread. + +#[cfg(not(feature = "std"))] +extern crate alloc; + +#[cfg(all(feature = "std", feature = "contention_checks"))] +mod locking { + use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard}; + use std::sync::Arc; + + pub(crate) type Handle = Arc>; + pub(crate) type ReadGuard<'a, T> = RwLockReadGuard<'a, T>; + pub(crate) type WriteGuard<'a, T> = RwLockWriteGuard<'a, T>; + + #[inline] + pub(crate) fn new_handle(value: T) -> Handle { + Arc::new(RwLock::new(value)) + } + + #[inline] + pub(crate) fn try_write<'a, T>(handle: &'a Handle) -> Option> { + handle.try_write() + } + + #[inline] + pub(crate) fn try_read<'a, T>(handle: &'a Handle) -> Option> { + handle.try_read() + } + + #[inline] + pub(crate) fn read<'a, T>(handle: &'a Handle) -> ReadGuard<'a, T> { + handle.read() + } +} + +#[cfg(all(feature = "std", not(feature = "contention_checks")))] +mod locking { + use std::cell::{Ref, RefCell, RefMut}; + use std::rc::Rc; + + pub(crate) type Handle = Rc>; + pub(crate) type ReadGuard<'a, T> = Ref<'a, T>; + pub(crate) type WriteGuard<'a, T> = RefMut<'a, T>; + + #[inline] + pub(crate) fn new_handle(value: T) -> Handle { + Rc::new(RefCell::new(value)) + } + + #[inline] + pub(crate) fn try_write<'a, T>(handle: &'a Handle) -> Option> { + handle.try_borrow_mut().ok() + } + + #[inline] + pub(crate) fn try_read<'a, T>(handle: &'a Handle) -> Option> { + handle.try_borrow().ok() + } + + #[inline] + pub(crate) fn read<'a, T>(handle: &'a Handle) -> ReadGuard<'a, T> { + handle.borrow() + } +} + +#[cfg(not(feature = "std"))] +mod locking { + use alloc::rc::Rc; + use core::cell::{Ref, RefCell, RefMut}; + + pub(crate) type Handle = Rc>; + pub(crate) type ReadGuard<'a, T> = Ref<'a, T>; + pub(crate) type WriteGuard<'a, T> = RefMut<'a, T>; + + #[inline] + pub(crate) fn new_handle(value: T) -> Handle { + Rc::new(RefCell::new(value)) + } + + #[inline] + pub(crate) fn try_write<'a, T>(handle: &'a Handle) -> Option> { + handle.try_borrow_mut().ok() + } + + #[inline] + pub(crate) fn try_read<'a, T>(handle: &'a Handle) -> Option> { + handle.try_borrow().ok() + } + + #[inline] + pub(crate) fn read<'a, T>(handle: &'a Handle) -> ReadGuard<'a, T> { + handle.borrow() + } +} + +pub(crate) use locking::{new_handle, read, try_read, try_write, Handle, ReadGuard, WriteGuard}; diff --git a/bindings/java/Cargo.lock b/bindings/java/Cargo.lock index 2c7d819..719cc58 100644 --- a/bindings/java/Cargo.lock +++ b/bindings/java/Cargo.lock @@ -103,15 +103,15 @@ checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" [[package]] name = "bytes" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" +checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" [[package]] name = "cc" -version = "1.2.44" +version = "1.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37521ac7aabe3d13122dc382493e20c9416f299d2ccd5b3a5340a2570cdeb0f3" +checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36" dependencies = [ "find-msvc-tools", "shlex", @@ -213,9 +213,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" [[package]] name = "fluent-uri" @@ -712,9 +712,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.41" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] @@ -983,9 +983,9 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "syn" -version = "2.0.108" +version = "2.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" dependencies = [ "proc-macro2", "quote", diff --git a/bindings/python/Cargo.lock b/bindings/python/Cargo.lock index 7211506..bd3e62a 100644 --- a/bindings/python/Cargo.lock +++ b/bindings/python/Cargo.lock @@ -103,9 +103,9 @@ checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" [[package]] name = "cc" -version = "1.2.44" +version = "1.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37521ac7aabe3d13122dc382493e20c9416f299d2ccd5b3a5340a2570cdeb0f3" +checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36" dependencies = [ "find-msvc-tools", "shlex", @@ -191,9 +191,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" [[package]] name = "fluent-uri" @@ -771,9 +771,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.41" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] @@ -1034,9 +1034,9 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "syn" -version = "2.0.108" +version = "2.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" dependencies = [ "proc-macro2", "quote", diff --git a/bindings/ruby/Cargo.lock b/bindings/ruby/Cargo.lock index c7ff16c..94d9090 100644 --- a/bindings/ruby/Cargo.lock +++ b/bindings/ruby/Cargo.lock @@ -18,19 +18,13 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - [[package]] name = "android_system_properties" version = "0.1.5" @@ -42,9 +36,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.99" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" [[package]] name = "autocfg" @@ -95,21 +89,21 @@ checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitflags" -version = "2.9.3" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" [[package]] name = "borrow-or-share" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eeab4423108c5d7c744f4d234de88d18d636100093ae04caf4825134b9c3a32" +checksum = "dc0b364ead1874514c8c2855ab558056ebfeb775653e7ae45ff72f28f8f3166c" [[package]] name = "bstr" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4" +checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab" dependencies = [ "memchr", "serde", @@ -129,10 +123,11 @@ checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" [[package]] name = "cc" -version = "1.2.34" +version = "1.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42bc4aea80032b7bf409b0bc7ccad88853858911b7713a8062fdc0623867bedc" +checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36" dependencies = [ + "find-msvc-tools", "shlex", ] @@ -147,17 +142,16 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "chrono" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" dependencies = [ - "android-tzdata", "iana-time-zone", "js-sys", "num-traits", @@ -241,6 +235,12 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" + [[package]] name = "fluent-uri" version = "0.3.2" @@ -273,14 +273,14 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "libc", "r-efi", - "wasi", + "wasip2", ] [[package]] @@ -291,9 +291,9 @@ checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "globset" -version = "0.4.16" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a1028dfc5f5df5da8a56a73e6c153c9a9708ec57232470703592a3f18e49f5" +checksum = "52dfc19153a48bde0cbd630453615c8151bce3a5adfac7a0aebfbf0a1e1f57e3" dependencies = [ "aho-corasick", "bstr", @@ -303,15 +303,15 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.5" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" [[package]] name = "iana-time-zone" -version = "0.1.63" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -333,9 +333,9 @@ dependencies = [ [[package]] name = "icu_collections" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" dependencies = [ "displaydoc", "potential_utf", @@ -346,9 +346,9 @@ dependencies = [ [[package]] name = "icu_locale_core" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" dependencies = [ "displaydoc", "litemap", @@ -359,11 +359,10 @@ dependencies = [ [[package]] name = "icu_normalizer" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" dependencies = [ - "displaydoc", "icu_collections", "icu_normalizer_data", "icu_properties", @@ -374,42 +373,38 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" [[package]] name = "icu_properties" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" dependencies = [ - "displaydoc", "icu_collections", "icu_locale_core", "icu_properties_data", "icu_provider", - "potential_utf", "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" +checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" [[package]] name = "icu_provider" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" dependencies = [ "displaydoc", "icu_locale_core", - "stable_deref_trait", - "tinystr", "writeable", "yoke", "zerofrom", @@ -440,9 +435,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.10.0" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" dependencies = [ "equivalent", "hashbrown", @@ -471,9 +466,9 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" -version = "0.3.77" +version = "0.3.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" dependencies = [ "once_cell", "wasm-bindgen", @@ -519,41 +514,40 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.175" +version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "libloading" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "windows-targets 0.53.3", + "windows-link", ] [[package]] name = "litemap" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" [[package]] name = "lock_api" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ - "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.27" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" [[package]] name = "magnus" @@ -580,9 +574,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.5" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "mimalloc" @@ -716,9 +710,9 @@ checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e" [[package]] name = "parking_lot" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", "parking_lot_core", @@ -726,15 +720,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.11" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.6", + "windows-link", ] [[package]] @@ -763,9 +757,9 @@ dependencies = [ [[package]] name = "potential_utf" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" dependencies = [ "zerovec", ] @@ -781,18 +775,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.101" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.40" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] @@ -864,27 +858,27 @@ checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb" [[package]] name = "redox_syscall" -version = "0.5.17" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ "bitflags", ] [[package]] name = "ref-cast" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" dependencies = [ "proc-macro2", "quote", @@ -907,9 +901,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", @@ -919,9 +913,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -930,9 +924,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "regorus" @@ -993,20 +987,6 @@ name = "scientific" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38a4b339a8de779ecb098a772ecbba2ace74e23ed959a5b4f30631d8bf1799a8" -dependencies = [ - "scientific-macro", -] - -[[package]] -name = "scientific-macro" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ee4885492bb655bfa05d039cd9163eb8fe9f79ddebf00ca23a1637510c2fd2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] [[package]] name = "scopeguard" @@ -1016,9 +996,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "semver" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" [[package]] name = "seq-macro" @@ -1028,18 +1008,28 @@ checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -1048,14 +1038,15 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.143" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" dependencies = [ "itoa", "memchr", "ryu", "serde", + "serde_core", ] [[package]] @@ -1108,15 +1099,15 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "stable_deref_trait" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "syn" -version = "2.0.106" +version = "2.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" dependencies = [ "proc-macro2", "quote", @@ -1142,18 +1133,18 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "thiserror" -version = "2.0.16" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.16" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", @@ -1162,9 +1153,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" dependencies = [ "displaydoc", "zerovec", @@ -1172,9 +1163,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.18" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "unsafe-libyaml" @@ -1184,13 +1175,14 @@ checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" [[package]] name = "url" -version = "2.5.6" +version = "2.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "137a3c834eaf7139b73688502f3f1141a0337c5d8e4d9b536f9b8c796e26a7c4" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] [[package]] @@ -1201,9 +1193,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "uuid" -version = "1.18.0" +version = "1.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f33196643e165781c20a5ead5582283a7dacbb87855d867fbc2df3f81eddc1be" +checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" dependencies = [ "getrandom", "js-sys", @@ -1235,45 +1227,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" [[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" +name = "wasip2" +version = "1.0.1+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" dependencies = [ - "wit-bindgen-rt", + "wit-bindgen", ] [[package]] name = "wasm-bindgen" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1281,31 +1260,31 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" dependencies = [ + "bumpalo", "proc-macro2", "quote", "syn", - "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" dependencies = [ "unicode-ident", ] [[package]] name = "windows-core" -version = "0.61.2" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", @@ -1316,9 +1295,9 @@ dependencies = [ [[package]] name = "windows-implement" -version = "0.60.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", @@ -1327,9 +1306,9 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.59.1" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", @@ -1338,179 +1317,46 @@ dependencies = [ [[package]] name = "windows-link" -version = "0.1.3" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "windows-result" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ "windows-link", ] [[package]] name = "windows-strings" -version = "0.4.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ "windows-link", ] [[package]] -name = "windows-targets" -version = "0.52.6" +name = "wit-bindgen" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.53.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" -dependencies = [ - "windows-link", - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" - -[[package]] -name = "wit-bindgen-rt" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags", -] +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" [[package]] name = "writeable" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" [[package]] name = "yoke" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" dependencies = [ - "serde", "stable_deref_trait", "yoke-derive", "zerofrom", @@ -1518,9 +1364,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", @@ -1530,18 +1376,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.26" +version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.26" +version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", @@ -1571,9 +1417,9 @@ dependencies = [ [[package]] name = "zerotrie" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" dependencies = [ "displaydoc", "yoke", @@ -1582,9 +1428,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.4" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" dependencies = [ "yoke", "zerofrom", @@ -1593,9 +1439,9 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", diff --git a/bindings/wasm/Cargo.lock b/bindings/wasm/Cargo.lock index b02f09c..7c4825a 100644 --- a/bindings/wasm/Cargo.lock +++ b/bindings/wasm/Cargo.lock @@ -103,9 +103,9 @@ checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" [[package]] name = "cc" -version = "1.2.44" +version = "1.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37521ac7aabe3d13122dc382493e20c9416f299d2ccd5b3a5340a2570cdeb0f3" +checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36" dependencies = [ "find-msvc-tools", "shlex", @@ -191,9 +191,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" [[package]] name = "fluent-uri" @@ -693,9 +693,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.41" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] @@ -967,9 +967,9 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "syn" -version = "2.0.108" +version = "2.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" dependencies = [ "proc-macro2", "quote",