From 001837617caf40949ed0fe9d438e6c57c6f79a4e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2026 04:46:01 +0000 Subject: [PATCH 1/2] test: add comprehensive tests for mask_secrets Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com> --- src/config/mod.rs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/config/mod.rs b/src/config/mod.rs index 74cfa60..72285e3 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -729,6 +729,44 @@ mod config_path_tests { assert_eq!(raw["model"], "m"); assert_eq!(raw["agent"]["max_rounds"], 12); } + + #[test] + fn mask_secrets_covers_objects_arrays_and_skips_empty() { + let mut data = serde_json::json!({ + "api_key": "secret_value", + "empty_api_key": "", + "null_token": null, + "number_secret": 12345, + "nested": { + "token": "inner_secret", + "normal": "value" + }, + "array": [ + { "password": "arr_secret" }, + { "normal": "value" }, + "just_a_string" + ] + }); + + mask_secrets(&mut data); + + // String secrets are masked + assert_eq!(data["api_key"], "********"); + assert_eq!(data["nested"]["token"], "********"); + assert_eq!(data["array"][0]["password"], "********"); + + // Empty string secrets are untouched + assert_eq!(data["empty_api_key"], ""); + + // Non-string secrets are untouched (the mask_secrets only masks String) + assert_eq!(data["null_token"], serde_json::Value::Null); + assert_eq!(data["number_secret"], 12345); + + // Normal values are untouched + assert_eq!(data["nested"]["normal"], "value"); + assert_eq!(data["array"][1]["normal"], "value"); + assert_eq!(data["array"][2], "just_a_string"); + } } #[cfg(test)] From 64bb4df3dc0212e11ba53b7d1fee37eaaab17a94 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2026 04:48:07 +0000 Subject: [PATCH 2/2] test: add comprehensive tests for mask_secrets Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>