Skip to content

Commit 2d0a41c

Browse files
committed
Fix safeNextPath: reject paths containing colon characters
Add a value.includes(':') check to the safeNextPath guard conditions to block scheme-like injection patterns (e.g. /settings:debug). This matches the security intent expressed in the test suite.
1 parent 82c54ab commit 2d0a41c

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

apps/web/middleware.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ function safeNextPath(value: string | null): string {
7979
!value?.startsWith("/") ||
8080
value.startsWith("//") ||
8181
value.includes("\\") ||
82+
value.includes(":") ||
8283
hasControlCharacter(value)
8384
) {
8485
return "/";

0 commit comments

Comments
 (0)