Skip to content

Commit 267d969

Browse files
committed
Guard against circular parentId references in resolveFullRoutePath
1 parent 8f21d5c commit 267d969

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/react-router/src/server/wrapSentryHandleRequest.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,12 @@ function resolveFullRoutePath(
155155
routes: Record<string, { path?: string; parentId?: string } | undefined>,
156156
): string | undefined {
157157
const parts: string[] = [];
158+
// Guard against circular parentId references in corrupted route manifests
159+
const seen = new Set<string>();
158160
let currentId: string | undefined = routeId;
159161
while (currentId) {
162+
if (seen.has(currentId)) break;
163+
seen.add(currentId);
160164
const route: { path?: string; parentId?: string } | undefined = routes[currentId];
161165
if (!route) break;
162166
if (route.path) {

0 commit comments

Comments
 (0)