()
| 58 | |
| 59 | #[tokio::test] |
| 60 | async fn test_fuzz_authentication_messages() { |
| 61 | let inputs = generate_auth_message_fuzzing(); |
| 62 | |
| 63 | for input in inputs { |
| 64 | let result = parse_auth_message_safely(&input).await; |
| 65 | |
| 66 | match result { |
| 67 | Ok(auth_req) => { |
| 68 | // Valid auth request should have reasonable parameters |
| 69 | match auth_req { |
| 70 | AuthenticationRequest::Ok => {}, |
| 71 | AuthenticationRequest::Password => {}, |
| 72 | AuthenticationRequest::MD5Password { salt } => { |
| 73 | assert_eq!(salt.len(), 4); |
| 74 | }, |
| 75 | AuthenticationRequest::SASL { mechanisms } => { |
| 76 | assert!(mechanisms.len() <= 10); |
| 77 | for mechanism in mechanisms { |
| 78 | assert!(mechanism.len() <= 100); |
| 79 | } |
| 80 | }, |
| 81 | AuthenticationRequest::SASLContinue { data } => { |
| 82 | assert!(data.len() <= 4096); |
| 83 | }, |
| 84 | AuthenticationRequest::SASLFinal { data } => { |
| 85 | assert!(data.len() <= 4096); |
| 86 | }, |
| 87 | } |
| 88 | } |
| 89 | Err(_) => { |
| 90 | // Error handling is acceptable |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | #[tokio::test] |
| 97 | async fn test_fuzz_query_messages() { |
nothing calls this directly
no test coverage detected