diff --git a/Cargo.lock b/Cargo.lock index bf90b506..529bd823 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1858,7 +1858,7 @@ checksum = "6ebaa1a2bf1290ab3bfe5a7b771d050ebffab2711c19a81691c683a5144a25de" dependencies = [ "curve25519-dalek", "ed25519", - "sha2 0.11.0", + "sha2 0.11.1", "subtle", "zeroize", ] @@ -2081,7 +2081,7 @@ dependencies = [ "headless_chrome", "hex", "hickory-resolver", - "hmac 0.12.1", + "hmac 0.13.0", "hostname", "http", "indicatif", @@ -2092,7 +2092,7 @@ dependencies = [ "libc", "lru", "maxminddb", - "md-5 0.10.6", + "md-5 0.11.0", "mongodb", "nix 0.29.0", "notify", @@ -2121,7 +2121,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml_neo", - "sha2 0.10.9", + "sha2 0.11.1", "smallvec", "socket2 0.6.5", "spdx 0.10.9", @@ -2371,7 +2371,7 @@ dependencies = [ "rustc-hash", "serde", "serde_json", - "sha2 0.10.9", + "sha2 0.11.1", "thiserror 2.0.21", "tracing", "url", @@ -2393,7 +2393,8 @@ dependencies = [ "eggsec-tool-core", "eggsec-web-proxy", "futures", - "md-5 0.10.6", + "hex", + "md-5 0.11.0", "pyo3", "reqwest", "rustc-hash", @@ -2564,7 +2565,7 @@ dependencies = [ "futures", "h2", "hex", - "hmac 0.12.1", + "hmac 0.13.0", "http", "parking_lot", "prost", @@ -2578,7 +2579,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml_neo", - "sha2 0.10.9", + "sha2 0.11.1", "tempfile", "tokio", "tokio-rustls 0.26.6", @@ -4377,7 +4378,7 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef1d73c59a56771343712b22ea5615092c612c16ba291c0979e3105dfeec4890" dependencies = [ - "sha2 0.11.0", + "sha2 0.11.1", ] [[package]] @@ -4701,7 +4702,7 @@ dependencies = [ "serde_bytes", "serde_with", "sha1 0.11.0", - "sha2 0.11.0", + "sha2 0.11.1", "socket2 0.6.5", "stringprep", "strsim", @@ -5085,9 +5086,9 @@ checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" [[package]] name = "openssl" -version = "0.10.81" +version = "0.10.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45" +checksum = "4de8111e94a56adca7ebfe6c365b6d42f99deb69b74b6becacd4204e2f193aa2" dependencies = [ "bitflags 2.13.1", "cfg-if", @@ -5131,9 +5132,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.117" +version = "0.9.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695" +checksum = "19c413d6ec9ebaf5e1c829d355cb3e9f783778d700f135be0921d52fce3c60ae" dependencies = [ "cc", "libc", @@ -6922,9 +6923,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" +checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19" dependencies = [ "cfg-if", "cpufeatures 0.3.0", diff --git a/Cargo.toml b/Cargo.toml index c61c8edc..ac75dc7b 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,7 +58,7 @@ urlencoding = "2.1" regex = "1" hostname = "0.4" hex = "0.4" -md-5 = "0.10" +md-5 = "0.11" sha1 = "0.10" dashmap = "6" rustc-hash = "2" diff --git a/crates/eggsec-policy/Cargo.toml b/crates/eggsec-policy/Cargo.toml index 1be91dde..c859c2bb 100644 --- a/crates/eggsec-policy/Cargo.toml +++ b/crates/eggsec-policy/Cargo.toml @@ -19,7 +19,7 @@ serde_json = { workspace = true } thiserror = { workspace = true } url = { workspace = true } ipnetwork = { workspace = true } -sha2 = "0.10" +sha2 = "0.11" uuid = { workspace = true } hex = { workspace = true } rustc-hash = { workspace = true } diff --git a/crates/eggsec-python/Cargo.toml b/crates/eggsec-python/Cargo.toml index 0ea3a398..547a7067 100644 --- a/crates/eggsec-python/Cargo.toml +++ b/crates/eggsec-python/Cargo.toml @@ -69,6 +69,7 @@ anyhow = { workspace = true } rustc-hash = { workspace = true } uuid = { workspace = true } md-5 = { workspace = true } +hex = { workspace = true } reqwest = { version = "0.13", features = ["rustls-no-provider"], default-features = false } tokio-tungstenite = { version = "0.27", features = ["rustls-tls-native-roots"], optional = true } futures = { version = "0.3", optional = true } diff --git a/crates/eggsec-python/src/checkpoint_store.rs b/crates/eggsec-python/src/checkpoint_store.rs index d43a8ad5..51b0a847 100644 --- a/crates/eggsec-python/src/checkpoint_store.rs +++ b/crates/eggsec-python/src/checkpoint_store.rs @@ -579,7 +579,7 @@ fn default_execution_profile() -> String { pub fn stable_digest(value: &str) -> String { let mut hasher = Md5::new(); hasher.update(value.as_bytes()); - format!("{:x}", hasher.finalize()) + hex::encode(hasher.finalize()) } /// Expected identity values for a pipeline resume. diff --git a/crates/eggsec-python/src/content_addressed_store.rs b/crates/eggsec-python/src/content_addressed_store.rs index 5f9dc579..d10f36e4 100644 --- a/crates/eggsec-python/src/content_addressed_store.rs +++ b/crates/eggsec-python/src/content_addressed_store.rs @@ -260,7 +260,7 @@ impl ArtifactQuery { fn compute_md5_hex(data: &[u8]) -> String { let mut hasher = Md5::new(); hasher.update(data); - format!("{:x}", hasher.finalize()) + hex::encode(hasher.finalize()) } // --------------------------------------------------------------------------- diff --git a/crates/eggsec-python/src/streaming_reporter.rs b/crates/eggsec-python/src/streaming_reporter.rs index aeae23c7..61a12bd2 100644 --- a/crates/eggsec-python/src/streaming_reporter.rs +++ b/crates/eggsec-python/src/streaming_reporter.rs @@ -288,7 +288,7 @@ impl StreamingReporterPy { .map(|t| t.elapsed().as_millis() as u64) .unwrap_or(0); - let content_hash = format!("{:x}", self.hasher.finalize_reset()); + let content_hash = hex::encode(self.hasher.finalize_reset()); // Close the file handle explicitly self.output_file = None; @@ -831,5 +831,5 @@ pub fn compute_content_hash(values: &[String]) -> String { hasher.update(v.as_bytes()); hasher.update(b"\n"); } - format!("{:x}", hasher.finalize()) + hex::encode(hasher.finalize()) } diff --git a/crates/eggsec-web-proxy/Cargo.toml b/crates/eggsec-web-proxy/Cargo.toml index 945e29ca..cd44e823 100644 --- a/crates/eggsec-web-proxy/Cargo.toml +++ b/crates/eggsec-web-proxy/Cargo.toml @@ -99,8 +99,8 @@ flate2.workspace = true parking_lot = "0.12" # HMAC/SHA256 for bundle signing -hmac = "0.12" -sha2 = "0.10" +hmac = "0.13" +sha2 = "0.11" # Hex encoding for signatures and protobuf hex = "0.4" diff --git a/crates/eggsec-web-proxy/src/intercept/bundle.rs b/crates/eggsec-web-proxy/src/intercept/bundle.rs index 471cd6a4..b1231b9d 100644 --- a/crates/eggsec-web-proxy/src/intercept/bundle.rs +++ b/crates/eggsec-web-proxy/src/intercept/bundle.rs @@ -180,7 +180,7 @@ impl EvidenceBundle { /// * `key` - HMAC signing key (bytes) /// * `key_id` - Optional key identifier for tracking pub fn sign(&mut self, key: &[u8], key_id: Option<&str>) -> Result<()> { - use hmac::{Hmac, Mac}; + use hmac::{Hmac, KeyInit, Mac}; use sha2::Sha256; type HmacSha256 = Hmac; @@ -203,7 +203,7 @@ impl EvidenceBundle { /// Returns `Ok(true)` if the signature is valid, `Ok(false)` if invalid, /// or `Err` if the bundle is unsigned or verification fails. pub fn verify(&self, key: &[u8]) -> Result { - use hmac::{Hmac, Mac}; + use hmac::{Hmac, KeyInit, Mac}; use sha2::Sha256; type HmacSha256 = Hmac; diff --git a/crates/eggsec/Cargo.toml b/crates/eggsec/Cargo.toml index 5d8d86c8..7bd266c7 100644 --- a/crates/eggsec/Cargo.toml +++ b/crates/eggsec/Cargo.toml @@ -73,9 +73,9 @@ quick-xml = { version = "0.42", features = ["serialize"] } ipnetwork.workspace = true hickory-resolver.workspace = true hostname.workspace = true -sha2 = "0.10" +sha2 = "0.11" md-5.workspace = true -hmac = "0.12" +hmac = "0.13" hex.workspace = true rustc-hash = { workspace = true } subtle = "2" diff --git a/crates/eggsec/src/agent/alerts/routing.rs b/crates/eggsec/src/agent/alerts/routing.rs index a87de27e..f0d9ce64 100755 --- a/crates/eggsec/src/agent/alerts/routing.rs +++ b/crates/eggsec/src/agent/alerts/routing.rs @@ -6,7 +6,7 @@ use std::time::{Duration, Instant}; use anyhow::{Context, Result}; use chrono::Utc; -use hmac::{Hmac, Mac}; +use hmac::{Hmac, KeyInit, Mac}; use sha2::Sha256; use crate::agent::channels::{ diff --git a/crates/eggsec/src/fuzzer/diff.rs b/crates/eggsec/src/fuzzer/diff.rs index 9b775da4..009c77c7 100755 --- a/crates/eggsec/src/fuzzer/diff.rs +++ b/crates/eggsec/src/fuzzer/diff.rs @@ -167,7 +167,7 @@ impl ResponseDiffer { let mut hasher = Sha256::new(); hasher.update(body); - let body_hash = format!("{:x}", hasher.finalize()); + let body_hash = hex::encode(hasher.finalize()); let mut header_snaps = Vec::new(); let mut etag = None; diff --git a/crates/eggsec/src/notify/webhook.rs b/crates/eggsec/src/notify/webhook.rs index e600b432..2c28e390 100755 --- a/crates/eggsec/src/notify/webhook.rs +++ b/crates/eggsec/src/notify/webhook.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use crate::config::{WebhookConfig, WebhookEvent}; use crate::utils::create_http_client; use anyhow::Result; -use hmac::{Hmac, Mac}; +use hmac::{Hmac, KeyInit, Mac}; use rustc_hash::FxHashMap; use sha2::Sha256; @@ -632,7 +632,7 @@ mod tests { #[test] fn test_hmac_signature_generation() { - use hmac::{Hmac, Mac}; + use hmac::{Hmac, KeyInit, Mac}; use sha2::Sha256; let secret = SensitiveString::new("test-secret-key");