@@ -7,6 +7,7 @@ import { useSearchParams } from "react-router-dom";
77import { isDevelopment } from "@constants/global.constants" ;
88import { LoggerService } from "@services" ;
99import { LoginPageProps } from "@src/interfaces/components" ;
10+ import { validateOAuthRedirectURL } from "@utilities/validateUrl.utils" ;
1011
1112import { AHref , IconSvg , Loader } from "@components/atoms" ;
1213import { OAuthProviderButton } from "@components/molecules" ;
@@ -75,8 +76,15 @@ const Login = ({ handleSuccess, isLoggingIn }: LoginPageProps) => {
7576 LoggerService . debug ( "auth.oauth.login" , `OAuth start successful, redirecting to: ${ resp ?. data ?. url } ` ) ;
7677 }
7778
78- // TODO: Add URL validation before redirect
79- window . location . href = resp ?. data ?. url ;
79+ // Validate OAuth redirect URL for security
80+ const redirectUrl = resp ?. data ?. url ;
81+ if ( ! redirectUrl || ! validateOAuthRedirectURL ( redirectUrl ) ) {
82+ LoggerService . error ( "auth.oauth.login" , `Invalid OAuth redirect URL received: ${ redirectUrl } ` , true ) ;
83+ // TODO: Show user-friendly error notification
84+ return ;
85+ }
86+
87+ window . location . href = redirectUrl ;
8088 } catch ( error ) {
8189 LoggerService . error ( "auth.oauth.login" , `Error initiating OAuth: ${ error } ` , true ) ;
8290 // TODO: Show user-friendly error notification
0 commit comments