From e1e61f53745f174c661d8d02e54a52b0a813d7d0 Mon Sep 17 00:00:00 2001 From: Mick Grove Date: Thu, 2 Apr 2026 23:26:36 -0700 Subject: [PATCH] updated dependencies --- Cargo.toml | 19 +++++++------- Makefile | 4 +-- crates/kingfisher-scanner/Cargo.toml | 2 -- src/main.rs | 39 +++++++++++++++++++--------- src/reporter/bson_format.rs | 6 ++--- 5 files changed, 41 insertions(+), 29 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 375924d..1a99bc4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -155,7 +155,6 @@ crossbeam-skiplist = "0.1.3" tokio-postgres = { version = "0.7", default-features = false, features = ["runtime"] } mongodb = { version = "3.4", default-features = false, features = ["rustls-tls", "aws-auth", "compat-3-0-0", "dns-resolver"] } mysql_async = { version = "0.36.2", default-features = false, features = ["default-rustls"] } -bson = { version = "3.1.0", features = ["serde"] } ring = "0.17.14" pem = "3.0.6" aws-config = { version = "1.8.14", default-features = false, features = ["default-https-client", "rt-tokio", "credentials-process", "sso"] } @@ -216,12 +215,9 @@ quick-xml = { version = "0.39.2", features = ["serde", "serialize"] } rustls = "0.23.35" tokio-postgres-rustls = "0.13.0" rustls-native-certs = "0.8.2" -predicates = "3.1.3" -assert_cmd = "2.1.1" -proptest = "1.9.0" color-backtrace = "0.7.2" gitlab = "0.1810.0" -mimalloc = {version = "0.1.48", features = ["override"]} +mimalloc = { version = "0.1.48", features = ["override"] } thread_local = "1.1.9" bloomfilter = "3.0.1" uuid = "1.19.0" @@ -271,10 +267,10 @@ version = "0.6" optional = true [features] -default = ["use-mimalloc"] -use-mimalloc = ["mimalloc/override"] -use-jemalloc = ["tikv-jemallocator"] -system-alloc = [] # forces System allocator +default = [] +use-mimalloc = [] +use-jemalloc = ["tikv-jemallocator"] +system-alloc = [] # forces System allocator [dev-dependencies] pretty_assertions = "1.4" @@ -283,6 +279,9 @@ wiremock = "0.6.5" git2 = { version = "0.20.3", default-features = false } rand_chacha = "0.10.0" testcontainers = "0.27.2" +predicates = "3.1.3" +assert_cmd = "2.1.1" +proptest = "1.9.0" [profile.release] debug = false @@ -290,7 +289,7 @@ strip = true #"debuginfo" opt-level = 3 # Maximum optimization for performance lto = true # Enable Link Time Optimization codegen-units = 1 # Optimize for size but slower compilation -# panic = "abort" # Remove unwind tables for panics +panic = "abort" # Remove unwind tables for panics rpath = false # Don't embed path dependencies incremental = false diff --git a/Makefile b/Makefile index 69218f9..4ea75e5 100644 --- a/Makefile +++ b/Makefile @@ -393,7 +393,7 @@ endif echo "WINDOWS_ONLY_DEPS=1 set; skipping cargo build and packaging."; \ exit 0; \ fi; \ - "$$CARGO_BIN" build --release --target x86_64-pc-windows-gnu --features system-alloc; \ + "$$CARGO_BIN" build --release --target x86_64-pc-windows-gnu; \ mkdir -p target/release; \ cp target/x86_64-pc-windows-gnu/release/$(PROJECT_NAME).exe target/release/$(PROJECT_NAME).exe; \ cd target/release; \ @@ -519,7 +519,7 @@ endif echo "WINDOWS_ONLY_DEPS=1 set; skipping cargo build and packaging."; \ exit 0; \ fi; \ - "$$CARGO_BIN" build --release --target aarch64-pc-windows-gnullvm --features system-alloc; \ + "$$CARGO_BIN" build --release --target aarch64-pc-windows-gnullvm; \ mkdir -p target/release; \ cp target/aarch64-pc-windows-gnullvm/release/$(PROJECT_NAME).exe target/release/$(PROJECT_NAME).exe; \ cd target/release; \ diff --git a/crates/kingfisher-scanner/Cargo.toml b/crates/kingfisher-scanner/Cargo.toml index cf24224..09521ca 100644 --- a/crates/kingfisher-scanner/Cargo.toml +++ b/crates/kingfisher-scanner/Cargo.toml @@ -81,7 +81,6 @@ validation-jwt = [ # Database validation (MongoDB/MySQL/Postgres/JDBC) validation-database = [ "validation-http", - "dep:bson", "dep:mongodb", "dep:mysql_async", "dep:tokio-postgres", @@ -171,7 +170,6 @@ p256 = { version = "0.13.2", optional = true } ed25519-dalek = { version = "2.2", features = ["pkcs8"], optional = true } hex = { workspace = true, optional = true } url = { version = "2.5.7", optional = true } -bson = { version = "3.1.0", features = ["serde"], optional = true } mongodb = { version = "3.4", default-features = false, features = ["rustls-tls", "aws-auth", "compat-3-0-0", "dns-resolver"], optional = true } mysql_async = { version = "0.36.2", default-features = false, features = ["default-rustls"], optional = true } tokio-postgres = { version = "0.7", default-features = false, features = ["runtime"], optional = true } diff --git a/src/main.rs b/src/main.rs index 769d8fe..26d3bba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,9 @@ // ──────────────────────────────────────────────────────────── // Global allocator setup -// * Default - mimalloc (no feature flags) -// * Debug - jemalloc (`use-jemalloc` feature) -// * Fallback - system allocator (`system-alloc` feature) +// * Default - mimalloc on Linux/Windows, system on Darwin/other targets +// * Opt-in - mimalloc (`use-mimalloc` feature) +// * Opt-in - jemalloc (`use-jemalloc` feature) +// * Explicit - system allocator (`system-alloc` feature) // ──────────────────────────────────────────────────────────── // --- jemalloc (opt-in) --- @@ -10,22 +11,36 @@ #[global_allocator] static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; -// --- mimalloc (default) --- -#[cfg(all(not(feature = "use-jemalloc"), not(feature = "system-alloc")))] +// --- mimalloc (default on Linux/Windows, opt-in elsewhere) --- +#[cfg(all( + not(feature = "use-jemalloc"), + not(feature = "system-alloc"), + any(feature = "use-mimalloc", target_os = "linux", target_os = "windows") +))] #[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; -// --- system allocator (explicit opt-out) --- -#[cfg(feature = "system-alloc")] +// --- system allocator (default on Darwin/other targets, explicit elsewhere) --- +#[cfg(any( + feature = "system-alloc", + all( + not(feature = "use-jemalloc"), + not(feature = "system-alloc"), + not(any(feature = "use-mimalloc", target_os = "linux", target_os = "windows")) + ) +))] use std::alloc::System; -#[cfg(feature = "system-alloc")] +#[cfg(any( + feature = "system-alloc", + all( + not(feature = "use-jemalloc"), + not(feature = "system-alloc"), + not(any(feature = "use-mimalloc", target_os = "linux", target_os = "windows")) + ) +))] #[global_allocator] static GLOBAL: System = System; -// use std::alloc::System; -// #[global_allocator] -// static GLOBAL: System = System; - use std::{ io::{IsTerminal, Read, Write}, sync::{Arc, Mutex}, diff --git a/src/reporter/bson_format.rs b/src/reporter/bson_format.rs index d72c9ab..2ea543d 100644 --- a/src/reporter/bson_format.rs +++ b/src/reporter/bson_format.rs @@ -1,4 +1,5 @@ use super::*; +use mongodb::bson; impl DetailsReporter { /// Formats findings as BSON and writes them to the provided writer. @@ -9,13 +10,12 @@ impl DetailsReporter { ) -> Result<()> { let envelope = self.build_report_envelope(args)?; for record in envelope.findings { - let doc = bson::serialize_to_document(&record)?; + let doc = bson::to_document(&record)?; doc.to_writer(&mut writer)?; } if let Some(access_map) = envelope.access_map { - let doc = - bson::serialize_to_document(&serde_json::json!({ "access_map": access_map }))?; + let doc = bson::to_document(&serde_json::json!({ "access_map": access_map }))?; doc.to_writer(&mut writer)?; } Ok(())