mirror of
https://github.com/zadam/trilium.git
synced 2025-11-16 18:25:51 +01:00
refactor(csrf): move csrf to own file
This commit is contained in:
15
src/routes/csrf_protection.ts
Normal file
15
src/routes/csrf_protection.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { doubleCsrf } from "csrf-csrf";
|
||||
import sessionSecret from "../services/session_secret.js";
|
||||
|
||||
const doubleCsrfUtilities = doubleCsrf({
|
||||
getSecret: () => sessionSecret,
|
||||
cookieOptions: {
|
||||
path: "", // empty, so cookie is valid only for the current path
|
||||
secure: false,
|
||||
sameSite: false,
|
||||
httpOnly: false
|
||||
},
|
||||
cookieName: "_csrf"
|
||||
});
|
||||
|
||||
export const { doubleCsrfProtection } = doubleCsrfUtilities;
|
||||
Reference in New Issue
Block a user