mirror of
https://github.com/element-hq/matrix-authentication-service.git
synced 2026-10-27 08:03:30 +00:00
Clean up the tests for allowed characters in scope
This commit is contained in:
1 file changed
+10
-11
@@ -228,6 +228,10 @@ mod tests {
|
||||
assert_eq!(ScopeToken::from_str("openid"), Ok(OPENID));
|
||||
|
||||
assert_eq!(ScopeToken::from_str("invalid\\scope"), Err(InvalidScope));
|
||||
|
||||
// Regression test for #5878: Matrix device IDs may contain any
|
||||
// RFC 3986 unreserved character, including `~`.
|
||||
assert!(ScopeToken::from_str("urn:matrix:client:device:AA~bb1234_-.").is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -244,19 +248,14 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
// Boundary characters affected by the off-by-one bug.
|
||||
for c in ['!', '#', '[', ']', '~'] {
|
||||
assert!(ScopeToken::from_str(&c.to_string()).is_ok());
|
||||
}
|
||||
|
||||
// Outside NQCHAR.
|
||||
for s in [" ", "\"", "\\", "\x7F", ""] {
|
||||
// Outside NQCHAR:
|
||||
// - space is 0x20
|
||||
// - " (double quote) is 0x22
|
||||
// - \ (backslash) is 0x5C
|
||||
// - DEL is 0x7F
|
||||
for s in [" ", "\"", "\\", "\x7F"] {
|
||||
assert_eq!(ScopeToken::from_str(s), Err(InvalidScope));
|
||||
}
|
||||
|
||||
// Regression test for #5878: Matrix device IDs may contain any
|
||||
// RFC 3986 unreserved character, including `~`.
|
||||
assert!(ScopeToken::from_str("urn:matrix:client:device:AA~bb1234_-.").is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user