File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ type Error = Box<dyn std::error::Error>;
3030type Result < T > = std:: result:: Result < T , Error > ;
3131type CommandResult < T > = std:: result:: Result < T , String > ;
3232
33+ static LOGIN_COOKIE_REGEX : LazyLock < Regex > = LazyLock :: new ( || Regex :: new ( r#"-t (\S+)"# ) . unwrap ( ) ) ;
34+
3335static VERSION_NUMBER_REGEX : LazyLock < Regex > =
3436 LazyLock :: new ( || Regex :: new ( r"^v?\d+(?:\.\d)*$" ) . unwrap ( ) ) ;
3537const UPDATE_CHECK_URL : & str =
@@ -104,9 +106,13 @@ async fn do_launch(app_handle: tauri::AppHandle) -> CommandResult<i32> {
104106 let cmd_str = util:: get_launch_cmd_dbg_str ( & cmd, false ) ;
105107 drop ( state) ;
106108
107- let mut proc = cmd
108- . spawn ( )
109- . map_err ( |e| format ! ( "{} (launch command was: {})" , e, cmd_str) ) ?;
109+ let mut proc = cmd. spawn ( ) . map_err ( |e| {
110+ // we want to censor the login cookie if present
111+ let censored_cmd_str = LOGIN_COOKIE_REGEX
112+ . replace_all ( & cmd_str, "-t ***" )
113+ . to_string ( ) ;
114+ format ! ( "{} (launch command was: {})" , e, censored_cmd_str)
115+ } ) ?;
110116 if launch_behavior == LaunchBehavior :: Quit {
111117 app_handle. exit ( 0 ) ;
112118 return Ok ( 0 ) ;
You can’t perform that action at this time.
0 commit comments