Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(api): validate auth header format before setting session cookie

Richie McIlroy4cf9121bf3d3
diff --git a/apps/web/app/api/utils.ts b/apps/web/app/api/utils.ts
index cc71822b2..0e29c92d6 100644
--- a/apps/web/app/api/utils.ts
+++ b/apps/web/app/api/utils.ts
@@ -28,7 +28,7 @@ async function getAuth(c: Context) {
.where(eq(authApiKeys.id, authHeader));
user = res[0]?.users;
} else {
- if (authHeader)
+ if (authHeader && /^[a-zA-Z0-9._-]+$/.test(authHeader))
(await cookies()).set({
name: "next-auth.session-token",
value: authHeader,