@@ -3,15 +3,15 @@ use crate::{
33 l10n:: { LANGUAGE , Language } ,
44 tl,
55} ;
6- use anyhow:: { anyhow , bail , Context , Result } ;
6+ use anyhow:: { Context , Result , anyhow , bail } ;
77use phira_mp_common:: {
8- ClientCommand , JoinRoomResponse , Message , RoomState , ServerCommand , Stream , UserInfo ,
9- HEARTBEAT_DISCONNECT_TIMEOUT ,
8+ ClientCommand , HEARTBEAT_DISCONNECT_TIMEOUT , JoinRoomResponse , Message , RoomState ,
9+ ServerCommand , Stream , UserInfo ,
1010} ;
1111use serde:: Deserialize ;
1212use serde_json:: json;
1313use std:: {
14- collections:: { hash_map :: Entry , HashMap , HashSet } ,
14+ collections:: { HashMap , HashSet , hash_map :: Entry } ,
1515 ops:: DerefMut ,
1616 sync:: {
1717 Arc , Weak ,
@@ -240,6 +240,9 @@ impl Drop for Session {
240240
241241async fn authenticate ( id : Uuid , token : & str ) -> Result < AuthUserInfo > {
242242 debug ! ( "session {id}: authenticate {token}" ) ;
243+ if token. len ( ) > 32 {
244+ bail ! ( "invalid token length" ) ;
245+ }
243246 reqwest:: Client :: new ( )
244247 . get ( format ! ( "{HOST}/me" ) )
245248 . header ( reqwest:: header:: AUTHORIZATION , format ! ( "Bearer {token}" ) )
0 commit comments