Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(csrf): stop leaking the CSRF token in the server logs
Panagiotis Papadopoulosec19ccd7a728
diff --git a/src/routes/index.ts b/src/routes/index.tsindex 18cbaf081e..5996eddf06 100644--- a/src/routes/index.ts+++ b/src/routes/index.ts@@ -24,7 +24,7 @@ function index(req: Request, res: Response) {//'overwrite' set to false (default) => the existing token will be re-used and validated//'validateOnReuse' set to false => if validation fails, generate a new token instead of throwing an errorconst csrfToken = generateCsrfToken(req, res, false, false);- log.info(`Generated CSRF token ${csrfToken} with secret ${res.getHeader("set-cookie")}`);+ log.info(`CSRF token generation: ${csrfToken ? "Successful" : "Failed"}`);// We force the page to not be cached since on mobile the CSRF token can be// broken when closing the browser and coming back in to the page.