File tree Expand file tree Collapse file tree
crates/defguard_core/src/handlers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,11 @@ use crate::{
6767
6868const TOKEN_CLIENT_ID : & str = "Defguard Core" ;
6969const CONNECTION_TIMEOUT : Duration = Duration :: from_secs ( 10 ) ;
70+ /// Maximum lifetime of a one-time setup session token.
71+ /// The setup handshake must complete within this window; tokens that outlive
72+ /// it are useless and limiting the expiry reduces the damage window if the
73+ /// token is captured from the plaintext setup channel.
74+ const SETUP_TOKEN_EXPIRY_SECS : u64 = 300 ;
7075
7176/// Guard that aborts a tokio task when dropped
7277struct TaskGuard ( tokio:: task:: JoinHandle < ( ) > ) ;
@@ -358,7 +363,7 @@ pub async fn setup_proxy_tls_stream(
358363 defguard_common:: auth:: claims:: ClaimsType :: Gateway ,
359364 url. to_string( ) ,
360365 TOKEN_CLIENT_ID . to_string( ) ,
361- u32 :: MAX . into ( ) ,
366+ SETUP_TOKEN_EXPIRY_SECS ,
362367 )
363368 . to_jwt( )
364369 {
@@ -802,7 +807,7 @@ pub async fn setup_gateway_tls_stream(
802807 defguard_common:: auth:: claims:: ClaimsType :: Gateway ,
803808 url. to_string( ) ,
804809 TOKEN_CLIENT_ID . to_string( ) ,
805- u32 :: MAX . into ( ) ,
810+ SETUP_TOKEN_EXPIRY_SECS ,
806811 )
807812 . to_jwt( )
808813 {
You can’t perform that action at this time.
0 commit comments