diff --git a/src/hooks-pre-tool-validate/src/presets/safety/secret.rs b/src/hooks-pre-tool-validate/src/presets/safety/secret.rs index 688108a4..7d57b813 100644 --- a/src/hooks-pre-tool-validate/src/presets/safety/secret.rs +++ b/src/hooks-pre-tool-validate/src/presets/safety/secret.rs @@ -149,6 +149,24 @@ mod tests { assert!(is_blocked_with(&cmd, SECRET_DETECT)); } + #[test] + fn secret_detection_blocks_github_user_to_server_token() { + let cmd = format!( + "let token = \"{}{}\";", + "ghu_", "abcdefghijklmnopqrstuvwxyz0123456789" + ); + assert!(is_blocked_with(&cmd, SECRET_DETECT)); + } + + #[test] + fn secret_detection_blocks_github_refresh_token() { + let cmd = format!( + "let token = \"{}{}\";", + "ghr_", "abcdefghijklmnopqrstuvwxyz0123456789" + ); + assert!(is_blocked_with(&cmd, SECRET_DETECT)); + } + #[test] fn secret_detection_blocks_anthropic_api_key() { let cmd = format!(