diff --git a/apps/web/src/pages/RouteDefinitions.tsx b/apps/web/src/pages/RouteDefinitions.tsx index 25b02212ee6..ce6646265b1 100644 --- a/apps/web/src/pages/RouteDefinitions.tsx +++ b/apps/web/src/pages/RouteDefinitions.tsx @@ -129,7 +129,15 @@ export const routes: RouteDefinition[] = [ getTitle: () => StaticTitlesAndDescriptions.UniswapTitle, getDescription: () => StaticTitlesAndDescriptions.SwapDescription, getElement: (args) => { - return args.browserRouterEnabled && args.hash ? : + if (args.browserRouterEnabled && args.hash) { + const path = args.hash.replace('#', '') + // Only redirect to internal paths starting with a single '/' to prevent + // protocol-relative URLs (e.g. //example.org) from causing SecurityErrors. + if (path.startsWith('/') && !path.startsWith('//')) { + return + } + } + return }, }), createRouteDefinition({