Description
In ruma-identifiers-validation before 0.14.0, ruma_identifiers_validation::key_id::validate can panic while processing a Matrix key ID. If the algorithm name is long and contains non-ASCII characters, the library can miscalculate a byte offset and try to split a UTF-8 character.
Potential impact
Validation of an externally supplied key ID can interrupt the request. Services built to abort on panic can stop serving all requests.
Remediation
Update ruma-identifiers-validation to 0.14.0 or later. If another crate brings in the dependency, update that crate to a version that accepts the fix.
Examples
The following Cargo.toml examples show a direct dependency.
Before
toml
[dependencies]
ruma-identifiers-validation = "=0.13.0"
After
toml
[dependencies]
ruma-identifiers-validation = "0.14.0"
Check the resolved version in Cargo.lock and rebuild the application.