Skip to main content

is_secret_key

Function is_secret_key 

Source
pub fn is_secret_key(key: &str) -> bool
Expand description

Whether one JSON key names a credential.

Why: the single rule both the import refusal and its tests apply, so the spelling coverage cannot drift between them. What: false outright when the whole key is a SECRET_KEY_EXEMPTIONS entry. Otherwise true when any single word of the key, or any two ADJACENT words joined, matches SECRET_KEY_HINTS under [matches_hint]’s de-pluralising comparison. Word-exact, so tokenizer and secretary are clean while token, tokens and x-api-key are not. Test: paths::tests::secret_keys_match_across_separator_and_case_spellings, paths::tests::secret_keys_match_plural_spellings, paths::tests::max_tokens_stays_benign_as_a_count_not_a_credential, paths::tests::benign_keys_containing_a_hint_are_not_flagged.