From c32e1a446531c3e5024c64374c546ea667486888 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 13 Dec 2024 11:00:16 +0100 Subject: [PATCH] ref(nextjs): Change url of parser base to make security scanners less sus (#14695) --- .../src/client/routing/appRouterRoutingInstrumentation.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts b/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts index 9bb6e6288a84..b281d5121626 100644 --- a/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts +++ b/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts @@ -129,7 +129,8 @@ export function appRouterInstrumentNavigation(client: Client): void { function transactionNameifyRouterArgument(target: string): string { try { - return new URL(target, 'http://some-random-base.com/').pathname; + // We provide an arbitrary base because we only care about the pathname and it makes URL parsing more resilient. + return new URL(target, 'http://example.com/').pathname; } catch { return '/'; }