chore(deps): bump sha2 from 0.10.9 to 0.11.0 (#8963)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jack Amadeo <jackamadeo@squareup.com>
This commit is contained in:
Generated
+2
-2
@@ -4532,7 +4532,7 @@ dependencies = [
|
|||||||
"serde_urlencoded",
|
"serde_urlencoded",
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
"serial_test",
|
"serial_test",
|
||||||
"sha2 0.10.9",
|
"sha2 0.11.0",
|
||||||
"shell-words",
|
"shell-words",
|
||||||
"shellexpand",
|
"shellexpand",
|
||||||
"smithy-transport-reqwest",
|
"smithy-transport-reqwest",
|
||||||
@@ -4621,7 +4621,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
"sha2 0.10.9",
|
"sha2 0.11.0",
|
||||||
"shlex",
|
"shlex",
|
||||||
"sigstore-verify",
|
"sigstore-verify",
|
||||||
"strum 0.27.2",
|
"strum 0.27.2",
|
||||||
|
|||||||
+1
-1
@@ -76,7 +76,7 @@ winapi = { version = "0.3.9", default-features = false, features = ["wincred", "
|
|||||||
wiremock = { version = "0.6", default-features = false }
|
wiremock = { version = "0.6", default-features = false }
|
||||||
zip = { version = "8", default-features = false, features = ["deflate"] }
|
zip = { version = "8", default-features = false, features = ["deflate"] }
|
||||||
serial_test = { version = "3", default-features = false }
|
serial_test = { version = "3", default-features = false }
|
||||||
sha2 = { version = "0.10.8", default-features = false, features = ["std"] }
|
sha2 = { version = "0.11", default-features = false }
|
||||||
shell-words = { version = "1", default-features = false, features = ["std"] }
|
shell-words = { version = "1", default-features = false, features = ["std"] }
|
||||||
test-case = { version = "3", default-features = false }
|
test-case = { version = "3", default-features = false }
|
||||||
url = { version = "2.5.4", default-features = false, features = ["std"] }
|
url = { version = "2.5.4", default-features = false, features = ["std"] }
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ fn binary_name() -> &'static str {
|
|||||||
fn sha256_hex(data: &[u8]) -> String {
|
fn sha256_hex(data: &[u8]) -> String {
|
||||||
let mut hasher = Sha256::new();
|
let mut hasher = Sha256::new();
|
||||||
hasher.update(data);
|
hasher.update(data);
|
||||||
format!("{:x}", hasher.finalize())
|
goose::utils::bytes_to_hex(hasher.finalize())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use crate::config::paths::Paths;
|
use crate::config::paths::Paths;
|
||||||
|
use crate::utils::bytes_to_hex;
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@@ -36,8 +37,8 @@ impl McpAppCache {
|
|||||||
|
|
||||||
fn cache_key(extension_name: &str, resource_uri: &str) -> String {
|
fn cache_key(extension_name: &str, resource_uri: &str) -> String {
|
||||||
let input = format!("{}::{}", extension_name, resource_uri);
|
let input = format!("{}::{}", extension_name, resource_uri);
|
||||||
let hash = Sha256::digest(input.as_bytes());
|
let hash = bytes_to_hex(Sha256::digest(input.as_bytes()));
|
||||||
format!("{}_{:x}", extension_name, hash)
|
format!("{}_{}", extension_name, hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn list_apps(&self) -> Result<Vec<GooseApp>, std::io::Error> {
|
pub fn list_apps(&self) -> Result<Vec<GooseApp>, std::io::Error> {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use super::catalog::ProviderSetupCategory;
|
|||||||
use crate::config::declarative_providers::{DeclarativeProviderConfig, ProviderEngine};
|
use crate::config::declarative_providers::{DeclarativeProviderConfig, ProviderEngine};
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::session::session_manager::SessionStorage;
|
use crate::session::session_manager::SessionStorage;
|
||||||
|
use crate::utils::bytes_to_hex;
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use chrono::{DateTime, Duration, Utc};
|
use chrono::{DateTime, Duration, Utc};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@@ -126,7 +127,7 @@ impl InventoryIdentityInput {
|
|||||||
Ok(InventoryIdentity {
|
Ok(InventoryIdentity {
|
||||||
provider_id,
|
provider_id,
|
||||||
provider_family,
|
provider_family,
|
||||||
inventory_key: format!("{digest:x}"),
|
inventory_key: bytes_to_hex(digest),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use crate::config::paths::Paths;
|
use crate::config::paths::Paths;
|
||||||
|
use crate::utils::bytes_to_hex;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use axum::{extract::Query, response::Html, routing::get, Router};
|
use axum::{extract::Query, response::Html, routing::get, Router};
|
||||||
use base64::Engine;
|
use base64::Engine;
|
||||||
@@ -56,7 +57,7 @@ impl TokenCache {
|
|||||||
hasher.update(host.as_bytes());
|
hasher.update(host.as_bytes());
|
||||||
hasher.update(client_id.as_bytes());
|
hasher.update(client_id.as_bytes());
|
||||||
hasher.update(scopes.join(",").as_bytes());
|
hasher.update(scopes.join(",").as_bytes());
|
||||||
let hash = format!("{:x}", hasher.finalize());
|
let hash = bytes_to_hex(hasher.finalize());
|
||||||
|
|
||||||
fs::create_dir_all(get_base_path()).unwrap();
|
fs::create_dir_all(get_base_path()).unwrap();
|
||||||
let cache_path = get_base_path().join(format!("{}.json", hash));
|
let cache_path = get_base_path().join(format!("{}.json", hash));
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use super::base::{MessageStream, Provider, ProviderDef, ProviderMetadata, Provid
|
|||||||
use super::errors::ProviderError;
|
use super::errors::ProviderError;
|
||||||
use crate::conversation::message::{Message, ToolResponse};
|
use crate::conversation::message::{Message, ToolResponse};
|
||||||
use crate::model::ModelConfig;
|
use crate::model::ModelConfig;
|
||||||
|
use crate::utils::bytes_to_hex;
|
||||||
use futures::future::BoxFuture;
|
use futures::future::BoxFuture;
|
||||||
use rmcp::model::{CallToolResult, Tool};
|
use rmcp::model::{CallToolResult, Tool};
|
||||||
|
|
||||||
@@ -111,7 +112,7 @@ impl TestProvider {
|
|||||||
let serialized = serde_json::to_string(&stable_messages).unwrap_or_default();
|
let serialized = serde_json::to_string(&stable_messages).unwrap_or_default();
|
||||||
let mut hasher = Sha256::new();
|
let mut hasher = Sha256::new();
|
||||||
hasher.update(serialized.as_bytes());
|
hasher.update(serialized.as_bytes());
|
||||||
format!("{:x}", hasher.finalize())
|
bytes_to_hex(hasher.finalize())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_records(file_path: &str) -> Result<HashMap<String, TestRecord>> {
|
fn load_records(file_path: &str) -> Result<HashMap<String, TestRecord>> {
|
||||||
|
|||||||
@@ -1,6 +1,23 @@
|
|||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
use unicode_normalization::UnicodeNormalization;
|
use unicode_normalization::UnicodeNormalization;
|
||||||
|
|
||||||
|
/// Encode bytes as a lowercase hexadecimal string.
|
||||||
|
///
|
||||||
|
/// This avoids relying on digest output types implementing `LowerHex`, which
|
||||||
|
/// changed in sha2 0.11.
|
||||||
|
pub fn bytes_to_hex(bytes: impl AsRef<[u8]>) -> String {
|
||||||
|
const HEX: &[u8; 16] = b"0123456789abcdef";
|
||||||
|
let bytes = bytes.as_ref();
|
||||||
|
let mut output = String::with_capacity(bytes.len() * 2);
|
||||||
|
|
||||||
|
for &byte in bytes {
|
||||||
|
output.push(HEX[(byte >> 4) as usize] as char);
|
||||||
|
output.push(HEX[(byte & 0x0f) as usize] as char);
|
||||||
|
}
|
||||||
|
|
||||||
|
output
|
||||||
|
}
|
||||||
|
|
||||||
/// Check if a character is in the Unicode Tags Block range (U+E0000-U+E007F)
|
/// Check if a character is in the Unicode Tags Block range (U+E0000-U+E007F)
|
||||||
/// These characters are invisible and can be used for steganographic attacks
|
/// These characters are invisible and can be used for steganographic attacks
|
||||||
fn is_in_unicode_tag_range(c: char) -> bool {
|
fn is_in_unicode_tag_range(c: char) -> bool {
|
||||||
@@ -83,6 +100,13 @@ pub fn split_command_args(input: &str) -> anyhow::Result<Vec<String>> {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_bytes_to_hex() {
|
||||||
|
assert_eq!(bytes_to_hex([]), "");
|
||||||
|
assert_eq!(bytes_to_hex([0x00, 0x0f, 0x10, 0xab, 0xff]), "000f10abff");
|
||||||
|
assert_eq!(bytes_to_hex(b"hello world"), "68656c6c6f20776f726c64");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_contains_unicode_tags() {
|
fn test_contains_unicode_tags() {
|
||||||
// Test detection of Unicode Tags Block characters
|
// Test detection of Unicode Tags Block characters
|
||||||
|
|||||||
Reference in New Issue
Block a user