MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_fuzz_authentication_messages

Function test_fuzz_authentication_messages

tests/protocol_fuzzing_test.rs:60–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

58
59#[tokio::test]
60async 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]
97async fn test_fuzz_query_messages() {

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected