Skip to content

Commit b3b810d

Browse files
authored
VIBECODED fix voor #164 (#181)
This pull request makes minor adjustments to improve file handling and security checks in the codebase. The changes focus on updating file extension matching and expanding the list of blocked redirect paths. Improvements to file handling: * Updated the file extension matching in `src/proxy.ts` to include `.json` files, ensuring that requests for JSON files are properly handled or filtered. Security enhancements: * Added `/manifest.json` to the list of blocked redirect paths in `src/utils/auth/redirect.ts` to prevent potential security issues with redirects to this file.
2 parents a807fbd + 66485c1 commit b3b810d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/proxy.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export async function proxy(request: NextRequest) {
1212
pathname.startsWith("/_next") ||
1313
// pathname.startsWith("/api") ||
1414
pathname === "/favicon.ico" ||
15-
/\.(css|js|ts|tsx|jsx|woff2?|ttf|png|jpg|jpeg|gif|svg|webmanifest)$/.test(pathname) ||
15+
// AI CODE START
16+
/\.(css|js|ts|tsx|jsx|woff2?|ttf|png|jpg|jpeg|gif|svg|webmanifest|json)$/.test(pathname) ||
17+
// AI CODE END
1618
request.headers.get("purpose") === "prefetch" ||
1719
request.headers.get("Next-Router-Prefetch") === "1" ||
1820
request.headers.get("RSC") === "1" ||

src/utils/auth/redirect.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ export function getValidRedirectPath(path: string | null | undefined): string {
2727
}
2828

2929
// Blacklist certain paths for security
30-
const blockedPaths = ['/api/', '/auth/sign-out'];
30+
// AI CODE START
31+
const blockedPaths = ['/api/', '/auth/sign-out', '/manifest.json'];
32+
// AI CODE END
3133
if (blockedPaths.some(blocked => path.startsWith(blocked))) {
3234
return defaultPath;
3335
}

0 commit comments

Comments
 (0)