mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-08 17:22:29 +08:00
feat(csrf_protection): use cookiePath from config
This commit is contained in:
parent
a600568ab8
commit
b6d73df92e
@ -1,11 +1,12 @@
|
|||||||
import { doubleCsrf } from "csrf-csrf";
|
import { doubleCsrf } from "csrf-csrf";
|
||||||
import sessionSecret from "../services/session_secret.js";
|
import sessionSecret from "../services/session_secret.js";
|
||||||
import { isElectron } from "../services/utils.js";
|
import { isElectron } from "../services/utils.js";
|
||||||
|
import config from "../services/config.js";
|
||||||
|
|
||||||
const doubleCsrfUtilities = doubleCsrf({
|
const doubleCsrfUtilities = doubleCsrf({
|
||||||
getSecret: () => sessionSecret,
|
getSecret: () => sessionSecret,
|
||||||
cookieOptions: {
|
cookieOptions: {
|
||||||
path: "", // empty, so cookie is valid only for the current path
|
path: config.Cookies.cookiePath,
|
||||||
secure: false,
|
secure: false,
|
||||||
sameSite: "strict",
|
sameSite: "strict",
|
||||||
httpOnly: !isElectron // set to false for Electron, see https://github.com/TriliumNext/Notes/pull/966
|
httpOnly: !isElectron // set to false for Electron, see https://github.com/TriliumNext/Notes/pull/966
|
||||||
|
Loading…
x
Reference in New Issue
Block a user