File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
apps/dashboard/src/app/(dashboard)/onboarding Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -134,10 +134,15 @@ export function Client() {
134134 try {
135135 const url = new URL ( callbackUrl , window . location . origin ) ;
136136 if ( url . pathname === "/" || url . pathname === "" ) return ;
137+ // Only allow same-origin redirects with safe protocols
138+ if ( url . origin !== window . location . origin ) return ;
139+ if ( url . protocol !== "http:" && url . protocol !== "https:" ) return ;
137140 router . push ( callbackUrl ) ;
138141 } catch {
139142 // If callbackUrl is a relative path, check it directly
140143 if ( callbackUrl === "/" || callbackUrl === "" ) return ;
144+ // Only allow paths starting with / to prevent protocol-based attacks
145+ if ( ! callbackUrl . startsWith ( "/" ) ) return ;
141146 router . push ( callbackUrl ) ;
142147 }
143148 } , [ callbackUrl , router ] ) ;
You can’t perform that action at this time.
0 commit comments