{"record":{"id":"fbc060bbfa5711ba","repo":"influxdata/influxdb","slug":"role-description-contains-invalid-characters-only","errorCode":null,"errorMessage":"role description contains invalid characters: only alphanumeric and [{0}] are allowed","messagePattern":"role description contains invalid characters: only alphanumeric and \\[(.+?)\\] are allowed","errorType":"validation","errorClass":"NewRoleDescriptionError","httpStatus":null,"severity":"error","filePath":"influxdb3_authz/src/role/role.rs","lineNumber":140,"sourceCode":"        Ok(Self(description.to_string()))\n    }\n\n    pub fn into_inner(self) -> String {\n        self.0\n    }\n\n    pub fn new_unchecked(description: String) -> Self {\n        Self(description)\n    }\n}\n\n#[derive(Debug, Clone, Error)]\npub enum NewRoleDescriptionError {\n    #[error(\"role description cannot be empty\")]\n    Empty,\n    #[error(\"role description exceeds maximum length of {ROLE_DESCRIPTION_MAX_LENGTH} characters\")]\n    TooLong,\n    #[error(\n        \"role description contains invalid characters: only alphanumeric and [{0}] are allowed\"\n    )]\n    InvalidCharacters(String),\n}\n\nfn format_allowed_chars(chars: &[char]) -> String {\n    chars\n        .iter()\n        .map(|c| format!(\"'{c}'\"))\n        .collect::<Vec<_>>()\n        .join(\", \")\n}\n","sourceCodeStart":122,"sourceCodeEnd":153,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_authz/src/role/role.rs#L122-L153","documentation":"NewRoleDescriptionError::InvalidCharacters is returned when a role description contains characters outside the allowed set (alphanumeric plus those listed via format_allowed_chars). This keeps descriptions safe for storage and display.","triggerScenarios":"Providing a description with disallowed symbols or control/non-ASCII characters when creating or updating a role.","commonSituations":"Descriptions pasted from rich-text editors or containing angle brackets, quotes, or emoji that fail the allowlist.","solutions":["Restrict the description to alphanumeric characters and the allowed punctuation shown in the error message","Sanitize input by stripping or replacing disallowed characters before submission","Validate client-side with the same allowlist regex used by the library"],"exampleFix":"// before\nlet desc = \"read <all> data \\u{1F680}\"; // contains disallowed chars\n// after\nlet desc = \"read all data\";","handlingStrategy":"validation","validationCode":"fn valid_role_description_chars(desc: &str) -> bool {\n    // match the allowlist used by NewRoleDescriptionError (alphanumeric + allowed punctuation)\n    desc.chars().all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_' || c == ' ' || c == '.')\n}","typeGuard":"fn sanitize_role_description(raw: &str) -> String {\n    raw.chars().filter(|c| c.is_ascii_alphanumeric() || matches!(c, '-' | '_' | ' ' | '.')).collect()\n}","tryCatchPattern":null,"preventionTips":["Strip rich-text/HTML artifacts before submitting descriptions","Avoid emoji and non-ASCII characters in role metadata","Mirror the library's allowlist in client-side validation"],"tags":["validation","role-management","rust"],"backgroundTag":"schema-validation-failed","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}