Skip to main content

find_secret_key

Function find_secret_key 

Source
pub fn find_secret_key(value: &Value) -> Option<String>
Expand description

Find the first secret-bearing key path in a JSON value, if any.

Why: a boolean would tell an operator that their import was refused without telling them which key to remove. What: a depth-first walk returning the dotted key path of the first key is_secret_key accepts; None when clean. Array elements are indexed (mcp.0.token). Keys only — a bare credential under an unrelated key is out of scope, as the README states. Test: paths::tests::secret_bearing_keys_are_detected, paths::tests::nested_kebab_secret_is_reported_by_path, paths::tests::ordinary_settings_carry_no_secret.