chore: add additional sanitisation

This commit is contained in:
Paul Makles
2023-06-11 12:26:18 +01:00
parent 0578a05a05
commit c8d5128b0c
4 changed files with 14 additions and 1 deletions

View File

@@ -177,6 +177,11 @@ impl User {
// Copy the username for validation
let username_lowercase = username.to_lowercase();
// Block homoglyphs
if decancer::cure(&username_lowercase).into_str() != username_lowercase {
return Err(Error::InvalidUsername);
}
// Ensure the username itself isn't blocked
const BLOCKED_USERNAMES: &[&str] = &["admin", "revolt"];