Skip to main content

validate_message_content

Function validate_message_content 

Source
pub fn validate_message_content(
    input: &str,
    max_len: usize,
) -> Result<String, ValidationError>
Expand description

Validate and sanitize message content from channels.

Performs:

  1. Length check (prevent memory exhaustion)
  2. Strip null bytes and control chars (except newlines/tabs)
  3. Unicode normalization (NFKC - prevent homograph attacks)

ยงErrors

Returns ValidationError::TooLong if input exceeds max_len.