pt: Reject a pluggable transport named Bridge

https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/91
This commit is contained in:
Ian Jackson 2022-09-27 13:02:06 +01:00
parent 102a663907
commit 278425321d
1 changed files with 5 additions and 0 deletions

View File

@ -136,6 +136,7 @@ fn is_well_formed_id(s: &str) -> bool {
if let Some(first) = bytes.next() {
(first.is_ascii_alphabetic() || first == b'_')
&& bytes.all(|b| b.is_ascii_alphanumeric() || b == b'_')
&& !s.eq_ignore_ascii_case("bridge")
} else {
false
}
@ -372,6 +373,10 @@ mod test {
TransportId::from_str("12345"),
Err(TransportIdError::BadId(_))
));
assert!(matches!(
TransportId::from_str("bridge"),
Err(TransportIdError::BadId(_))
));
}
#[test]