From 8f9224cc09d32e8354308f4d06ddb6a8e7f16c75 Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Tue, 3 Nov 2026 15:38:56 +0000 Subject: [PATCH 1/2] test(llm): cover redaction of host context in catalog limits debug output Add a test asserting that formatting a catalog limits request for debugging keeps the model name but replaces the host context with a placeholder, so secrets are not leaked into logs. Auto-committed-on: cuttlefish Co-authored-by: Medulla --- .../tinyinference-llm/tests/provider_overrides.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/tinyinference-llm/tests/provider_overrides.rs b/crates/tinyinference-llm/tests/provider_overrides.rs index ac160a9c..2c3613bf 100644 --- a/crates/tinyinference-llm/tests/provider_overrides.rs +++ b/crates/tinyinference-llm/tests/provider_overrides.rs @@ -380,3 +380,17 @@ fn registered_chat_entry_exposes_all_provider_model_metadata() { assert_eq!(request.metadata["caller"], "retained"); assert_eq!(request.metadata["reasoning_disabled"], true); } + +#[test] +fn catalog_limits_request_debug_redacts_the_host_context() { + let request = CatalogLimitsRequest { + model: "gpt-test".to_string(), + context: "sk-live-secret", + }; + + let printed = format!("{request:?}"); + + assert!(printed.contains("gpt-test"), "{printed}"); + assert!(printed.contains(""), "{printed}"); + assert!(!printed.contains("sk-live-secret"), "{printed}"); +} From 8123856a2279b361f41bd3739ab2104182153ea5 Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Tue, 3 Nov 2026 15:39:09 +0000 Subject: [PATCH 2/2] fix(providers): redact host context from catalog limits request debug output Replace the derived Debug implementation on CatalogLimitsRequest with a manual one that prints the model name but masks the host context, so debug logging no longer leaks caller-supplied context values. Auto-committed-on: cuttlefish Co-authored-by: Medulla --- crates/tinyinference-llm/src/providers/overrides.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/tinyinference-llm/src/providers/overrides.rs b/crates/tinyinference-llm/src/providers/overrides.rs index 59f4e9a2..078f272a 100644 --- a/crates/tinyinference-llm/src/providers/overrides.rs +++ b/crates/tinyinference-llm/src/providers/overrides.rs @@ -227,7 +227,6 @@ pub type CatalogListing = pub type CatalogLimitsFuture = BoxFuture>; /// Input to an async provider catalog limits resolver. -#[derive(Debug)] pub struct CatalogLimitsRequest { /// Model whose supported limits are being discovered. pub model: String, @@ -235,6 +234,16 @@ pub struct CatalogLimitsRequest { pub context: Ctx, } +impl std::fmt::Debug for CatalogLimitsRequest { + fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter + .debug_struct("CatalogLimitsRequest") + .field("model", &self.model) + .field("context", &"") + .finish() + } +} + /// Builds the provider limit discovery request for a model, if supported. pub type CatalogLimits = Arc) -> CatalogLimitsFuture + Send + Sync>;