chore: CSRF protect cancel functionality (#23439)
* add csrf endpoint * Update booking-pages.e2e.ts * Update zod-utils.ts * fix type error
This commit is contained in:
1 parent
2e9aa01771
commit
f6f36750ec
5 files changed
+40
-2
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { randomBytes } from "crypto";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET() {
|
||||
const token = randomBytes(32).toString("hex");
|
||||
|
||||
const res = NextResponse.json({ csrfToken: token });
|
||||
|
||||
res.cookies.set("calcom.csrf_token", token, {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === "production",
|
||||
sameSite: "lax",
|
||||
path: "/",
|
||||
});
|
||||
|
||||
return res;
|
||||
}
|
||||
Reference in new issue
Block a user